Skip to content

Commit cf151a5

Browse files
committed
Merge branch 'main' into zzc/dev/fix-diff-highlight
2 parents 58ec361 + 61d08f4 commit cf151a5

File tree

34 files changed

+416
-147
lines changed

34 files changed

+416
-147
lines changed

.drone.yml

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -773,109 +773,6 @@ steps:
773773
- name: deps
774774
path: /go
775775

776-
---
777-
kind: pipeline
778-
name: update_translations
779-
780-
platform:
781-
os: linux
782-
arch: arm64
783-
784-
trigger:
785-
branch:
786-
- main
787-
event:
788-
- cron
789-
cron:
790-
- update_translations
791-
792-
steps:
793-
- name: download
794-
image: jonasfranz/crowdin
795-
pull: always
796-
settings:
797-
download: true
798-
export_dir: options/locale/
799-
ignore_branch: true
800-
project_identifier: gitea
801-
environment:
802-
CROWDIN_KEY:
803-
from_secret: crowdin_key
804-
805-
- name: update
806-
image: alpine:3.17
807-
pull: always
808-
commands:
809-
- ./build/update-locales.sh
810-
811-
- name: push
812-
image: appleboy/drone-git-push
813-
pull: always
814-
settings:
815-
author_email: "[email protected]"
816-
author_name: GiteaBot
817-
branch: main
818-
commit: true
819-
commit_message: "[skip ci] Updated translations via Crowdin"
820-
remote: "[email protected]:go-gitea/gitea.git"
821-
environment:
822-
DRONE_COMMIT_AUTHOR_EMAIL: "[email protected]"
823-
DRONE_COMMIT_AUTHOR: GiteaBot
824-
GIT_PUSH_SSH_KEY:
825-
from_secret: git_push_ssh_key
826-
827-
- name: upload_translations
828-
image: jonasfranz/crowdin
829-
pull: always
830-
settings:
831-
files:
832-
locale_en-US.ini: options/locale/locale_en-US.ini
833-
ignore_branch: true
834-
project_identifier: gitea
835-
environment:
836-
CROWDIN_KEY:
837-
from_secret: crowdin_key
838-
839-
---
840-
kind: pipeline
841-
type: docker
842-
name: update_gitignore_and_licenses
843-
844-
platform:
845-
os: linux
846-
arch: arm64
847-
848-
trigger:
849-
branch:
850-
- main
851-
event:
852-
- cron
853-
cron:
854-
- update_gitignore_and_licenses
855-
856-
steps:
857-
- name: download
858-
image: gitea/test_env:linux-1.20-amd64
859-
pull: always
860-
commands:
861-
- timeout -s ABRT 40m make generate-license generate-gitignore
862-
863-
- name: push
864-
image: appleboy/drone-git-push
865-
pull: always
866-
settings:
867-
author_email: "[email protected]"
868-
author_name: "GiteaBot"
869-
branch: main
870-
commit: true
871-
commit_message: "[skip ci] Updated licenses and gitignores"
872-
remote: "[email protected]:go-gitea/gitea.git"
873-
environment:
874-
DRONE_COMMIT_AUTHOR_EMAIL: "[email protected]"
875-
DRONE_COMMIT_AUTHOR: "GiteaBot"
876-
GIT_PUSH_SSH_KEY:
877-
from_secret: git_push_ssh_key
878-
879776
---
880777
kind: pipeline
881778
type: docker

