]> source.dussan.org Git - gitea.git/commitdiff
Make offline mode as default to no connect external avatar service by default (#28548)
authorLunny Xiao <xiaolunwen@gmail.com>
Thu, 21 Dec 2023 07:42:16 +0000 (15:42 +0800)
committerGitHub <noreply@github.com>
Thu, 21 Dec 2023 07:42:16 +0000 (07:42 +0000)
To keep user's privacy, make offline mode as true by default.

Users can still change it from installation ui and app.ini

custom/conf/app.example.ini
docs/content/administration/config-cheat-sheet.en-us.md
docs/content/administration/config-cheat-sheet.zh-cn.md
modules/repository/commits_test.go
modules/setting/server.go

index f10a3f2edff3751019530e423c80d6448ebf2d28..f9111d541c738396bb4a3524da6fd4750b0b38b9 100644 (file)
@@ -234,7 +234,7 @@ RUN_USER = ; git
 ;MINIMUM_KEY_SIZE_CHECK = false
 ;;
 ;; Disable CDN even in "prod" mode
-;OFFLINE_MODE = false
+;OFFLINE_MODE = true
 ;;
 ;; TLS Settings: Either ACME or manual
 ;; (Other common TLS configuration are found before)
index 64c2fa475cf7dddf17fc5817336e6336a3b15c9b..1ba5dd04cc406f56762a0b25b3ea09d2530cb33e 100644 (file)
@@ -357,7 +357,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
 - `SSH_PER_WRITE_PER_KB_TIMEOUT`: **10s**: Timeout per Kb written to SSH connections.
 - `MINIMUM_KEY_SIZE_CHECK`: **true**: Indicate whether to check minimum key size with corresponding type.
 
-- `OFFLINE_MODE`: **false**: Disables use of CDN for static files and Gravatar for profile pictures.
+- `OFFLINE_MODE`: **true**: Disables use of CDN for static files and Gravatar for profile pictures.
 - `CERT_FILE`: **https/cert.pem**: Cert file path used for HTTPS. When chaining, the server certificate must come first, then intermediate CA certificates (if any). This is ignored if `ENABLE_ACME=true`. Paths are relative to `CUSTOM_PATH`.
 - `KEY_FILE`: **https/key.pem**: Key file path used for HTTPS. This is ignored if `ENABLE_ACME=true`. Paths are relative to `CUSTOM_PATH`.
 - `STATIC_ROOT_PATH`: **_`StaticRootPath`_**: Upper level of template and static files path.
index befce0a1b71ab71e8990f3f9aac8e8f7ea830c78..434d69815b19ef75e266408728f2d93135b437f8 100644 (file)
@@ -346,7 +346,7 @@ menu:
 - `SSH_PER_WRITE_TIMEOUT`: **30s**:对 SSH 连接的任何写入设置超时。(将其设置为 -1 可以禁用所有超时。)
 - `SSH_PER_WRITE_PER_KB_TIMEOUT`: **10s**:对写入 SSH 连接的每 KB 设置超时。
 - `MINIMUM_KEY_SIZE_CHECK`: **true**:指示是否检查最小密钥大小与相应类型。
-- `OFFLINE_MODE`: **false**:禁用 CDN 用于静态文件和 Gravatar 用于个人资料图片。
+- `OFFLINE_MODE`: **true**:禁用 CDN 用于静态文件和 Gravatar 用于个人资料图片。
 - `CERT_FILE`: **https/cert.pem**:用于 HTTPS 的证书文件路径。在链接时,服务器证书必须首先出现,然后是中间 CA 证书(如果有)。如果 `ENABLE_ACME=true`,则此设置会被忽略。路径相对于 `CUSTOM_PATH`。
 - `KEY_FILE`: **https/key.pem**:用于 HTTPS 的密钥文件路径。如果 `ENABLE_ACME=true`,则此设置会被忽略。路径相对于 `CUSTOM_PATH`。
 - `STATIC_ROOT_PATH`: **_`StaticRootPath`_**:模板和静态文件路径的上一级。
index 827b2a98493b01d8f162274735c224801949a184..248673a907d47b5e796e77f54805c26b212b8ce7 100644 (file)
@@ -126,9 +126,10 @@ func TestPushCommits_AvatarLink(t *testing.T) {
        }
 
        setting.GravatarSource = "https://secure.gravatar.com/avatar"
+       setting.OfflineMode = true
 
        assert.Equal(t,
-               "https://secure.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?d=identicon&s="+strconv.Itoa(28*setting.Avatar.RenderedSizeFactor),
+               "/avatars/avatar2?size="+strconv.Itoa(28*setting.Avatar.RenderedSizeFactor),
                pushCommits.AvatarLink(db.DefaultContext, "user2@example.com"))
 
        assert.Equal(t,
index d053fee5e76bb608c89204c84b8344501c2700a7..80b85eeebdda76258c0a30d3ca456628d226e708 100644 (file)
@@ -315,7 +315,7 @@ func loadServerFrom(rootCfg ConfigProvider) {
        RedirectOtherPort = sec.Key("REDIRECT_OTHER_PORT").MustBool(false)
        PortToRedirect = sec.Key("PORT_TO_REDIRECT").MustString("80")
        RedirectorUseProxyProtocol = sec.Key("REDIRECTOR_USE_PROXY_PROTOCOL").MustBool(UseProxyProtocol)
-       OfflineMode = sec.Key("OFFLINE_MODE").MustBool()
+       OfflineMode = sec.Key("OFFLINE_MODE").MustBool(true)
        if len(StaticRootPath) == 0 {
                StaticRootPath = AppWorkPath
        }