Skip to content

Commit b6fd8a9

Browse files
Merge branch 'master' into lunny/fix_favicon_redirect
2 parents c53e828 + 8c086ba commit b6fd8a9

30 files changed

+325
-120
lines changed

README.md

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,52 @@
1-
[简体中文](README_ZH.md)
2-
3-
<h1> <img src="https://raw.githubusercontent.com/go-gitea/gitea/master/public/img/gitea-192.png" alt="logo" width="30" height="30"> Gitea - Git with a cup of tea</h1>
4-
5-
[![Build Status](https://drone.gitea.io/api/badges/go-gitea/gitea/status.svg?ref=refs/heads/master)](https://drone.gitea.io/go-gitea/gitea)
6-
[![Join the Discord chat at https://discord.gg/Gitea](https://img.shields.io/discord/322538954119184384.svg)](https://discord.gg/Gitea)
7-
[![](https://images.microbadger.com/badges/image/gitea/gitea.svg)](https://microbadger.com/images/gitea/gitea "Get your own image badge on microbadger.com")
8-
[![codecov](https://codecov.io/gh/go-gitea/gitea/branch/master/graph/badge.svg)](https://codecov.io/gh/go-gitea/gitea)
9-
[![Go Report Card](https://goreportcard.com/badge/code.gitea.io/gitea)](https://goreportcard.com/report/code.gitea.io/gitea)
10-
[![GoDoc](https://godoc.org/code.gitea.io/gitea?status.svg)](https://godoc.org/code.gitea.io/gitea)
11-
[![GitHub release](https://img.shields.io/github/release/go-gitea/gitea.svg)](https://github.com/go-gitea/gitea/releases/latest)
12-
[![Help Contribute to Open Source](https://www.codetriage.com/go-gitea/gitea/badges/users.svg)](https://www.codetriage.com/go-gitea/gitea)
13-
[![Become a backer/sponsor of gitea](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backers&color=brightgreen)](https://opencollective.com/gitea)
14-
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
15-
[![Crowdin](https://badges.crowdin.net/gitea/localized.svg)](https://crowdin.com/project/gitea)
16-
[![TODOs](https://badgen.net/https/api.tickgit.com/badgen/github.com/go-gitea/gitea)](https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea)
1+
<p align="center">
2+
<a href="https://gitea.io/">
3+
<img alt="Gitea" src="https://raw.githubusercontent.com/go-gitea/gitea/master/public/img/gitea.svg" width="220"/>
4+
</a>
5+
</p>
6+
<h1 align="center">Gitea - Git with a cup of tea</h1>
7+
8+
<p align="center">
9+
<a href="https://drone.gitea.io/go-gitea/gitea" title="Build Status">
10+
<img src="https://drone.gitea.io/api/badges/go-gitea/gitea/status.svg?ref=refs/heads/master">
11+
</a>
12+
<a href="https://discord.gg/Gitea" title="Join the Discord chat at https://discord.gg/Gitea">
13+
<img src="https://img.shields.io/discord/322538954119184384.svg">
14+
</a>
15+
<a href="https://microbadger.com/images/gitea/gitea" title="Get your own image badge on microbadger.com">
16+
<img src="https://images.microbadger.com/badges/image/gitea/gitea.svg">
17+
</a>
18+
<a href="https://codecov.io/gh/go-gitea/gitea" title="Codecov">
19+
<img src="https://codecov.io/gh/go-gitea/gitea/branch/master/graph/badge.svg">
20+
</a>
21+
<a href="https://godoc.org/code.gitea.io/gitea" title="Go Report Card">
22+
<img src="https://goreportcard.com/badge/code.gitea.io/gitea">
23+
</a>
24+
<a href="https://godoc.org/code.gitea.io/gitea" title="GoDoc">
25+
<img src="https://godoc.org/code.gitea.io/gitea?status.svg">
26+
</a>
27+
<a href="https://github.com/go-gitea/gitea/releases/latest" title="GitHub release">
28+
<img src="https://img.shields.io/github/release/go-gitea/gitea.svg">
29+
</a>
30+
<a href="https://www.codetriage.com/go-gitea/gitea" title="Help Contribute to Open Source">
31+
<img src="https://www.codetriage.com/go-gitea/gitea/badges/users.svg">
32+
</a>
33+
<a href="https://opencollective.com/gitea" title="Become a backer/sponsor of gitea">
34+
<img src="https://opencollective.com/gitea/tiers/backers/badge.svg?label=backers&color=brightgreen">
35+
</a>
36+
<a href="https://opensource.org/licenses/MIT" title="License: MIT">
37+
<img src="https://img.shields.io/badge/License-MIT-blue.svg">
38+
</a>
39+
<a href="https://crowdin.com/project/gitea" title="Crowdin">
40+
<img src="https://badges.crowdin.net/gitea/localized.svg">
41+
</a>
42+
<a href="https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea" title="TODOs">
43+
<img src="https://badgen.net/https/api.tickgit.com/badgen/github.com/go-gitea/gitea">
44+
</a>
45+
</p>
46+
47+
<p align="center">
48+
<a href="README_ZH.md">View the chinese version of this document</a>
49+
</p>
1750

1851
## Purpose
1952

README_ZH.md

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,52 @@
1-
[English](README.md)
2-
3-
<h1> <img src="https://raw.githubusercontent.com/go-gitea/gitea/master/public/img/gitea-192.png" alt="logo" width="30" height="30"> Gitea - Git with a cup of tea</h1>
4-
5-
[![Build Status](https://drone.gitea.io/api/badges/go-gitea/gitea/status.svg)](https://drone.gitea.io/go-gitea/gitea)
6-
[![Join the Discord chat at https://discord.gg/Gitea](https://img.shields.io/discord/322538954119184384.svg)](https://discord.gg/Gitea)
7-
[![](https://images.microbadger.com/badges/image/gitea/gitea.svg)](https://microbadger.com/images/gitea/gitea "Get your own image badge on microbadger.com")
8-
[![codecov](https://codecov.io/gh/go-gitea/gitea/branch/master/graph/badge.svg)](https://codecov.io/gh/go-gitea/gitea)
9-
[![Go Report Card](https://goreportcard.com/badge/code.gitea.io/gitea)](https://goreportcard.com/report/code.gitea.io/gitea)
10-
[![GoDoc](https://godoc.org/code.gitea.io/gitea?status.svg)](https://godoc.org/code.gitea.io/gitea)
11-
[![GitHub release](https://img.shields.io/github/release/go-gitea/gitea.svg)](https://github.com/go-gitea/gitea/releases/latest)
12-
[![Help Contribute to Open Source](https://www.codetriage.com/go-gitea/gitea/badges/users.svg)](https://www.codetriage.com/go-gitea/gitea)
13-
[![Become a backer/sponsor of gitea](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backers&color=brightgreen)](https://opencollective.com/gitea)
14-
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
15-
[![Crowdin](https://badges.crowdin.net/gitea/localized.svg)](https://crowdin.com/project/gitea)
1+
<p align="center">
2+
<a href="https://gitea.io/">
3+
<img alt="Gitea" src="https://raw.githubusercontent.com/go-gitea/gitea/master/public/img/gitea.svg" width="220"/>
4+
</a>
5+
</p>
6+
<h1 align="center">Gitea - Git with a cup of tea</h1>
7+
8+
<p align="center">
9+
<a href="https://drone.gitea.io/go-gitea/gitea" title="Build Status">
10+
<img src="https://drone.gitea.io/api/badges/go-gitea/gitea/status.svg?ref=refs/heads/master">
11+
</a>
12+
<a href="https://discord.gg/Gitea" title="Join the Discord chat at https://discord.gg/Gitea">
13+
<img src="https://img.shields.io/discord/322538954119184384.svg">
14+
</a>
15+
<a href="https://microbadger.com/images/gitea/gitea" title="Get your own image badge on microbadger.com">
16+
<img src="https://images.microbadger.com/badges/image/gitea/gitea.svg">
17+
</a>
18+
<a href="https://codecov.io/gh/go-gitea/gitea" title="Codecov">
19+
<img src="https://codecov.io/gh/go-gitea/gitea/branch/master/graph/badge.svg">
20+
</a>
21+
<a href="https://godoc.org/code.gitea.io/gitea" title="Go Report Card">
22+
<img src="https://goreportcard.com/badge/code.gitea.io/gitea">
23+
</a>
24+
<a href="https://godoc.org/code.gitea.io/gitea" title="GoDoc">
25+
<img src="https://godoc.org/code.gitea.io/gitea?status.svg">
26+
</a>
27+
<a href="https://github.com/go-gitea/gitea/releases/latest" title="GitHub release">
28+
<img src="https://img.shields.io/github/release/go-gitea/gitea.svg">
29+
</a>
30+
<a href="https://www.codetriage.com/go-gitea/gitea" title="Help Contribute to Open Source">
31+
<img src="https://www.codetriage.com/go-gitea/gitea/badges/users.svg">
32+
</a>
33+
<a href="https://opencollective.com/gitea" title="Become a backer/sponsor of gitea">
34+
<img src="https://opencollective.com/gitea/tiers/backers/badge.svg?label=backers&color=brightgreen">
35+
</a>
36+
<a href="https://opensource.org/licenses/MIT" title="License: MIT">
37+
<img src="https://img.shields.io/badge/License-MIT-blue.svg">
38+
</a>
39+
<a href="https://crowdin.com/project/gitea" title="Crowdin">
40+
<img src="https://badges.crowdin.net/gitea/localized.svg">
41+
</a>
42+
<a href="https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea" title="TODOs">
43+
<img src="https://badgen.net/https/api.tickgit.com/badgen/github.com/go-gitea/gitea">
44+
</a>
45+
</p>
46+
47+
<p align="center">
48+
<a href="README.md">View the english version of this document</a>
49+
</p>
1650

1751
## 目标
1852

build/generate-images.js

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
'use strict';
33

44
const imageminZopfli = require('imagemin-zopfli');
5+
const Svgo = require('svgo');
56
const {fabric} = require('fabric');
67
const {readFile, writeFile} = require('fs').promises;
78
const {resolve} = require('path');
8-
const Svgo = require('svgo');
99

1010
const logoFile = resolve(__dirname, '../assets/logo.svg');
1111

@@ -22,32 +22,20 @@ function loadSvg(svg) {
2222
});
2323
}
2424

25-
async function generateSvgFavicon(svg, outputFile) {
26-
const svgo = new Svgo({
27-
plugins: [
28-
{removeDimensions: true},
29-
{
30-
addAttributesToSVGElement: {
31-
attributes: [
32-
{'width': '32'},
33-
{'height': '32'},
34-
],
35-
},
36-
},
37-
],
38-
});
39-
40-
const {data} = await svgo.optimize(svg);
41-
await writeFile(outputFile, data);
42-
}
25+
async function generate(svg, outputFile, {size, bg}) {
26+
if (outputFile.endsWith('.svg')) {
27+
const svgo = new Svgo({
28+
plugins: [
29+
{removeDimensions: true},
30+
{addAttributesToSVGElement: {attributes: [{width: size}, {height: size}]}},
31+
],
32+
});
4333

44-
async function generateSvg(svg, outputFile) {
45-
const svgo = new Svgo();
46-
const {data} = await svgo.optimize(svg);
47-
await writeFile(outputFile, data);
48-
}
34+
const {data} = await svgo.optimize(svg);
35+
await writeFile(outputFile, data);
36+
return;
37+
}
4938

50-
async function generate(svg, outputFile, {size, bg}) {
5139
const {objects, options} = await loadSvg(svg);
5240
const canvas = new fabric.Canvas();
5341
canvas.setDimensions({width: size, height: size});
@@ -78,25 +66,16 @@ async function generate(svg, outputFile, {size, bg}) {
7866

7967
async function main() {
8068
const gitea = process.argv.slice(2).includes('gitea');
81-
8269
const svg = await readFile(logoFile, 'utf8');
70+
8371
await Promise.all([
84-
generateSvgFavicon(svg, resolve(__dirname, '../public/img/favicon.svg')),
85-
generateSvg(svg, resolve(__dirname, '../public/img/logo.svg')),
86-
generate(svg, resolve(__dirname, '../public/img/logo-lg.png'), {size: 880}),
87-
generate(svg, resolve(__dirname, '../public/img/logo-512.png'), {size: 512}),
88-
generate(svg, resolve(__dirname, '../public/img/logo-192.png'), {size: 192}),
89-
generate(svg, resolve(__dirname, '../public/img/logo-sm.png'), {size: 120}),
90-
generate(svg, resolve(__dirname, '../public/img/avatar_default.png'), {size: 200}),
72+
generate(svg, resolve(__dirname, '../public/img/logo.svg'), {size: 32}),
73+
generate(svg, resolve(__dirname, '../public/img/logo.png'), {size: 512}),
9174
generate(svg, resolve(__dirname, '../public/img/favicon.png'), {size: 180}),
75+
generate(svg, resolve(__dirname, '../public/img/avatar_default.png'), {size: 200}),
9276
generate(svg, resolve(__dirname, '../public/img/apple-touch-icon.png'), {size: 180, bg: true}),
77+
gitea && generate(svg, resolve(__dirname, '../public/img/gitea.svg'), {size: 32}),
9378
]);
94-
if (gitea) {
95-
await Promise.all([
96-
generateSvg(svg, resolve(__dirname, '../public/img/gitea.svg')),
97-
generate(svg, resolve(__dirname, '../public/img/gitea-192.png'), {size: 192}),
98-
]);
99-
}
10079
}
10180

10281
main().then(exit).catch(exit);

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,20 @@ the url `http://gitea.domain.tld/image.png`.
5959

6060
## Changing the default logo
6161

62-
To automatically update custom logo png and svg files replace `assets/logo.svg` and run `make generate-images`. This will update the user-designated logo files served in `public/img`. Alternatively, you can manually update each `logo-X.png` and `logo.svg` file in `public/img`.
62+
To build a custom logo replace `assets/logo.svg` and run `make generate-images`. This will update
63+
these customizable logo files which you can then place in `custom/public/img` on your server:
64+
65+
- `public/img/logo.svg`
66+
- `public/img/logo.png`
67+
- `public/img/favicon.png`
68+
- `public/img/avatar_default.png`
69+
- `public/img/apple-touch-icon.png`
6370

6471
## Changing the default avatar
6572

66-
Place the png image at the following path: `custom/public/img/avatar_default.png`
73+
Either generate it via above method or place the png image at the following path:
74+
75+
- `custom/public/img/avatar_default.png`
6776

6877
## Customizing Gitea pages and resources
6978

docs/content/doc/developers/oauth2-provider.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ Gitea supports acting as an OAuth2 provider to allow third party applications to
3030

3131
## Supported OAuth2 Grants
3232

33-
At the moment Gitea only supports the [**Authorization Code Grant**](https://tools.ietf.org/html/rfc6749#section-1.3.1) standard with additional support of the [Proof Key for Code Exchange (PKCE)](https://tools.ietf.org/html/rfc7636) extension.
33+
At the moment Gitea only supports the [**Authorization Code Grant**](https://tools.ietf.org/html/rfc6749#section-1.3.1) standard with additional support of the following extensions:
34+
- [Proof Key for Code Exchange (PKCE)](https://tools.ietf.org/html/rfc7636)
35+
- [OpenID Connect (OIDC)](https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth)
3436

3537
To use the Authorization Code Grant as a third party application it is required to register a new application via the "Settings" (`/user/settings/applications`) section of the settings.
3638

models/fixtures/oauth2_grant.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
user_id: 1
33
application_id: 1
44
counter: 1
5+
scope: "openid profile"
56
created_unix: 1546869730
67
updated_unix: 1546869730

models/issue.go

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,6 +1500,7 @@ type UserIssueStatsOptions struct {
15001500
IsPull bool
15011501
IsClosed bool
15021502
IssueIDs []int64
1503+
LabelIDs []int64
15031504
}
15041505

15051506
// GetUserIssueStats returns issue statistic information for dashboard by given conditions.
@@ -1516,57 +1517,66 @@ func GetUserIssueStats(opts UserIssueStatsOptions) (*IssueStats, error) {
15161517
cond = cond.And(builder.In("issue.id", opts.IssueIDs))
15171518
}
15181519

1520+
sess := func(cond builder.Cond) *xorm.Session {
1521+
s := x.Where(cond)
1522+
if len(opts.LabelIDs) > 0 {
1523+
s.Join("INNER", "issue_label", "issue_label.issue_id = issue.id").
1524+
In("issue_label.label_id", opts.LabelIDs)
1525+
}
1526+
return s
1527+
}
1528+
15191529
switch opts.FilterMode {
15201530
case FilterModeAll:
1521-
stats.OpenCount, err = x.Where(cond).And("issue.is_closed = ?", false).
1531+
stats.OpenCount, err = sess(cond).And("issue.is_closed = ?", false).
15221532
And(builder.In("issue.repo_id", opts.UserRepoIDs)).
15231533
Count(new(Issue))
15241534
if err != nil {
15251535
return nil, err
15261536
}
1527-
stats.ClosedCount, err = x.Where(cond).And("issue.is_closed = ?", true).
1537+
stats.ClosedCount, err = sess(cond).And("issue.is_closed = ?", true).
15281538
And(builder.In("issue.repo_id", opts.UserRepoIDs)).
15291539
Count(new(Issue))
15301540
if err != nil {
15311541
return nil, err
15321542
}
15331543
case FilterModeAssign:
1534-
stats.OpenCount, err = x.Where(cond).And("issue.is_closed = ?", false).
1544+
stats.OpenCount, err = sess(cond).And("issue.is_closed = ?", false).
15351545
Join("INNER", "issue_assignees", "issue.id = issue_assignees.issue_id").
15361546
And("issue_assignees.assignee_id = ?", opts.UserID).
15371547
Count(new(Issue))
15381548
if err != nil {
15391549
return nil, err
15401550
}
1541-
stats.ClosedCount, err = x.Where(cond).And("issue.is_closed = ?", true).
1551+
stats.ClosedCount, err = sess(cond).And("issue.is_closed = ?", true).
15421552
Join("INNER", "issue_assignees", "issue.id = issue_assignees.issue_id").
15431553
And("issue_assignees.assignee_id = ?", opts.UserID).
15441554
Count(new(Issue))
15451555
if err != nil {
15461556
return nil, err
15471557
}
15481558
case FilterModeCreate:
1549-
stats.OpenCount, err = x.Where(cond).And("issue.is_closed = ?", false).
1559+
stats.OpenCount, err = sess(cond).And("issue.is_closed = ?", false).
15501560
And("issue.poster_id = ?", opts.UserID).
15511561
Count(new(Issue))
15521562
if err != nil {
15531563
return nil, err
15541564
}
1555-
stats.ClosedCount, err = x.Where(cond).And("issue.is_closed = ?", true).
1565+
stats.ClosedCount, err = sess(cond).And("issue.is_closed = ?", true).
15561566
And("issue.poster_id = ?", opts.UserID).
15571567
Count(new(Issue))
15581568
if err != nil {
15591569
return nil, err
15601570
}
15611571
case FilterModeMention:
1562-
stats.OpenCount, err = x.Where(cond).And("issue.is_closed = ?", false).
1572+
stats.OpenCount, err = sess(cond).And("issue.is_closed = ?", false).
15631573
Join("INNER", "issue_user", "issue.id = issue_user.issue_id and issue_user.is_mentioned = ?", true).
15641574
And("issue_user.uid = ?", opts.UserID).
15651575
Count(new(Issue))
15661576
if err != nil {
15671577
return nil, err
15681578
}
1569-
stats.ClosedCount, err = x.Where(cond).And("issue.is_closed = ?", true).
1579+
stats.ClosedCount, err = sess(cond).And("issue.is_closed = ?", true).
15701580
Join("INNER", "issue_user", "issue.id = issue_user.issue_id and issue_user.is_mentioned = ?", true).
15711581
And("issue_user.uid = ?", opts.UserID).
15721582
Count(new(Issue))
@@ -1576,30 +1586,30 @@ func GetUserIssueStats(opts UserIssueStatsOptions) (*IssueStats, error) {
15761586
}
15771587

15781588
cond = cond.And(builder.Eq{"issue.is_closed": opts.IsClosed})
1579-
stats.AssignCount, err = x.Where(cond).
1589+
stats.AssignCount, err = sess(cond).
15801590
Join("INNER", "issue_assignees", "issue.id = issue_assignees.issue_id").
15811591
And("issue_assignees.assignee_id = ?", opts.UserID).
15821592
Count(new(Issue))
15831593
if err != nil {
15841594
return nil, err
15851595
}
15861596

1587-
stats.CreateCount, err = x.Where(cond).
1597+
stats.CreateCount, err = sess(cond).
15881598
And("poster_id = ?", opts.UserID).
15891599
Count(new(Issue))
15901600
if err != nil {
15911601
return nil, err
15921602
}
15931603

1594-
stats.MentionCount, err = x.Where(cond).
1604+
stats.MentionCount, err = sess(cond).
15951605
Join("INNER", "issue_user", "issue.id = issue_user.issue_id and issue_user.is_mentioned = ?", true).
15961606
And("issue_user.uid = ?", opts.UserID).
15971607
Count(new(Issue))
15981608
if err != nil {
15991609
return nil, err
16001610
}
16011611

1602-
stats.YourRepositoriesCount, err = x.Where(cond).
1612+
stats.YourRepositoriesCount, err = sess(cond).
16031613
And(builder.In("issue.repo_id", opts.UserRepoIDs)).
16041614
Count(new(Issue))
16051615
if err != nil {

models/migrations/migrations.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ var migrations = []Migration{
271271
NewMigration("Convert webhook task type from int to string", convertWebhookTaskTypeToString),
272272
// v163 -> v164
273273
NewMigration("Convert topic name from 25 to 50", convertTopicNameFrom25To50),
274+
// v164 -> v165
275+
NewMigration("Add scope and nonce columns to oauth2_grant table", addScopeAndNonceColumnsToOAuth2Grant),
274276
}
275277

276278
// GetCurrentDBVersion returns the current db version

0 commit comments

Comments
 (0)