@@ -408,6 +408,10 @@ func (u *User) IsIndividual() bool {
408408 return u .Type == UserTypeIndividual
409409}
410410
411+ func (u * User ) IsUser () bool {
412+ return u .Type == UserTypeIndividual || u .Type == UserTypeBot
413+ }
414+
411415// IsBot returns whether or not the user is of type bot
412416func (u * User ) IsBot () bool {
413417 return u .Type == UserTypeBot
@@ -561,42 +565,43 @@ var (
561565 "." ,
562566 ".." ,
563567 ".well-known" ,
564- "admin" ,
565- "api" ,
566- "assets" ,
567- "attachments" ,
568- "avatar" ,
569- "avatars" ,
568+
569+ "api" , // gitea api
570+ "metrics" , // prometheus metrics api
571+ "v2" , // container registry api
572+
573+ "assets" , // static asset files
574+ "attachments" , // issue attachments
575+
576+ "avatar" , // avatar by email hash
577+ "avatars" , // user avatars by file name
578+ "repo-avatars" ,
579+
570580 "captcha" ,
571- "commits" ,
572- "debug" ,
573- "error" ,
581+ "login" , // oauth2 login
582+ "org" , // org create/manage, or "/org/{org}", BUT if an org is named as "invite" then it goes wrong
583+ "repo" , // repo create/migrate, etc
584+ "user" , // user login/activate/settings, etc
585+
574586 "explore" ,
575- "favicon.ico" ,
576- "ghost" ,
577587 "issues" ,
578- "login" ,
579- "manifest.json" ,
580- "metrics" ,
588+ "pulls" ,
581589 "milestones" ,
582- "new" ,
583590 "notifications" ,
584- "org" ,
585- "pulls" ,
586- "raw" ,
587- "repo" ,
588- "repo-avatars" ,
589- "robots.txt" ,
590- "search" ,
591- "serviceworker.js" ,
592- "ssh_info" ,
591+
592+ "favicon.ico" ,
593+ "manifest.json" , // web app manifests
594+ "robots.txt" , // search engine robots
595+ "sitemap.xml" , // search engine sitemap
596+ "ssh_info" , // agit info
593597 "swagger.v1.json" ,
594- "user" ,
595- "v2" ,
596- "gitea-actions" ,
598+
599+ "ghost" , // reserved name for deleted users (id: -1)
600+ "gitea-actions" , // gitea builtin user (id: -2)
597601 }
598602
599- // DON'T ADD ANY NEW STUFF, WE SOLVE THIS WITH `/user/{obj}` PATHS!
603+ // These names are reserved for user accounts: user's keys, user's rss feed, user's avatar, etc.
604+ // DO NOT add any new stuff! The paths with these names are processed by `/{username}` handler (UsernameSubRoute) manually.
600605 reservedUserPatterns = []string {"*.keys" , "*.gpg" , "*.rss" , "*.atom" , "*.png" }
601606)
602607
0 commit comments