Skip to content

Commit

Permalink
Merge remote-tracking branch 'giteaofficial/main'
Browse files Browse the repository at this point in the history
* giteaofficial/main:
  [skip ci] Updated translations via Crowdin
  Add the possibility to allow the user to have a favicon which differs from the main logo (go-gitea#18542)
  • Loading branch information
zjjhot committed May 24, 2022
2 parents 74419fe + 7671a33 commit ea8884f
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 14 deletions.
31 changes: 31 additions & 0 deletions assets/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 10 additions & 7 deletions build/generate-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {fileURLToPath} from 'url';
const {readFile, writeFile} = fs.promises;
const __dirname = dirname(fileURLToPath(import.meta.url));
const logoFile = resolve(__dirname, '../assets/logo.svg');
const faviconFile = resolve(__dirname, '../assets/favicon.svg');

function exit(err) {
if (err) console.error(err);
Expand Down Expand Up @@ -68,15 +69,17 @@ async function generate(svg, outputFile, {size, bg}) {

async function main() {
const gitea = process.argv.slice(2).includes('gitea');
const svg = await readFile(logoFile, 'utf8');
const logoSvg = await readFile(logoFile, 'utf8');
const faviconSvg = await readFile(faviconFile, 'utf8');

await Promise.all([
generate(svg, resolve(__dirname, '../public/img/logo.svg'), {size: 32}),
generate(svg, resolve(__dirname, '../public/img/logo.png'), {size: 512}),
generate(svg, resolve(__dirname, '../public/img/favicon.png'), {size: 180}),
generate(svg, resolve(__dirname, '../public/img/avatar_default.png'), {size: 200}),
generate(svg, resolve(__dirname, '../public/img/apple-touch-icon.png'), {size: 180, bg: true}),
gitea && generate(svg, resolve(__dirname, '../public/img/gitea.svg'), {size: 32}),
generate(logoSvg, resolve(__dirname, '../public/img/logo.svg'), {size: 32}),
generate(logoSvg, resolve(__dirname, '../public/img/logo.png'), {size: 512}),
generate(faviconSvg, resolve(__dirname, '../public/img/favicon.svg'), {size: 32}),
generate(faviconSvg, resolve(__dirname, '../public/img/favicon.png'), {size: 180}),
generate(logoSvg, resolve(__dirname, '../public/img/avatar_default.png'), {size: 200}),
generate(logoSvg, resolve(__dirname, '../public/img/apple-touch-icon.png'), {size: 180, bg: true}),
gitea && generate(logoSvg, resolve(__dirname, '../public/img/gitea.svg'), {size: 32}),
]);
}

Expand Down
9 changes: 5 additions & 4 deletions docs/content/doc/advanced/customizing-gitea.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ the url `http://gitea.domain.tld/assets/image.png`.

## Changing the logo

To build a custom logo clone the Gitea source repository, replace `assets/logo.svg` and run
`make generate-images`. This will update below output files which you can then place in `$GITEA_CUSTOM/public/img` on your server:
To build a custom logo and/or favicon clone the Gitea source repository, replace `assets/logo.svg` and/or `assets/favicon.svg` and run
`make generate-images`. `assets/favicon.svg` is used for the favicon only. This will update below output files which you can then place in `$GITEA_CUSTOM/public/img` on your server:

- `public/img/logo.svg` - Used for favicon, site icon, app icon
- `public/img/logo.svg` - Used for site icon, app icon
- `public/img/logo.png` - Used for Open Graph
- `public/img/favicon.png` - Used as fallback for browsers that don't support SVG favicons
- `public/img/avatar_default.png` - Used as the default avatar image
- `public/img/apple-touch-icon.png` - Used on iOS devices for bookmarks
- `public/img/favicon.svg` - Used for favicon
- `public/img/favicon.png` - Used as fallback for browsers that don't support SVG favicons

In case the source image is not in vector format, you can attempt to convert a raster image using tools like [this](https://www.aconvert.com/image/png-to-svg/).

Expand Down
3 changes: 1 addition & 2 deletions options/locale/locale_zh-CN.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2423,8 +2423,7 @@ dashboard.new_version_hint=Gitea %s 现已可用,您正在运行 %s。查看 <
dashboard.statistic=摘要
dashboard.operations=维护操作
dashboard.system_status=系统状态
dashboard.statistic_info=此 Gitea 数据库有 <b>%d</b> 位用户、<b>%d</b> 家组织、 <b>%d</b> 枚公钥、<b>%d</b> 个仓库、<b>%d</b> 个仓库关注、<b>%d</b> 个星标、~<b>%d</b> 个操作、 <b>%d</b> 次访问、<b>%d</b> 张工单、 <b>%d</b> 条评论、 <b>%d</b> 个社交账户、<b>%d</b> 个用户关注、<b>%d</b> 个镜像
、<b>%d</b> 个发布、<b>%d</b> 个验证源、<b>%d</b> 个 webhooks、<b>%d</b> 个里程碑、 <b>%d</b> 个标签、<b>%d</b> 个 hook 任务、 <b>%d</b> 支团队、<b>%d</b> 个更新任务、<b>%d</b> 个附件。
dashboard.statistic_info=此 Gitea 数据库有 <b>%d</b> 位用户、<b>%d</b> 家组织、 <b>%d</b> 枚公钥、<b>%d</b> 个仓库、<b>%d</b> 个仓库关注、<b>%d</b> 个星标、~<b>%d</b> 个操作、 <b>%d</b> 次访问、<b>%d</b> 张工单、 <b>%d</b> 条评论、 <b>%d</b> 个社交账户、<b>%d</b> 个用户关注、<b>%d</b> 个镜像、<b>%d</b> 个发布、<b>%d</b> 个验证源、<b>%d</b> 个 webhooks、<b>%d</b> 个里程碑、 <b>%d</b> 个标签、<b>%d</b> 个 hook 任务、 <b>%d</b> 支团队、<b>%d</b> 个更新任务、<b>%d</b> 个附件。
dashboard.operation_name=操作名称
dashboard.operation_switch=开关
dashboard.operation_run=执行
Expand Down
2 changes: 1 addition & 1 deletion templates/base/head.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<link rel="alternate" type="application/atom+xml" title="" href="{{.FeedURL}}.atom">
<link rel="alternate" type="application/rss+xml" title="" href="{{.FeedURL}}.rss">
{{end}}
<link rel="icon" href="{{AssetUrlPrefix}}/img/logo.svg" type="image/svg+xml">
<link rel="icon" href="{{AssetUrlPrefix}}/img/favicon.svg" type="image/svg+xml">
<link rel="alternate icon" href="{{AssetUrlPrefix}}/img/favicon.png" type="image/png">
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/index.css?v={{MD5 AppVer}}">
{{template "base/head_script" .}}
Expand Down

0 comments on commit ea8884f

Please sign in to comment.