.github/workflows/cron-licenses.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
on:
2+
schedule:
3+
# weekly on Monday at 0:07 UTC
4+
- cron: "7 0 * * 1"
5+
6+
name: Update licenses and gitignores
7+
8+
jobs:
9+
cron:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
- uses: actions/setup-go@v3
15+
with:
16+
go-version: '>=1.20.1'
17+
- name: update licenses and gitignores
18+
run: timeout -s ABRT 40m make generate-license generate-gitignore
19+
- name: push translations to repo
20+
uses: appleboy/[email protected]
21+
with:
22+
author_email: "[email protected]"
23+
author_name: GiteaBot
24+
branch: main
25+
commit: true
26+
commit_message: "[skip ci] Updated licenses and gitignores"
27+
remote: "[email protected]:go-gitea/gitea.git"
28+
ssh_key: ${{ secrets.DEPLOY_KEY }}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
on:
2+
schedule:
3+
- cron: "7 0 * * *" # every day at 0:07 UTC
4+
5+
name: Pull translations from Crowdin
6+
7+
jobs:
8+
crowdin_pull:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
- name: download from crowdin
14+
uses: docker://jonasfranz/crowdin
15+
env:
16+
CROWDIN_KEY: ${{ secrets.CROWDIN_KEY }}
17+
PLUGIN_DOWNLOAD: true
18+
PLUGIN_EXPORT_DIR: options/locale/
19+
PLUGIN_IGNORE_BRANCH: true
20+
PLUGIN_PROJECT_IDENTIFIER: gitea
21+
- name: update locales
22+
run: ./build/update-locales.sh
23+
- name: push translations to repo
24+
uses: appleboy/[email protected]
25+
with:
26+
author_email: "[email protected]"
27+
author_name: GiteaBot
28+
branch: main
29+
commit: true
30+
commit_message: "[skip ci] Updated translations via Crowdin"
31+
remote: "[email protected]:go-gitea/gitea.git"
32+
ssh_key: ${{ secrets.DEPLOY_KEY }}
33+
crowdin_push:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v3
38+
- name: push translations to crowdin
39+
uses: docker://jonasfranz/crowdin
40+
env:
41+
CROWDIN_KEY: ${{ secrets.CROWDIN_KEY }}
42+
PLUGIN_UPLOAD: true
43+
PLUGIN_IGNORE_BRANCH: true
44+
PLUGIN_PROJECT_IDENTIFIER: gitea
45+
PLUGIN_FILES: |
46+
locale_en-US.ini: options/locale/locale_en-US.ini
47+
PLUGIN_BRANCH: main

custom/conf/app.example.ini

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,10 +1203,9 @@ ROUTER = console
12031203
;; Number of line of codes shown for a code comment
12041204
;CODE_COMMENT_LINES = 4
12051205
;;
1206-
;; Value of `theme-color` meta tag, used by Android >= 5.0
1207-
;; An invalid color like "none" or "disable" will have the default style
1208-
;; More info: https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android
1209-
;THEME_COLOR_META_TAG = `#6cc644`
1206+
;; Value of `theme-color` meta tag, used by some mobile browers for chrome and
1207+
;; out-of-viewport areas. Default is unset which uses body color.
1208+
;THEME_COLOR_META_TAG =
12101209
;;
12111210
;; Max size of files to be displayed (default is 8MiB)
12121211
;MAX_DISPLAY_FILE_SIZE = 8388608

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
220220
- `SHOW_USER_EMAIL`: **true**: Whether the email of the user should be shown in the Explore Users page.
221221
- `THEMES`: **auto,gitea,arc-green**: All available themes. Allow users select personalized themes.
222222
regardless of the value of `DEFAULT_THEME`.
223-
- `THEME_COLOR_META_TAG`: **#6cc644**: Value of `theme-color` meta tag, used by Android >= 5.0. An invalid color like "none" or "disable" will have the default style. More info: https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android
223+
- `THEME_COLOR_META_TAG`: **\<empty\>**: Value of `theme-color` meta tag, used by some mobile browers for chrome and out-of-viewport areas. Default is unset which uses body color.
224224
- `MAX_DISPLAY_FILE_SIZE`: **8388608**: Max size of files to be displayed (default is 8MiB)
225225
- `REACTIONS`: All available reactions users can choose on issues/prs and comments
226226
Values can be emoji alias (:smile:) or a unicode emoji.

