Skip to content

Commit 7545100

Browse files
committed
Merge remote-tracking branch 'origin/main' into oidc-claims
2 parents a5d3887 + 9defddb commit 7545100

File tree

98 files changed

+976
-963
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+976
-963
lines changed

cmd/serv.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"time"
1818

1919
"code.gitea.io/gitea/models"
20+
"code.gitea.io/gitea/models/perm"
2021
"code.gitea.io/gitea/modules/git"
2122
"code.gitea.io/gitea/modules/json"
2223
"code.gitea.io/gitea/modules/log"
@@ -64,11 +65,11 @@ func setup(logPath string, debug bool) {
6465
}
6566

6667
var (
67-
allowedCommands = map[string]models.AccessMode{
68-
"git-upload-pack": models.AccessModeRead,
69-
"git-upload-archive": models.AccessModeRead,
70-
"git-receive-pack": models.AccessModeWrite,
71-
lfsAuthenticateVerb: models.AccessModeNone,
68+
allowedCommands = map[string]perm.AccessMode{
69+
"git-upload-pack": perm.AccessModeRead,
70+
"git-upload-archive": perm.AccessModeRead,
71+
"git-receive-pack": perm.AccessModeWrite,
72+
lfsAuthenticateVerb: perm.AccessModeNone,
7273
}
7374
alphaDashDotPattern = regexp.MustCompile(`[^\w-\.]`)
7475
)
@@ -214,9 +215,9 @@ func runServ(c *cli.Context) error {
214215

215216
if verb == lfsAuthenticateVerb {
216217
if lfsVerb == "upload" {
217-
requestedMode = models.AccessModeWrite
218+
requestedMode = perm.AccessModeWrite
218219
} else if lfsVerb == "download" {
219-
requestedMode = models.AccessModeRead
220+
requestedMode = perm.AccessModeRead
220221
} else {
221222
return fail("Unknown LFS verb", "Unknown lfs verb %s", lfsVerb)
222223
}

docs/content/doc/advanced/adding-legal-pages.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ wget -O /path/to/custom/public/privacy.html https://raw.githubusercontent.com/go
2525

2626
Now you need to edit the page to meet your requirements. In particular you must change the email addresses, web addresses and references to "Your Gitea Instance" to match your situation.
2727

28-
You absolutely must not place a general ToS or privacy statement that implies that the gitea project is responsible for your server.
28+
You absolutely must not place a general ToS or privacy statement that implies that the Gitea project is responsible for your server.
2929

3030
## Make it Visible
3131

docs/content/doc/advanced/cmd-embedded.en-us.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,20 @@ To extract resources embedded in Gitea's executable, use the following syntax:
7676
gitea [--config {file}] embedded extract [--destination {dir}|--custom] [--overwrite|--rename] [--include-vendored] {patterns...}
7777
```
7878

79-
The `--config` option tells gitea the location of the `app.ini` configuration file if
79+
The `--config` option tells Gitea the location of the `app.ini` configuration file if
8080
it's not in its default location. This option is only used with the `--custom` flag.
8181

82-
The `--destination` option tells gitea the directory where the files must be extracted to.
82+
The `--destination` option tells Gitea the directory where the files must be extracted to.
8383
The default is the current directory.
8484

85-
The `--custom` flag tells gitea to extract the files directly into the `custom` directory.
85+
The `--custom` flag tells Gitea to extract the files directly into the `custom` directory.
8686
For this to work, the command needs to know the location of the `app.ini` configuration
8787
file (`--config`) and, depending of the configuration, be ran from the directory where
8888
gitea normally starts. See [Customizing Gitea]({{< relref "doc/advanced/customizing-gitea.en-us.md" >}}) for details.
8989

9090
The `--overwrite` flag allows any existing files in the destination directory to be overwritten.
9191

92-
The `--rename` flag tells gitea to rename any existing files in the destination directory
92+
The `--rename` flag tells Gitea to rename any existing files in the destination directory
9393
as `filename.bak`. Previous `.bak` files are overwritten.
9494

9595
At least one file search pattern must be provided; see `list` subcomand above for pattern

docs/content/doc/advanced/config-cheat-sheet.en-us.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
106106
### Repository - Upload (`repository.upload`)
107107

108108
- `ENABLED`: **true**: Whether repository file uploads are enabled
109-
- `TEMP_PATH`: **data/tmp/uploads**: Path for uploads (tmp gets deleted on gitea restart)
109+
- `TEMP_PATH`: **data/tmp/uploads**: Path for uploads (tmp gets deleted on Gitea restart)
110110
- `ALLOWED_TYPES`: **\<empty\>**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
111111
- `FILE_MAX_SIZE`: **3**: Max size of each file in megabytes.
112112
- `MAX_FILES`: **5**: Max number of files per upload
@@ -184,7 +184,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
184184
Values can be emoji alias (:smile:) or a unicode emoji.
185185
For custom reactions, add a tightly cropped square image to public/img/emoji/reaction_name.png
186186
- `CUSTOM_EMOJIS`: **gitea, codeberg, gitlab, git, github, gogs**: Additional Emojis not defined in the utf8 standard.
187-
By default we support gitea (:gitea:), to add more copy them to public/img/emoji/emoji_name.png and
187+
By default we support Gitea (:gitea:), to add more copy them to public/img/emoji/emoji_name.png and
188188
add it to this config.
189189
- `DEFAULT_SHOW_FULL_NAME`: **false**: Whether the full name of the users should be shown where possible. If the full name isn't set, the username will be used.
190190
- `SEARCH_REPO_DESCRIPTION`: **true**: Whether to search within description at repository search on explore page.
@@ -240,14 +240,14 @@ The following configuration set `Content-Type: application/vnd.android.package-a
240240
- `STATIC_URL_PREFIX`: **\<empty\>**:
241241
Overwrite this option to request static resources from a different URL.
242242
This includes CSS files, images, JS files and web fonts.
243-
Avatar images are dynamic resources and still served by gitea.
243+
Avatar images are dynamic resources and still served by Gitea.
244244
The option can be just a different path, as in `/static`, or another domain, as in `https://cdn.example.com`.
245245
Requests are then made as `%(ROOT_URL)s/static/css/index.css` and `https://cdn.example.com/css/index.css` respective.
246-
The static files are located in the `public/` directory of the gitea source repository.
246+
The static files are located in the `public/` directory of the Gitea source repository.
247247
- `HTTP_ADDR`: **0.0.0.0**: HTTP listen address.
248248
- If `PROTOCOL` is set to `fcgi`, Gitea will listen for FastCGI requests on TCP socket
249249
defined by `HTTP_ADDR` and `HTTP_PORT` configuration settings.
250-
- If `PROTOCOL` is set to `unix` or `fcgi+unix`, this should be the name of the Unix socket file to use.
250+
- If `PROTOCOL` is set to `unix` or `fcgi+unix`, this should be the name of the Unix socket file to use. Relative paths will be made absolute against the AppWorkPath.
251251
- `HTTP_PORT`: **3000**: HTTP listen port.
252252
- If `PROTOCOL` is set to `fcgi`, Gitea will listen for FastCGI requests on TCP socket
253253
defined by `HTTP_ADDR` and `HTTP_PORT` configuration settings.
@@ -272,7 +272,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
272272
- `SSH_CREATE_AUTHORIZED_KEYS_FILE`: **true**: Gitea will create a authorized_keys file by default when it is not using the internal ssh server. If you intend to use the AuthorizedKeysCommand functionality then you should turn this off.
273273
- `SSH_AUTHORIZED_KEYS_BACKUP`: **true**: Enable SSH Authorized Key Backup when rewriting all keys, default is true.
274274
- `SSH_TRUSTED_USER_CA_KEYS`: **\<empty\>**: Specifies the public keys of certificate authorities that are trusted to sign user certificates for authentication. Multiple keys should be comma separated. E.g.`ssh-<algorithm> <key>` or `ssh-<algorithm> <key1>, ssh-<algorithm> <key2>`. For more information see `TrustedUserCAKeys` in the sshd config man pages. When empty no file will be created and `SSH_AUTHORIZED_PRINCIPALS_ALLOW` will default to `off`.
275-
- `SSH_TRUSTED_USER_CA_KEYS_FILENAME`: **`RUN_USER`/.ssh/gitea-trusted-user-ca-keys.pem**: Absolute path of the `TrustedUserCaKeys` file gitea will manage. If you're running your own ssh server and you want to use the gitea managed file you'll also need to modify your sshd_config to point to this file. The official docker image will automatically work without further configuration.
275+
- `SSH_TRUSTED_USER_CA_KEYS_FILENAME`: **`RUN_USER`/.ssh/gitea-trusted-user-ca-keys.pem**: Absolute path of the `TrustedUserCaKeys` file Gitea will manage. If you're running your own ssh server and you want to use the Gitea managed file you'll also need to modify your sshd_config to point to this file. The official docker image will automatically work without further configuration.
276276
- `SSH_AUTHORIZED_PRINCIPALS_ALLOW`: **off** or **username, email**: \[off, username, email, anything\]: Specify the principals values that users are allowed to use as principal. When set to `anything` no checks are done on the principal string. When set to `off` authorized principal are not allowed to be set.
277277
- `SSH_CREATE_AUTHORIZED_PRINCIPALS_FILE`: **false/true**: Gitea will create a authorized_principals file by default when it is not using the internal ssh server and `SSH_AUTHORIZED_PRINCIPALS_ALLOW` is not `off`.
278278
- `SSH_AUTHORIZED_PRINCIPALS_BACKUP`: **false/true**: Enable SSH Authorized Principals Backup when rewriting all keys, default is true if `SSH_AUTHORIZED_PRINCIPALS_ALLOW` is not `off`.
@@ -298,7 +298,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
298298
- `STATIC_CACHE_TIME`: **6h**: Web browser cache time for static resources on `custom/`, `public/` and all uploaded avatars. Note that this cache is disabled when `RUN_MODE` is "dev".
299299
- `ENABLE_GZIP`: **false**: Enable gzip compression for runtime-generated content, static resources excluded.
300300
- `ENABLE_PPROF`: **false**: Application profiling (memory and cpu). For "web" command it listens on localhost:6060. For "serv" command it dumps to disk at `PPROF_DATA_PATH` as `(cpuprofile|memprofile)_<username>_<temporary id>`
301-
- `PPROF_DATA_PATH`: **data/tmp/pprof**: `PPROF_DATA_PATH`, use an absolute path when you start gitea as service
301+
- `PPROF_DATA_PATH`: **data/tmp/pprof**: `PPROF_DATA_PATH`, use an absolute path when you start Gitea as service
302302
- `LANDING_PAGE`: **home**: Landing page for unauthenticated users \[home, explore, organizations, login\].
303303

304304
- `LFS_START_SERVER`: **false**: Enables git-lfs support.
@@ -497,7 +497,7 @@ Certain queues have defaults that override the defaults set in `[queue]` (this o
497497
Gitea instance and perform arbitrary actions in the name of the Gitea OS user.
498498
This maybe harmful to you website or your operating system.
499499
- `DISABLE_WEBHOOKS`: **false**: Set to `true` to disable webhooks feature.
500-
- `ONLY_ALLOW_PUSH_IF_GITEA_ENVIRONMENT_SET`: **true**: Set to `false` to allow local users to push to gitea-repositories without setting up the Gitea environment. This is not recommended and if you want local users to push to gitea repositories you should set the environment appropriately.
500+
- `ONLY_ALLOW_PUSH_IF_GITEA_ENVIRONMENT_SET`: **true**: Set to `false` to allow local users to push to gitea-repositories without setting up the Gitea environment. This is not recommended and if you want local users to push to Gitea repositories you should set the environment appropriately.
501501
- `IMPORT_LOCAL_PATHS`: **false**: Set to `false` to prevent all users (including admin) from importing local path on server.
502502
- `INTERNAL_TOKEN`: **\<random at every install if no uri set\>**: Secret used to validate communication within Gitea binary.
503503
- `INTERNAL_TOKEN_URI`: **<empty>**: Instead of defining internal token in the configuration, this configuration option can be used to give Gitea a path to a file that contains the internal token (example value: `file:/etc/gitea/internal_token`)
@@ -592,7 +592,7 @@ Certain queues have defaults that override the defaults set in `[queue]` (this o
592592
- `ALLOWED_USER_VISIBILITY_MODES`: **public,limited,private**: Set which visibility modes a user can have
593593
- `DEFAULT_ORG_VISIBILITY`: **public**: Set default visibility mode for organisations, either "public", "limited" or "private".
594594
- `DEFAULT_ORG_MEMBER_VISIBLE`: **false** True will make the membership of the users visible when added to the organisation.
595-
- `ALLOW_ONLY_INTERNAL_REGISTRATION`: **false** Set to true to force registration only via gitea.
595+
- `ALLOW_ONLY_INTERNAL_REGISTRATION`: **false** Set to true to force registration only via Gitea.
596596
- `ALLOW_ONLY_EXTERNAL_REGISTRATION`: **false** Set to true to force registration only using third-party services.
597597
- `NO_REPLY_ADDRESS`: **noreply.DOMAIN** Value for the domain part of the user's email address in the git log if user has set KeepEmailPrivate to true. DOMAIN resolves to the value in server.DOMAIN.
598598
The user's email will be replaced with a concatenation of the user name in lower case, "@" and NO_REPLY_ADDRESS.
@@ -750,11 +750,11 @@ Default templates for project boards:
750750
- `LEVEL`: **Info**: General log level. \[Trace, Debug, Info, Warn, Error, Critical, Fatal, None\]
751751
- `STACKTRACE_LEVEL`: **None**: Default log level at which to log create stack traces. \[Trace, Debug, Info, Warn, Error, Critical, Fatal, None\]
752752
- `ROUTER_LOG_LEVEL`: **Info**: The log level that the router should log at. (If you are setting the access log, its recommended to place this at Debug.)
753-
- `ROUTER`: **console**: The mode or name of the log the router should log to. (If you set this to `,` it will log to default gitea logger.)
753+
- `ROUTER`: **console**: The mode or name of the log the router should log to. (If you set this to `,` it will log to default Gitea logger.)
754754
NB: You must have `DISABLE_ROUTER_LOG` set to `false` for this option to take effect. Configure each mode in per mode log subsections `\[log.modename.router\]`.
755755
- `ENABLE_ACCESS_LOG`: **false**: Creates an access.log in NCSA common log format, or as per the following template
756756
- `ENABLE_SSH_LOG`: **false**: save ssh log to log file
757-
- `ACCESS`: **file**: Logging mode for the access logger, use a comma to separate values. Configure each mode in per mode log subsections `\[log.modename.access\]`. By default the file mode will log to `$ROOT_PATH/access.log`. (If you set this to `,` it will log to the default gitea logger.)
757+
- `ACCESS`: **file**: Logging mode for the access logger, use a comma to separate values. Configure each mode in per mode log subsections `\[log.modename.access\]`. By default the file mode will log to `$ROOT_PATH/access.log`. (If you set this to `,` it will log to the default Gitea logger.)
758758
- `ACCESS_LOG_TEMPLATE`: **`{{.Ctx.RemoteAddr}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.URL.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}\" \"{{.Ctx.Req.UserAgent}}"`**: Sets the template used to create the access log.
759759
- The following variables are available:
760760
- `Ctx`: the `context.Context` of the request.

docs/content/doc/advanced/customizing-gitea.en-us.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ shouldn't be touched without fully understanding these components.
9292

9393
Copy [`home.tmpl`](https://github.com/go-gitea/gitea/blob/main/templates/home.tmpl) for your version of Gitea from `templates` to `$GITEA_CUSTOM/templates`.
9494
Edit as you wish.
95-
Dont forget to restart your gitea to apply the changes.
95+
Dont forget to restart your Gitea to apply the changes.
9696

9797
### Adding links and tabs
9898

@@ -248,7 +248,7 @@ $GITEA_CUSTOM/public
248248
`-- three.min.js
249249
```
250250

251-
Then restart gitea and open a STL file on your gitea instance.
251+
Then restart Gitea and open a STL file on your Gitea instance.
252252

253253
## Customizing Gitea mails
254254

@@ -338,7 +338,7 @@ Community themes are listed in [gitea/awesome-gitea#themes](https://gitea.com/gi
338338
The `arc-green` theme source can be found [here](https://github.com/go-gitea/gitea/blob/main/web_src/less/themes/theme-arc-green.less).
339339

340340
If your custom theme is considered a dark theme, set the global css variable `--is-dark-theme` to `true`.
341-
This allows gitea to adjust the Monaco code editor's theme accordingly.
341+
This allows Gitea to adjust the Monaco code editor's theme accordingly.
342342

343343
## Customizing fonts
344344

docs/content/doc/advanced/logging-documentation.en-us.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -328,13 +328,13 @@ This is equivalent to sending all logs to the console, with default go log being
328328
## Releasing-and-Reopening, Pausing and Resuming logging
329329

330330
If you are running on Unix you may wish to release-and-reopen logs in order to use `logrotate` or other tools.
331-
It is possible force gitea to release and reopen it's logging files and connections by sending `SIGUSR1` to the
331+
It is possible force Gitea to release and reopen it's logging files and connections by sending `SIGUSR1` to the
332332
running process, or running `gitea manager logging release-and-reopen`.
333333

334334
Alternatively, you may wish to pause and resume logging - this can be accomplished through the use of the
335335
`gitea manager logging pause` and `gitea manager logging resume` commands. Please note that whilst logging
336336
is paused log events below INFO level will not be stored and only a limited number of events will be stored.
337-
Logging may block, albeit temporarily, slowing gitea considerably whilst paused - therefore it is
337+
Logging may block, albeit temporarily, slowing Gitea considerably whilst paused - therefore it is
338338
recommended that pausing only done for a very short period of time.
339339

340340
## Adding and removing logging whilst Gitea is running
@@ -439,6 +439,6 @@ Gitea includes built-in log rotation, which should be enough for most deployment
439439
- Install `logrotate`.
440440
- Configure `logrotate` to match your deployment requirements, see `man 8 logrotate` for configuration syntax details. In the `postrotate/endscript` block send Gitea a `USR1` signal via `kill -USR1` or `kill -10` to the `gitea` process itself, or run `gitea manager logging release-and-reopen` (with the appropriate environment). Ensure that your configurations apply to all files emitted by Gitea loggers as described in the above sections.
441441
- Always do `logrotate /etc/logrotate.conf --debug` to test your configurations.
442-
- If you are using docker and are running from outside of the container you can use `docker exec -u $OS_USER $CONTAINER_NAME sh -c 'gitea manager logging release-and-reopen'` or `docker exec $CONTAINER_NAME sh -c '/bin/s6-svc -1 /etc/s6/gitea/'` or send `USR1` directly to the gitea process itself.
442+
- If you are using docker and are running from outside of the container you can use `docker exec -u $OS_USER $CONTAINER_NAME sh -c 'gitea manager logging release-and-reopen'` or `docker exec $CONTAINER_NAME sh -c '/bin/s6-svc -1 /etc/s6/gitea/'` or send `USR1` directly to the Gitea process itself.
443443

444444
The next `logrotate` jobs will include your configurations, so no restart is needed. You can also immediately reload `logrotate` with `logrotate /etc/logrotate.conf --force`.

docs/content/doc/advanced/signing.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ menu:
2020
{{< toc >}}
2121

2222
Gitea will verify GPG commit signatures in the provided tree by
23-
checking if the commits are signed by a key within the gitea database,
23+
checking if the commits are signed by a key within the Gitea database,
2424
or if the commit matches the default key for git.
2525

2626
Keys are not checked to determine if they have expired or revoked.

docs/content/doc/developers/guidelines-backend.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ i.e. `servcies/user`, `models/repository`.
104104
### Import Alias
105105

106106
Since there are many package levels and sub packages, so you will find `modules/user`, `models/user`, `services/user`. When these packages are import into one Go file, it's difficult to know which package we are using and if it's a variable name or an import name. So we recommand to always use import alias. To differ from package variables which are commonly use camelCase, just use **snake_case** as import package alias.
107-
i.e. `import user_service "code.Gitea.io/Gitea/services/user"`
107+
i.e. `import user_service "code.gitea.io/gitea/services/user"`
108108

109109
### Future Tasks
110110

0 commit comments

Comments
 (0)