Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update gitea reserved user names #121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 28 additions & 32 deletions src/common/adapters/gitea.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,41 @@ const GH_CONTAINERS = '.full>.page-content';
const GH_HEADER = '.full>.main';
const GH_FOOTER = 'footer > .container';
const GH_MAX_HUGE_REPOS_SIZE = 50;

const GH_RESERVED_USER_NAMES = [
'about',
'account',
'blog',
'business',
'contact',
'dashboard',
'developer',
// gitea reserved user names: https://github.com/go-gitea/gitea/blob/release/v1.18/models/user/user.go#L580
const GT_RESERVED_USER_NAMES = [
'.well-known',
'admin',
'api',
'assets',
'attachments',
'avatar',
'avatars',
'captcha',
'commits',
'debug',
'error',
'explore',
'features',
'gist',
'integrations',
'favicon.ico',
'ghost',
'issues',
'join',
'login',
'marketplace',
'mirrors',
'manifest.json',
'metrics',
'milestones',
'new',
'notifications',
'open-source',
'organizations',
'orgs',
'personal',
'pricing',
'org',
'pulls',
'raw',
'repo',
'repo-avatars',
'robots.txt',
'search',
'security',
'sessions',
'settings',
'showcases',
'site',
'stars',
'styleguide',
'topics',
'trending',
'serviceworker.js',
'ssh_info',
'swagger.v1.json',
'user',
'watching',
'api',
'v2',
];
const GH_RESERVED_REPO_NAMES = ['followers', 'following', 'repositories'];

Expand Down Expand Up @@ -152,7 +148,7 @@ class Gitea extends PjaxAdapter {

const isPR = type === 'pulls';

if (~GH_RESERVED_USER_NAMES.indexOf(username) || ~GH_RESERVED_REPO_NAMES.indexOf(reponame)) {
if (~GT_RESERVED_USER_NAMES.indexOf(username) || ~GH_RESERVED_REPO_NAMES.indexOf(reponame)) {
return cb();
}

Expand Down
60 changes: 29 additions & 31 deletions src/common/adapters/pageDetect/gitea.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
import { getRepoPath } from './util';

const GH_RESERVED_USER_NAMES = [
'about',
'account',
'blog',
'business',
'contact',
'dashboard',
'developer',
// gitea reserved user names: https://github.com/go-gitea/gitea/blob/release/v1.18/models/user/user.go#L580
const GT_RESERVED_USER_NAMES = [
'.well-known',
'admin',
'api',
'assets',
'attachments',
'avatar',
'avatars',
'captcha',
'commits',
'debug',
'error',
'explore',
'features',
'gist',
'integrations',
'favicon.ico',
'ghost',
'issues',
'join',
'login',
'marketplace',
'mirrors',
'manifest.json',
'metrics',
'milestones',
'new',
'notifications',
'open-source',
'organizations',
'orgs',
'personal',
'pricing',
'org',
'pulls',
'raw',
'repo',
'repo-avatars',
'robots.txt',
'search',
'security',
'sessions',
'settings',
'showcases',
'site',
'stars',
'styleguide',
'topics',
'trending',
'users',
'watching',
'serviceworker.js',
'ssh_info',
'swagger.v1.json',
'user',
'v2',
];
const GH_RESERVED_REPO_NAMES = ['followers', 'following', 'repositories'];
const GH_404_SEL = '#parallax_wrapper';
Expand Down Expand Up @@ -70,7 +68,7 @@ export const isRepo = function() {
const reponame = match[2];

// Not a repository, skip
return !(~GH_RESERVED_USER_NAMES.indexOf(username) || ~GH_RESERVED_REPO_NAMES.indexOf(reponame));
return !(~GT_RESERVED_USER_NAMES.indexOf(username) || ~GH_RESERVED_REPO_NAMES.indexOf(reponame));
};

export const shouldEnable = function() {
Expand Down