modules/context/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ func RepoRefForAPI(next http.Handler) http.Handler {
337337
if git.IsErrNotExist(err) {
338338
ctx.NotFound()
339339
} else {
340-
ctx.Error(http.StatusInternalServerError, "GetBlobByPath", err)
340+
ctx.Error(http.StatusInternalServerError, "GetCommit", err)
341341
}
342342
return
343343
}

modules/setting/ui.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ var UI = struct {
7777
GraphMaxCommitNum: 100,
7878
CodeCommentLines: 4,
7979
ReactionMaxUserNum: 10,
80-
ThemeColorMetaTag: `#6cc644`,
80+
ThemeColorMetaTag: ``,
8181
MaxDisplayFileSize: 8388608,
8282
DefaultTheme: `auto`,
8383
Themes: []string{`auto`, `gitea`, `arc-green`},

modules/structs/miscellaneous.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,22 @@ type ServerVersion struct {
7272
Version string `json:"version"`
7373
}
7474

75+
// LicensesListEntry is used for the API
76+
type LicensesTemplateListEntry struct {
77+
Key string `json:"key"`
78+
Name string `json:"name"`
79+
URL string `json:"url"`
80+
}
81+
82+
// LicensesInfo contains information about a License
83+
type LicenseTemplateInfo struct {
84+
Key string `json:"key"`
85+
Name string `json:"name"`
86+
URL string `json:"url"`
87+
Implementation string `json:"implementation"`
88+
Body string `json:"body"`
89+
}
90+
7591
// APIError is an api error with a message
7692
type APIError struct {
7793
Message string `json:"message"`

modules/templates/helper.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@ func NewFuncMap() []template.FuncMap {
141141
"TimeSinceUnix": timeutil.TimeSinceUnix,
142142
"DateTime": timeutil.DateTime,
143143
"Sec2Time": util.SecToTime,
144-
"DateFmtLong": func(t time.Time) string {
145-
return t.Format(time.RFC3339)
146-
},
147144
"LoadTimes": func(startTime time.Time) string {
148145
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
149146
},

options/locale/locale_el-GR.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ team_invite.text_3=Σημείωση: Αυτή η πρόσκληση προορι
462462
[modal]
463463
yes=Ναι
464464
no=Όχι
465+
confirm=Επιβεβαίωση
465466
cancel=Ακύρωση
466467
modify=Ενημέρωση
467468

@@ -1622,7 +1623,10 @@ pulls.tab_files=Αρχεία Με Αλλαγές
16221623
pulls.reopen_to_merge=Παρακαλώ ανοίξτε ξανά αυτό το pull request για να εκτελέσετε μια συγχώνευση.
16231624
pulls.cant_reopen_deleted_branch=Αυτό το pull request δεν μπορεί να ανοίξει ξανά επειδή ο κλάδος διαγράφηκε.
16241625
pulls.merged=Συγχωνευμένο
1626+
pulls.merged_success=Το pull request συγχωνεύτηκε και έκλεισε επιτυχώς
1627+
pulls.closed=Το pull request έκλεισε
16251628
pulls.manually_merged=Συγχωνεύτηκαν χειροκίνητα
1629+
pulls.merged_info_text=Ο κλάδος %s μπορεί τώρα να διαγραφεί.
16261630
pulls.is_closed=Το pull request έχει κλείσει.
16271631
pulls.title_wip_desc=`<a href="#">Ξεκινήστε τον τίτλο με <strong>%s</strong></a> για να αποτρέψετε την τυχαία συγχώνευση του pull request.`
16281632
pulls.cannot_merge_work_in_progress=Αυτό το pull request επισημαίνεται ως μια εργασία σε εξέλιξη.
@@ -3414,4 +3418,7 @@ runs.no_matching_runner_helper=Δε ταιριάζει εκτελεστής: %s
34143418
need_approval_desc=Πρέπει να εγκριθεί η εκτέλεση ροών εργασίας για pull request από fork.
34153419

34163420
[projects]
3421+
type-1.display_name=Ατομικό Έργο
3422+
type-2.display_name=Έργο Αποθετηρίου
3423+
type-3.display_name=Έργο Οργανισμού
34173424

options/locale/locale_zh-CN.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ show_only_public=只显示公开的
284284
issues.in_your_repos=在您的仓库中
285285

286286
[explore]
287-
repos=仓库管理
287+
repos=仓库
288288
users=用户
289289
organizations=组织管理
290290
search=搜索

routers/api/v1/api.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,8 @@ func Routes(ctx gocontext.Context) *web.Route {
719719
m.Post("/markup", bind(api.MarkupOption{}), misc.Markup)
720720
m.Post("/markdown", bind(api.MarkdownOption{}), misc.Markdown)
721721
m.Post("/markdown/raw", misc.MarkdownRaw)
722+
m.Get("/licenses", misc.ListLicenseTemplates)
723+
m.Get("/licenses/{name}", misc.GetLicenseTemplateInfo)
722724
m.Group("/settings", func() {
723725
m.Get("/ui", settings.GetGeneralUISettings)
724726
m.Get("/api", settings.GetGeneralAPISettings)

routers/api/v1/misc/licenses.go

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package misc
5+
6+
import (
7+
"fmt"
8+
"net/http"
9+
"net/url"
10+
11+
"code.gitea.io/gitea/modules/context"
12+
"code.gitea.io/gitea/modules/options"
13+
repo_module "code.gitea.io/gitea/modules/repository"
14+
"code.gitea.io/gitea/modules/setting"
15+
api "code.gitea.io/gitea/modules/structs"
16+
"code.gitea.io/gitea/modules/util"
17+
)
18+
19+
// Returns a list of all License templates
20+
func ListLicenseTemplates(ctx *context.APIContext) {
21+
// swagger:operation GET /licenses miscellaneous listLicenseTemplates
22+
// ---
23+
// summary: Returns a list of all license templates
24+
// produces:
25+
// - application/json
26+
// responses:
27+
// "200":
28+
// "$ref": "#/responses/LicenseTemplateList"
29+
response := make([]api.LicensesTemplateListEntry, len(repo_module.Licenses))
30+
for i, license := range repo_module.Licenses {
31+
response[i] = api.LicensesTemplateListEntry{
32+
Key: license,
33+
Name: license,
34+
URL: fmt.Sprintf("%sapi/v1/licenses/%s", setting.AppURL, url.PathEscape(license)),
35+
}
36+
}
37+
ctx.JSON(http.StatusOK, response)
38+
}
39+
40+
// Returns information about a gitignore template
41+
func GetLicenseTemplateInfo(ctx *context.APIContext) {
42+
// swagger:operation GET /licenses/{name} miscellaneous getLicenseTemplateInfo
43+
// ---
44+
// summary: Returns information about a license template
45+
// produces:
46+
// - application/json
47+
// parameters:
48+
// - name: name
49+
// in: path
50+
// description: name of the license
51+
// type: string
52+
// required: true
53+
// responses:
54+
// "200":
55+
// "$ref": "#/responses/LicenseTemplateInfo"
56+
// "404":
57+
// "$ref": "#/responses/notFound"
58+
name := util.PathJoinRelX(ctx.Params("name"))
59+
60+
text, err := options.License(name)
61+
if err != nil {
62+
ctx.NotFound()
63+
return
64+
}
65+
66+
response := api.LicenseTemplateInfo{
67+
Key: name,
68+
Name: name,
69+
URL: fmt.Sprintf("%sapi/v1/licenses/%s", setting.AppURL, url.PathEscape(name)),
70+
Body: string(text),
71+
// This is for combatibilty with the GitHub API. This Text is for some reason added to each License response.
72+
Implementation: "Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file",
73+
}
74+
75+
ctx.JSON(http.StatusOK, response)
76+
}

0 commit comments

Comments
 (0)