custom logo feature in -/admin/config/settings

This commit is contained in:
孟宁
2025-07-20 13:26:57 +08:00
repo.diff.parent 6599efb3b1 dee60671e2
repo.diff.commit abccf0f174
repo.diff.stats_desc%!(EXTRA int=16, int=196, int=64)

repo.diff.view_file

@@ -1,31 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="main_outline" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
y="0px" viewBox="0 0 640 640" style="enable-background:new 0 0 640 640;" xml:space="preserve">
<g>
<path id="teabag" style="fill:#FFFFFF" d="M395.9,484.2l-126.9-61c-12.5-6-17.9-21.2-11.8-33.8l61-126.9c6-12.5,21.2-17.9,33.8-11.8
c17.2,8.3,27.1,13,27.1,13l-0.1-109.2l16.7-0.1l0.1,117.1c0,0,57.4,24.2,83.1,40.1c3.7,2.3,10.2,6.8,12.9,14.4
c2.1,6.1,2,13.1-1,19.3l-61,126.9C423.6,484.9,408.4,490.3,395.9,484.2z"/>
<g>
<g>
<path style="fill:#609926" d="M622.7,149.8c-4.1-4.1-9.6-4-9.6-4s-117.2,6.6-177.9,8c-13.3,0.3-26.5,0.6-39.6,0.7c0,39.1,0,78.2,0,117.2
c-5.5-2.6-11.1-5.3-16.6-7.9c0-36.4-0.1-109.2-0.1-109.2c-29,0.4-89.2-2.2-89.2-2.2s-141.4-7.1-156.8-8.5
c-9.8-0.6-22.5-2.1-39,1.5c-8.7,1.8-33.5,7.4-53.8,26.9C-4.9,212.4,6.6,276.2,8,285.8c1.7,11.7,6.9,44.2,31.7,72.5
c45.8,56.1,144.4,54.8,144.4,54.8s12.1,28.9,30.6,55.5c25,33.1,50.7,58.9,75.7,62c63,0,188.9-0.1,188.9-0.1s12,0.1,28.3-10.3
c14-8.5,26.5-23.4,26.5-23.4s12.9-13.8,30.9-45.3c5.5-9.7,10.1-19.1,14.1-28c0,0,55.2-117.1,55.2-231.1
C633.2,157.9,624.7,151.8,622.7,149.8z M125.6,353.9c-25.9-8.5-36.9-18.7-36.9-18.7S69.6,321.8,60,295.4
c-16.5-44.2-1.4-71.2-1.4-71.2s8.4-22.5,38.5-30c13.8-3.7,31-3.1,31-3.1s7.1,59.4,15.7,94.2c7.2,29.2,24.8,77.7,24.8,77.7
S142.5,359.9,125.6,353.9z M425.9,461.5c0,0-6.1,14.5-19.6,15.4c-5.8,0.4-10.3-1.2-10.3-1.2s-0.3-0.1-5.3-2.1l-112.9-55
c0,0-10.9-5.7-12.8-15.6c-2.2-8.1,2.7-18.1,2.7-18.1L322,273c0,0,4.8-9.7,12.2-13c0.6-0.3,2.3-1,4.5-1.5c8.1-2.1,18,2.8,18,2.8
l110.7,53.7c0,0,12.6,5.7,15.3,16.2c1.9,7.4-0.5,14-1.8,17.2C474.6,363.8,425.9,461.5,425.9,461.5z"/>
<path style="fill:#609926" d="M326.8,380.1c-8.2,0.1-15.4,5.8-17.3,13.8c-1.9,8,2,16.3,9.1,20c7.7,4,17.5,1.8,22.7-5.4
c5.1-7.1,4.3-16.9-1.8-23.1l24-49.1c1.5,0.1,3.7,0.2,6.2-0.5c4.1-0.9,7.1-3.6,7.1-3.6c4.2,1.8,8.6,3.8,13.2,6.1
c4.8,2.4,9.3,4.9,13.4,7.3c0.9,0.5,1.8,1.1,2.8,1.9c1.6,1.3,3.4,3.1,4.7,5.5c1.9,5.5-1.9,14.9-1.9,14.9
c-2.3,7.6-18.4,40.6-18.4,40.6c-8.1-0.2-15.3,5-17.7,12.5c-2.6,8.1,1.1,17.3,8.9,21.3c7.8,4,17.4,1.7,22.5-5.3
c5-6.8,4.6-16.3-1.1-22.6c1.9-3.7,3.7-7.4,5.6-11.3c5-10.4,13.5-30.4,13.5-30.4c0.9-1.7,5.7-10.3,2.7-21.3
c-2.5-11.4-12.6-16.7-12.6-16.7c-12.2-7.9-29.2-15.2-29.2-15.2s0-4.1-1.1-7.1c-1.1-3.1-2.8-5.1-3.9-6.3c4.7-9.7,9.4-19.3,14.1-29
c-4.1-2-8.1-4-12.2-6.1c-4.8,9.8-9.7,19.7-14.5,29.5c-6.7-0.1-12.9,3.5-16.1,9.4c-3.4,6.3-2.7,14.1,1.9,19.8
C343.2,346.5,335,363.3,326.8,380.1z"/>
</g>
</g>
</g>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW X7 -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="41.7913mm" height="41.6859mm" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
viewBox="0 0 1079 1076"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css">
<![CDATA[
.fil1 {fill:#003CA8}
.fil0 {fill:#FF8812}
]]>
</style>
</defs>
<g id="图层_x0020_1">
<metadata id="CorelCorpID_0Corel-Layer"/>
<path class="fil0" d="M825 432l0 0c12,-2 19,13 10,21l0 0c-58,48 -84,124 -68,198l0 0c3,12 -13,20 -21,10l0 0c-45,-54 -115,-81 -185,-70 -108,58 -231,135 -303,214 -86,92 -100,229 49,248 -427,118 -464,-256 244,-492 49,-48 70,-119 55,-187l0 0c-2,-12 13,-19 21,-10l0 0c48,58 124,84 198,68z"/>
<path class="fil1" d="M636 0c102,0 187,30 253,80 75,55 127,135 158,226l0 0c11,32 19,65 24,98 5,35 8,70 7,105 0,34 -3,69 -8,103 -6,34 -14,67 -24,99 -32,94 -85,178 -160,236 -67,53 -150,84 -250,84l-267 0c-55,0 -91,-10 -112,-28 -19,-17 -25,-39 -22,-64 4,-24 15,-51 33,-78 60,-92 225,-230 320,-253 -101,59 -189,170 -231,243l279 0c57,0 105,-19 144,-51 44,-36 76,-88 95,-146 8,-23 14,-47 18,-71 4,-25 6,-50 6,-75 0,-25 -2,-50 -6,-74 -3,-24 -9,-48 -17,-70l0 0c-18,-55 -49,-103 -93,-136 -38,-30 -88,-47 -147,-47l0 0 -141 0 -68 0c-26,0 -51,4 -73,13 -22,9 -43,23 -61,42 -18,18 -32,38 -42,61 -9,22 -13,46 -13,72l0 213c135,-43 226,-51 307,-33 -160,29 -354,110 -474,221l-14 13 0 -19 0 -428 0 0 0 0c0,-94 38,-178 98,-238 61,-61 145,-98 238,-98l0 0 1 0 0 0 242 0 0 0z"/>
</g>
</svg>

repo.diff.file_before

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 2.5 KiB

repo.diff.file_after

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 1.7 KiB

repo.diff.view_file

@@ -1,31 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="main_outline" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
y="0px" viewBox="0 0 640 640" style="enable-background:new 0 0 640 640;" xml:space="preserve">
<g>
<path id="teabag" style="fill:#FFFFFF" d="M395.9,484.2l-126.9-61c-12.5-6-17.9-21.2-11.8-33.8l61-126.9c6-12.5,21.2-17.9,33.8-11.8
c17.2,8.3,27.1,13,27.1,13l-0.1-109.2l16.7-0.1l0.1,117.1c0,0,57.4,24.2,83.1,40.1c3.7,2.3,10.2,6.8,12.9,14.4
c2.1,6.1,2,13.1-1,19.3l-61,126.9C423.6,484.9,408.4,490.3,395.9,484.2z"/>
<g>
<g>
<path style="fill:#609926" d="M622.7,149.8c-4.1-4.1-9.6-4-9.6-4s-117.2,6.6-177.9,8c-13.3,0.3-26.5,0.6-39.6,0.7c0,39.1,0,78.2,0,117.2
c-5.5-2.6-11.1-5.3-16.6-7.9c0-36.4-0.1-109.2-0.1-109.2c-29,0.4-89.2-2.2-89.2-2.2s-141.4-7.1-156.8-8.5
c-9.8-0.6-22.5-2.1-39,1.5c-8.7,1.8-33.5,7.4-53.8,26.9C-4.9,212.4,6.6,276.2,8,285.8c1.7,11.7,6.9,44.2,31.7,72.5
c45.8,56.1,144.4,54.8,144.4,54.8s12.1,28.9,30.6,55.5c25,33.1,50.7,58.9,75.7,62c63,0,188.9-0.1,188.9-0.1s12,0.1,28.3-10.3
c14-8.5,26.5-23.4,26.5-23.4s12.9-13.8,30.9-45.3c5.5-9.7,10.1-19.1,14.1-28c0,0,55.2-117.1,55.2-231.1
C633.2,157.9,624.7,151.8,622.7,149.8z M125.6,353.9c-25.9-8.5-36.9-18.7-36.9-18.7S69.6,321.8,60,295.4
c-16.5-44.2-1.4-71.2-1.4-71.2s8.4-22.5,38.5-30c13.8-3.7,31-3.1,31-3.1s7.1,59.4,15.7,94.2c7.2,29.2,24.8,77.7,24.8,77.7
S142.5,359.9,125.6,353.9z M425.9,461.5c0,0-6.1,14.5-19.6,15.4c-5.8,0.4-10.3-1.2-10.3-1.2s-0.3-0.1-5.3-2.1l-112.9-55
c0,0-10.9-5.7-12.8-15.6c-2.2-8.1,2.7-18.1,2.7-18.1L322,273c0,0,4.8-9.7,12.2-13c0.6-0.3,2.3-1,4.5-1.5c8.1-2.1,18,2.8,18,2.8
l110.7,53.7c0,0,12.6,5.7,15.3,16.2c1.9,7.4-0.5,14-1.8,17.2C474.6,363.8,425.9,461.5,425.9,461.5z"/>
<path style="fill:#609926" d="M326.8,380.1c-8.2,0.1-15.4,5.8-17.3,13.8c-1.9,8,2,16.3,9.1,20c7.7,4,17.5,1.8,22.7-5.4
c5.1-7.1,4.3-16.9-1.8-23.1l24-49.1c1.5,0.1,3.7,0.2,6.2-0.5c4.1-0.9,7.1-3.6,7.1-3.6c4.2,1.8,8.6,3.8,13.2,6.1
c4.8,2.4,9.3,4.9,13.4,7.3c0.9,0.5,1.8,1.1,2.8,1.9c1.6,1.3,3.4,3.1,4.7,5.5c1.9,5.5-1.9,14.9-1.9,14.9
c-2.3,7.6-18.4,40.6-18.4,40.6c-8.1-0.2-15.3,5-17.7,12.5c-2.6,8.1,1.1,17.3,8.9,21.3c7.8,4,17.4,1.7,22.5-5.3
c5-6.8,4.6-16.3-1.1-22.6c1.9-3.7,3.7-7.4,5.6-11.3c5-10.4,13.5-30.4,13.5-30.4c0.9-1.7,5.7-10.3,2.7-21.3
c-2.5-11.4-12.6-16.7-12.6-16.7c-12.2-7.9-29.2-15.2-29.2-15.2s0-4.1-1.1-7.1c-1.1-3.1-2.8-5.1-3.9-6.3c4.7-9.7,9.4-19.3,14.1-29
c-4.1-2-8.1-4-12.2-6.1c-4.8,9.8-9.7,19.7-14.5,29.5c-6.7-0.1-12.9,3.5-16.1,9.4c-3.4,6.3-2.7,14.1,1.9,19.8
C343.2,346.5,335,363.3,326.8,380.1z"/>
</g>
</g>
</g>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW X7 -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="167.952mm" height="41.6859mm" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
viewBox="0 0 17419 4323"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css">
<![CDATA[
.fil1 {fill:#003CA8}
.fil0 {fill:#FF8812}
.fil2 {fill:#003CA8;fill-rule:nonzero}
]]>
</style>
</defs>
<g id="图层_x0020_1">
<metadata id="CorelCorpID_0Corel-Layer"/>
<path class="fil0" d="M3315 1737l0 0c48,-10 78,51 40,83l0 0c-232,194 -337,501 -273,796l0 0c11,49 -51,79 -83,41l0 0c-182,-219 -464,-325 -743,-283 -437,234 -929,545 -1221,860 -345,372 -399,922 201,999 -1718,474 -1865,-1028 977,-1978 197,-194 282,-477 223,-750l0 0c-10,-49 51,-79 83,-41l0 0c194,232 500,337 796,273z"/>
<path class="fil1" d="M2555 1c412,0 752,120 1020,320 299,222 509,544 632,909l0 0c43,127 75,259 96,395 22,138 32,278 31,419 0,140 -12,279 -34,416 -22,136 -55,270 -98,398 -127,379 -341,715 -640,949 -269,210 -606,337 -1007,337l-1073 0c-222,0 -365,-43 -447,-114 -78,-67 -103,-156 -89,-258 13,-96 60,-202 130,-311 241,-372 903,-925 1287,-1019 -407,237 -761,685 -930,977l1122 0c230,0 423,-77 579,-205 176,-143 304,-351 383,-585 31,-92 54,-189 70,-287 16,-99 25,-200 25,-301 1,-100 -7,-201 -22,-299 -15,-96 -38,-190 -68,-280l0 0c-74,-220 -199,-413 -374,-546 -156,-118 -353,-190 -593,-190l0 0 -567 1 -273 -1c-105,-1 -202,18 -292,55 -89,37 -171,92 -245,166 -75,74 -130,156 -167,245 -37,90 -56,187 -56,292l0 857c542,-176 910,-209 1236,-136 -642,116 -1423,443 -1906,889l-55 51 0 -75 0 -1719 0 -2 0 0c1,-375 151,-712 395,-956 243,-243 581,-393 956,-393l0 0 2 0 0 0 972 2 0 -1z"/>
<path class="fil2" d="M7222 2023c0,153 -12,287 -37,403 -14,66 -30,124 -48,175 -18,52 -45,108 -82,170 -102,175 -235,296 -398,361 -132,50 -313,75 -542,75l-1141 0 0 -2388 821 -7 282 0 212 14c324,0 567,119 729,358 136,205 204,485 204,839zm-1346 -679l-333 0 0 1356 320 3c266,0 454,-42 565,-126 128,-96 191,-278 191,-547 0,-264 -59,-447 -177,-549 -109,-92 -298,-137 -566,-137zm3132 1155l-1144 0c34,87 76,151 126,192 50,40 120,60 211,60l784 0 -249 456 -497 0 -147 0 -146 0c-241,0 -417,-93 -529,-280 -88,-151 -132,-360 -132,-629 0,-285 72,-507 218,-667 145,-159 360,-240 644,-240 308,0 533,79 674,236 132,149 198,381 198,695l0 64 0 79 -11 34zm-1154 -385l599 0c-9,-100 -33,-173 -71,-218 -21,-23 -49,-41 -84,-55 -35,-13 -78,-20 -128,-20 -190,0 -296,97 -316,293zm1772 -709l382 1097 371 -1097 603 0 -661 1802 -627 0 -674 -1802 606 0zm3644 -116l-1336 0c-202,0 -324,33 -324,223 0,187 257,216 429,210l276 -10c513,0 842,211 842,744 0,554 -293,751 -831,751l-1295 0 0 -470 1077 0c223,0 453,-2 453,-237 0,-186 -230,-220 -406,-213l-225 14c-286,0 -506,-31 -684,-184 -153,-132 -229,-330 -229,-594 0,-581 395,-704 934,-704l1678 0 -359 470zm1157 116l-233 463 -297 0 0 569c0,269 59,317 344,317l-251 464c-606,0 -662,-210 -662,-811l0 -539 -242 0 811 -1057 0 594 530 0zm1546 1063l0 739 -569 0 0 -354 -245 354 -201 0c-232,0 -403,-35 -515,-106 -138,-91 -207,-247 -207,-468 0,-214 56,-367 170,-457 102,-78 262,-117 480,-117l518 0 0 -37c0,-62 -14,-103 -42,-125 -29,-21 -77,-32 -145,-32l-821 0 231 -460 445 0c429,0 694,73 796,218 34,51 60,147 78,286 18,139 27,326 27,559zm-1158 150c0,39 18,71 54,99 41,22 108,34 201,34l55 0 279 0 0 -273 -395 0c-57,0 -103,10 -140,29 -36,20 -54,56 -54,111zm1868 -859l228 -354 508 0 -263 460 -204 0c-113,0 -190,31 -228,92 -27,48 -41,137 -41,267l0 983 -569 0 0 -1802 569 0 0 354z"/>
</g>
</svg>

repo.diff.file_before

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 2.5 KiB

repo.diff.file_after

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 3.6 KiB

repo.diff.view_file

@@ -99,6 +99,21 @@ func SetSettings(ctx context.Context, settings map[string]string) error {
})
}
func SetSetting(ctx context.Context, key, value string) error {
return SetSettings(ctx, map[string]string{key: value})
}
func GetSetting(ctx context.Context, key string) (string, error) {
setting, exist, err := db.Get[Setting](ctx, builder.Eq{"setting_key": key})
if err != nil {
return "", err
}
if !exist {
return "", nil
}
return setting.SettingValue, nil
}
type dbConfigCachedGetter struct {
mu sync.RWMutex

repo.diff.view_file

@@ -3411,6 +3411,10 @@ config.session_life_time = Session Life Time
config.https_only = HTTPS Only
config.cookie_life_time = Cookie Life Time
config.app_logo_config = Application Logo Configuration
config.choose_new_logo = Choose New Logo
config.update_logo = Update Logo
config.picture_config = Picture and Avatar Configuration
config.picture_service = Picture Service
config.disable_gravatar = Disable Gravatar

repo.diff.view_file

@@ -3400,6 +3400,10 @@ config.session_life_time=Session 生命周期
config.https_only=仅限 HTTPS
config.cookie_life_time=Cookie 生命周期
config.app_logo_config = Logo图标设置
config.choose_new_logo = 选择新的Logo图标
config.update_logo = 更新Logo图标
config.picture_config=图片和头像配置
config.picture_service=图片服务
config.disable_gravatar=禁用 Gravatar 头像

repo.diff.bin_not_shown

repo.diff.file_before

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 3.1 KiB

repo.diff.file_after

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 16 KiB

repo.diff.bin_not_shown

repo.diff.file_before

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 4.8 KiB

repo.diff.file_after

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 26 KiB

repo.diff.bin_not_shown

repo.diff.file_before

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 4.2 KiB

repo.diff.file_after

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 26 KiB

repo.diff.view_file

@@ -1 +1,20 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 640 640" width="32" height="32"><path d="m395.9 484.2-126.9-61c-12.5-6-17.9-21.2-11.8-33.8l61-126.9c6-12.5 21.2-17.9 33.8-11.8 17.2 8.3 27.1 13 27.1 13l-.1-109.2 16.7-.1.1 117.1s57.4 24.2 83.1 40.1c3.7 2.3 10.2 6.8 12.9 14.4 2.1 6.1 2 13.1-1 19.3l-61 126.9c-6.2 12.7-21.4 18.1-33.9 12" style="fill:#fff"/><path d="M622.7 149.8c-4.1-4.1-9.6-4-9.6-4s-117.2 6.6-177.9 8c-13.3.3-26.5.6-39.6.7v117.2c-5.5-2.6-11.1-5.3-16.6-7.9 0-36.4-.1-109.2-.1-109.2-29 .4-89.2-2.2-89.2-2.2s-141.4-7.1-156.8-8.5c-9.8-.6-22.5-2.1-39 1.5-8.7 1.8-33.5 7.4-53.8 26.9C-4.9 212.4 6.6 276.2 8 285.8c1.7 11.7 6.9 44.2 31.7 72.5 45.8 56.1 144.4 54.8 144.4 54.8s12.1 28.9 30.6 55.5c25 33.1 50.7 58.9 75.7 62 63 0 188.9-.1 188.9-.1s12 .1 28.3-10.3c14-8.5 26.5-23.4 26.5-23.4S547 483 565 451.5c5.5-9.7 10.1-19.1 14.1-28 0 0 55.2-117.1 55.2-231.1-1.1-34.5-9.6-40.6-11.6-42.6M125.6 353.9c-25.9-8.5-36.9-18.7-36.9-18.7S69.6 321.8 60 295.4c-16.5-44.2-1.4-71.2-1.4-71.2s8.4-22.5 38.5-30c13.8-3.7 31-3.1 31-3.1s7.1 59.4 15.7 94.2c7.2 29.2 24.8 77.7 24.8 77.7s-26.1-3.1-43-9.1m300.3 107.6s-6.1 14.5-19.6 15.4c-5.8.4-10.3-1.2-10.3-1.2s-.3-.1-5.3-2.1l-112.9-55s-10.9-5.7-12.8-15.6c-2.2-8.1 2.7-18.1 2.7-18.1L322 273s4.8-9.7 12.2-13c.6-.3 2.3-1 4.5-1.5 8.1-2.1 18 2.8 18 2.8L467.4 315s12.6 5.7 15.3 16.2c1.9 7.4-.5 14-1.8 17.2-6.3 15.4-55 113.1-55 113.1" style="fill:#609926"/><path d="M326.8 380.1c-8.2.1-15.4 5.8-17.3 13.8s2 16.3 9.1 20c7.7 4 17.5 1.8 22.7-5.4 5.1-7.1 4.3-16.9-1.8-23.1l24-49.1c1.5.1 3.7.2 6.2-.5 4.1-.9 7.1-3.6 7.1-3.6 4.2 1.8 8.6 3.8 13.2 6.1 4.8 2.4 9.3 4.9 13.4 7.3.9.5 1.8 1.1 2.8 1.9 1.6 1.3 3.4 3.1 4.7 5.5 1.9 5.5-1.9 14.9-1.9 14.9-2.3 7.6-18.4 40.6-18.4 40.6-8.1-.2-15.3 5-17.7 12.5-2.6 8.1 1.1 17.3 8.9 21.3s17.4 1.7 22.5-5.3c5-6.8 4.6-16.3-1.1-22.6 1.9-3.7 3.7-7.4 5.6-11.3 5-10.4 13.5-30.4 13.5-30.4.9-1.7 5.7-10.3 2.7-21.3-2.5-11.4-12.6-16.7-12.6-16.7-12.2-7.9-29.2-15.2-29.2-15.2s0-4.1-1.1-7.1c-1.1-3.1-2.8-5.1-3.9-6.3 4.7-9.7 9.4-19.3 14.1-29-4.1-2-8.1-4-12.2-6.1-4.8 9.8-9.7 19.7-14.5 29.5-6.7-.1-12.9 3.5-16.1 9.4-3.4 6.3-2.7 14.1 1.9 19.8z" style="fill:#609926"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW X7 -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="41.7913mm" height="41.6859mm" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
viewBox="0 0 1079 1076"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css">
<![CDATA[
.fil1 {fill:#003CA8}
.fil0 {fill:#FF8812}
]]>
</style>
</defs>
<g id="图层_x0020_1">
<metadata id="CorelCorpID_0Corel-Layer"/>
<path class="fil0" d="M825 432l0 0c12,-2 19,13 10,21l0 0c-58,48 -84,124 -68,198l0 0c3,12 -13,20 -21,10l0 0c-45,-54 -115,-81 -185,-70 -108,58 -231,135 -303,214 -86,92 -100,229 49,248 -427,118 -464,-256 244,-492 49,-48 70,-119 55,-187l0 0c-2,-12 13,-19 21,-10l0 0c48,58 124,84 198,68z"/>
<path class="fil1" d="M636 0c102,0 187,30 253,80 75,55 127,135 158,226l0 0c11,32 19,65 24,98 5,35 8,70 7,105 0,34 -3,69 -8,103 -6,34 -14,67 -24,99 -32,94 -85,178 -160,236 -67,53 -150,84 -250,84l-267 0c-55,0 -91,-10 -112,-28 -19,-17 -25,-39 -22,-64 4,-24 15,-51 33,-78 60,-92 225,-230 320,-253 -101,59 -189,170 -231,243l279 0c57,0 105,-19 144,-51 44,-36 76,-88 95,-146 8,-23 14,-47 18,-71 4,-25 6,-50 6,-75 0,-25 -2,-50 -6,-74 -3,-24 -9,-48 -17,-70l0 0c-18,-55 -49,-103 -93,-136 -38,-30 -88,-47 -147,-47l0 0 -141 0 -68 0c-26,0 -51,4 -73,13 -22,9 -43,23 -61,42 -18,18 -32,38 -42,61 -9,22 -13,46 -13,72l0 213c135,-43 226,-51 307,-33 -160,29 -354,110 -474,221l-14 13 0 -19 0 -428 0 0 0 0c0,-94 38,-178 98,-238 61,-61 145,-98 238,-98l0 0 1 0 0 0 242 0 0 0z"/>
</g>
</svg>

repo.diff.file_before

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 2.1 KiB

repo.diff.file_after

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 1.7 KiB

repo.diff.bin_not_shown

repo.diff.file_before

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 14 KiB

repo.diff.file_after

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 68 KiB

repo.diff.view_file

@@ -1 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 640 640" width="32" height="32"><path d="m395.9 484.2-126.9-61c-12.5-6-17.9-21.2-11.8-33.8l61-126.9c6-12.5 21.2-17.9 33.8-11.8 17.2 8.3 27.1 13 27.1 13l-.1-109.2 16.7-.1.1 117.1s57.4 24.2 83.1 40.1c3.7 2.3 10.2 6.8 12.9 14.4 2.1 6.1 2 13.1-1 19.3l-61 126.9c-6.2 12.7-21.4 18.1-33.9 12" style="fill:#fff"/><path d="M622.7 149.8c-4.1-4.1-9.6-4-9.6-4s-117.2 6.6-177.9 8c-13.3.3-26.5.6-39.6.7v117.2c-5.5-2.6-11.1-5.3-16.6-7.9 0-36.4-.1-109.2-.1-109.2-29 .4-89.2-2.2-89.2-2.2s-141.4-7.1-156.8-8.5c-9.8-.6-22.5-2.1-39 1.5-8.7 1.8-33.5 7.4-53.8 26.9C-4.9 212.4 6.6 276.2 8 285.8c1.7 11.7 6.9 44.2 31.7 72.5 45.8 56.1 144.4 54.8 144.4 54.8s12.1 28.9 30.6 55.5c25 33.1 50.7 58.9 75.7 62 63 0 188.9-.1 188.9-.1s12 .1 28.3-10.3c14-8.5 26.5-23.4 26.5-23.4S547 483 565 451.5c5.5-9.7 10.1-19.1 14.1-28 0 0 55.2-117.1 55.2-231.1-1.1-34.5-9.6-40.6-11.6-42.6M125.6 353.9c-25.9-8.5-36.9-18.7-36.9-18.7S69.6 321.8 60 295.4c-16.5-44.2-1.4-71.2-1.4-71.2s8.4-22.5 38.5-30c13.8-3.7 31-3.1 31-3.1s7.1 59.4 15.7 94.2c7.2 29.2 24.8 77.7 24.8 77.7s-26.1-3.1-43-9.1m300.3 107.6s-6.1 14.5-19.6 15.4c-5.8.4-10.3-1.2-10.3-1.2s-.3-.1-5.3-2.1l-112.9-55s-10.9-5.7-12.8-15.6c-2.2-8.1 2.7-18.1 2.7-18.1L322 273s4.8-9.7 12.2-13c.6-.3 2.3-1 4.5-1.5 8.1-2.1 18 2.8 18 2.8L467.4 315s12.6 5.7 15.3 16.2c1.9 7.4-.5 14-1.8 17.2-6.3 15.4-55 113.1-55 113.1" style="fill:#609926"/><path d="M326.8 380.1c-8.2.1-15.4 5.8-17.3 13.8s2 16.3 9.1 20c7.7 4 17.5 1.8 22.7-5.4 5.1-7.1 4.3-16.9-1.8-23.1l24-49.1c1.5.1 3.7.2 6.2-.5 4.1-.9 7.1-3.6 7.1-3.6 4.2 1.8 8.6 3.8 13.2 6.1 4.8 2.4 9.3 4.9 13.4 7.3.9.5 1.8 1.1 2.8 1.9 1.6 1.3 3.4 3.1 4.7 5.5 1.9 5.5-1.9 14.9-1.9 14.9-2.3 7.6-18.4 40.6-18.4 40.6-8.1-.2-15.3 5-17.7 12.5-2.6 8.1 1.1 17.3 8.9 21.3s17.4 1.7 22.5-5.3c5-6.8 4.6-16.3-1.1-22.6 1.9-3.7 3.7-7.4 5.6-11.3 5-10.4 13.5-30.4 13.5-30.4.9-1.7 5.7-10.3 2.7-21.3-2.5-11.4-12.6-16.7-12.6-16.7-12.2-7.9-29.2-15.2-29.2-15.2s0-4.1-1.1-7.1c-1.1-3.1-2.8-5.1-3.9-6.3 4.7-9.7 9.4-19.3 14.1-29-4.1-2-8.1-4-12.2-6.1-4.8 9.8-9.7 19.7-14.5 29.5-6.7-.1-12.9 3.5-16.1 9.4-3.4 6.3-2.7 14.1 1.9 19.8z" style="fill:#609926"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW X7 -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="167.952mm" height="41.6859mm" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
viewBox="0 0 17419 4323"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css">
<![CDATA[
.fil1 {fill:#003CA8}
.fil0 {fill:#FF8812}
.fil2 {fill:#003CA8;fill-rule:nonzero}
]]>
</style>
</defs>
<g id="图层_x0020_1">
<metadata id="CorelCorpID_0Corel-Layer"/>
<path class="fil0" d="M3315 1737l0 0c48,-10 78,51 40,83l0 0c-232,194 -337,501 -273,796l0 0c11,49 -51,79 -83,41l0 0c-182,-219 -464,-325 -743,-283 -437,234 -929,545 -1221,860 -345,372 -399,922 201,999 -1718,474 -1865,-1028 977,-1978 197,-194 282,-477 223,-750l0 0c-10,-49 51,-79 83,-41l0 0c194,232 500,337 796,273z"/>
<path class="fil1" d="M2555 1c412,0 752,120 1020,320 299,222 509,544 632,909l0 0c43,127 75,259 96,395 22,138 32,278 31,419 0,140 -12,279 -34,416 -22,136 -55,270 -98,398 -127,379 -341,715 -640,949 -269,210 -606,337 -1007,337l-1073 0c-222,0 -365,-43 -447,-114 -78,-67 -103,-156 -89,-258 13,-96 60,-202 130,-311 241,-372 903,-925 1287,-1019 -407,237 -761,685 -930,977l1122 0c230,0 423,-77 579,-205 176,-143 304,-351 383,-585 31,-92 54,-189 70,-287 16,-99 25,-200 25,-301 1,-100 -7,-201 -22,-299 -15,-96 -38,-190 -68,-280l0 0c-74,-220 -199,-413 -374,-546 -156,-118 -353,-190 -593,-190l0 0 -567 1 -273 -1c-105,-1 -202,18 -292,55 -89,37 -171,92 -245,166 -75,74 -130,156 -167,245 -37,90 -56,187 -56,292l0 857c542,-176 910,-209 1236,-136 -642,116 -1423,443 -1906,889l-55 51 0 -75 0 -1719 0 -2 0 0c1,-375 151,-712 395,-956 243,-243 581,-393 956,-393l0 0 2 0 0 0 972 2 0 -1z"/>
<path class="fil2" d="M7222 2023c0,153 -12,287 -37,403 -14,66 -30,124 -48,175 -18,52 -45,108 -82,170 -102,175 -235,296 -398,361 -132,50 -313,75 -542,75l-1141 0 0 -2388 821 -7 282 0 212 14c324,0 567,119 729,358 136,205 204,485 204,839zm-1346 -679l-333 0 0 1356 320 3c266,0 454,-42 565,-126 128,-96 191,-278 191,-547 0,-264 -59,-447 -177,-549 -109,-92 -298,-137 -566,-137zm3132 1155l-1144 0c34,87 76,151 126,192 50,40 120,60 211,60l784 0 -249 456 -497 0 -147 0 -146 0c-241,0 -417,-93 -529,-280 -88,-151 -132,-360 -132,-629 0,-285 72,-507 218,-667 145,-159 360,-240 644,-240 308,0 533,79 674,236 132,149 198,381 198,695l0 64 0 79 -11 34zm-1154 -385l599 0c-9,-100 -33,-173 -71,-218 -21,-23 -49,-41 -84,-55 -35,-13 -78,-20 -128,-20 -190,0 -296,97 -316,293zm1772 -709l382 1097 371 -1097 603 0 -661 1802 -627 0 -674 -1802 606 0zm3644 -116l-1336 0c-202,0 -324,33 -324,223 0,187 257,216 429,210l276 -10c513,0 842,211 842,744 0,554 -293,751 -831,751l-1295 0 0 -470 1077 0c223,0 453,-2 453,-237 0,-186 -230,-220 -406,-213l-225 14c-286,0 -506,-31 -684,-184 -153,-132 -229,-330 -229,-594 0,-581 395,-704 934,-704l1678 0 -359 470zm1157 116l-233 463 -297 0 0 569c0,269 59,317 344,317l-251 464c-606,0 -662,-210 -662,-811l0 -539 -242 0 811 -1057 0 594 530 0zm1546 1063l0 739 -569 0 0 -354 -245 354 -201 0c-232,0 -403,-35 -515,-106 -138,-91 -207,-247 -207,-468 0,-214 56,-367 170,-457 102,-78 262,-117 480,-117l518 0 0 -37c0,-62 -14,-103 -42,-125 -29,-21 -77,-32 -145,-32l-821 0 231 -460 445 0c429,0 694,73 796,218 34,51 60,147 78,286 18,139 27,326 27,559zm-1158 150c0,39 18,71 54,99 41,22 108,34 201,34l55 0 279 0 0 -273 -395 0c-57,0 -103,10 -140,29 -36,20 -54,56 -54,111zm1868 -859l228 -354 508 0 -263 460 -204 0c-113,0 -190,31 -228,92 -27,48 -41,137 -41,267l0 983 -569 0 0 -1802 569 0 0 354z"/>
</g>
</svg>

repo.diff.file_before

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 2.1 KiB

repo.diff.file_after

repo.diff.file_image_width:  |  repo.diff.file_image_height:  |  repo.diff.file_byte_size: 3.6 KiB

repo.diff.view_file

@@ -9,7 +9,12 @@ import (
"net/url"
"strconv"
"strings"
"io"
"os"
"path/filepath"
"time"
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/services/forms"
system_model "code.gitea.io/gitea/models/system"
"code.gitea.io/gitea/modules/cache"
"code.gitea.io/gitea/modules/git"
@@ -253,3 +258,47 @@ func ChangeConfig(ctx *context.Context) {
config.GetDynGetter().InvalidateCache()
ctx.JSONOK()
}
func LogoPost(ctx *context.Context) {
form := web.GetForm(ctx).(*forms.AvatarForm)
if form.Avatar == nil || form.Avatar.Filename == "" {
ctx.Flash.Error("No file uploaded")
ctx.Redirect(setting.AppSubURL + "/-/admin/config/settings")
return
}
ext := filepath.Ext(form.Avatar.Filename)
if ext != ".png" && ext != ".jpg" && ext != ".jpeg" && ext != ".gif" && ext != ".webp" {
ctx.Flash.Error("Invalid file type")
ctx.Redirect(setting.AppSubURL + "/-/admin/config/settings")
return
}
// 生成唯一文件名
filename := "logo_" + strconv.FormatInt(time.Now().Unix(), 10) + ext
savePath := filepath.Join(setting.CustomPath, "public", "assets", "img", filename)
os.MkdirAll(filepath.Dir(savePath), os.ModePerm)
out, err := os.Create(savePath)
if err != nil {
ctx.Flash.Error("Failed to save file")
ctx.Redirect(setting.AppSubURL + "/-/admin/config/settings")
return
}
defer out.Close()
fr, _ := form.Avatar.Open()
defer fr.Close()
io.Copy(out, fr)
// 保存路径到数据库
relPath := "/assets/img/" + filename
err = system_model.SetSetting(ctx, "custom_logo_path", relPath)
if err != nil {
ctx.Flash.Error("Failed to update database")
ctx.Redirect(setting.AppSubURL + "/-/admin/config/settings")
return
}
ctx.Flash.Success("Logo updated successfully")
ctx.Redirect(setting.AppSubURL + "/-/admin/config/settings")
}

repo.diff.view_file

@@ -726,6 +726,7 @@ func registerWebRoutes(m *web.Router) {
m.Post("/test_mail", admin.SendTestMail)
m.Post("/test_cache", admin.TestCache)
m.Get("/settings", admin.ConfigSettings)
m.Post("/logo", web.Bind(forms.AvatarForm{}), admin.LogoPost)
})
m.Group("/monitor", func() {

repo.diff.view_file

@@ -17,6 +17,7 @@ import (
"code.gitea.io/gitea/models/unit"
user_model "code.gitea.io/gitea/models/user"
system_model "code.gitea.io/gitea/models/system"
"code.gitea.io/gitea/modules/cache"
"code.gitea.io/gitea/modules/httpcache"
"code.gitea.io/gitea/modules/session"
@@ -207,6 +208,12 @@ func Contexter() func(next http.Handler) http.Handler {
ctx.Data["ManifestData"] = setting.ManifestData
ctx.Data["AllLangs"] = translation.AllLangs()
if logoPath, _ := system_model.GetSetting(ctx, "custom_logo_path"); logoPath != "" {
ctx.Data["CustomLogoPath"] = logoPath
} else {
ctx.Data["CustomLogoPath"] = ""
}
next.ServeHTTP(ctx.Resp, ctx.Req)
})
}

repo.diff.view_file

@@ -1,4 +1,36 @@
{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin config")}}
<!-- 自定义logo upload -->
<h4 class="ui top attached header">
{{ctx.Locale.Tr "admin.config.app_logo_config"}}
</h4>
<div class="ui attached segment">
<form
class="ui form"
action="{{ AppSubUrl }}/-/admin/config/logo"
method="post"
enctype="multipart/form-data"
>
{{.CsrfTokenHtml}}
<div class="inline field tw-pl-4">
<label
for="avatar"
>{{ctx.Locale.Tr "admin.config.choose_new_logo"}}</label
>
<input
name="avatar"
type="file"
accept="image/png,image/jpeg,image/gif,image/webp"
/>
</div>
<div class="field">
<button class="ui primary button">
{{ctx.Locale.Tr "admin.config.update_logo"}}
</button>
</div>
</form>
</div>
<h4 class="ui top attached header">
{{ctx.Locale.Tr "admin.config.picture_config"}}
</h4>

repo.diff.view_file

@@ -2,7 +2,7 @@
<div class="navbar-left">
<!-- the logo -->
<a class="item" id="navbar-logo" href="{{AppSubUrl}}/" aria-label="{{if .IsSigned}}{{ctx.Locale.Tr "dashboard"}}{{else}}{{ctx.Locale.Tr "home"}}{{end}}">
<img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{ctx.Locale.Tr "logo"}}" aria-hidden="true">
<img width="auto" height="30" src="{{if .CustomLogoPath}}{{.CustomLogoPath}}{{else}}{{AssetUrlPrefix}}/img/logo.svg{{end}}" alt="{{ctx.Locale.Tr "logo"}}" aria-hidden="true">
</a>
<!-- mobile right menu, it must be here because in mobile view, each item is a flex column, the first item is a full row column -->