Compare commits

..

No commits in common. "053df150fe056964771222569d4cb20dba19fd88" and "d5feb10aca0b309dce17a13255b4030f0a0cfe1b" have entirely different histories.

13 changed files with 39 additions and 115 deletions

View File

@ -17,10 +17,17 @@ fi
mv ./options/locale/locale_en-US.ini ./options/
# the "ini" library for locale has many quirks, its behavior is different from Crowdin.
# see i18n_test.go for more details
# the "ini" library for locale has many quirks
# * `a="xx"` gets `xx` (no quote)
# * `a=x\"y` gets `x\"y` (no unescaping)
# * `a="x\"y"` gets `"x\"y"` (no unescaping, the quotes are still there)
# * `a='x\"y'` gets `x\"y` (no unescaping, no quote)
# * `a="foo` gets `"foo` (although the quote is not closed)
# * 'a=`foo`' works like single-quote
# crowdin needs the strings to be quoted correctly and doesn't like incomplete quotes
# crowdin always outputs quoted strings if there are quotes in the strings.
# this script helps to unquote the Crowdin outputs for the quirky ini library
# this script helps to unquote the crowdin outputs for the quirky ini library
# * find all `key="...\"..."` lines
# * remove the leading quote
# * remove the trailing quote

View File

@ -317,14 +317,7 @@ func UpdateSource(source *Source) error {
}
}
has, err := db.GetEngine(db.DefaultContext).Where("name=? AND id!=?", source.Name, source.ID).Exist(new(Source))
if err != nil {
return err
} else if has {
return ErrSourceAlreadyExist{source.Name}
}
_, err = db.GetEngine(db.DefaultContext).ID(source.ID).AllCols().Update(source)
_, err := db.GetEngine(db.DefaultContext).ID(source.ID).AllCols().Update(source)
if err != nil {
return err
}

View File

@ -45,15 +45,15 @@ func AssetsHandlerFunc(opts *Options) http.HandlerFunc {
return
}
var corsSent bool
if opts.CorsHandler != nil {
var corsSent bool
opts.CorsHandler(http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
corsSent = true
})).ServeHTTP(resp, req)
// If CORS is not sent, the response must have been written by other handlers
if !corsSent {
return
}
}
// If CORS is not sent, the response must have been written by other handlers
if !corsSent {
return
}
file := req.URL.Path[len(opts.Prefix):]

View File

@ -4,7 +4,6 @@
package i18n
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
@ -76,56 +75,3 @@ c=22
assert.Equal(t, "21", ls.Tr("lang1", "b"))
assert.Equal(t, "22", ls.Tr("lang1", "c"))
}
func TestLocaleStoreQuirks(t *testing.T) {
const nl = "\n"
q := func(q1, s string, q2 ...string) string {
return q1 + s + strings.Join(q2, "")
}
testDataList := []struct {
in string
out string
hint string
}{
{` xx`, `xx`, "simple, no quote"},
{`" xx"`, ` xx`, "simple, double-quote"},
{`' xx'`, ` xx`, "simple, single-quote"},
{"` xx`", ` xx`, "simple, back-quote"},
{`x\"y`, `x\"y`, "no unescape, simple"},
{q(`"`, `x\"y`, `"`), `"x\"y"`, "unescape, double-quote"},
{q(`'`, `x\"y`, `'`), `x\"y`, "no unescape, single-quote"},
{q("`", `x\"y`, "`"), `x\"y`, "no unescape, back-quote"},
{q(`"`, `x\"y`) + nl + "b=", `"x\"y`, "half open, double-quote"},
{q(`'`, `x\"y`) + nl + "b=", `'x\"y`, "half open, single-quote"},
{q("`", `x\"y`) + nl + "b=`", `x\"y` + nl + "b=", "half open, back-quote, multi-line"},
{`x ; y`, `x ; y`, "inline comment (;)"},
{`x # y`, `x # y`, "inline comment (#)"},
{`x \; y`, `x ; y`, `inline comment (\;)`},
{`x \# y`, `x # y`, `inline comment (\#)`},
}
for _, testData := range testDataList {
ls := NewLocaleStore()
err := ls.AddLocaleByIni("lang1", "Lang1", []byte("a="+testData.in), nil)
assert.NoError(t, err, testData.hint)
assert.Equal(t, testData.out, ls.Tr("lang1", "a"), testData.hint)
assert.NoError(t, ls.Close())
}
// TODO: Crowdin needs the strings to be quoted correctly and doesn't like incomplete quotes
// and Crowdin always outputs quoted strings if there are quotes in the strings.
// So, Gitea's `key="quoted" unquoted` content shouldn't be used on Crowdin directly,
// it should be converted to `key="\"quoted\" unquoted"` first.
// TODO: We can not use UnescapeValueDoubleQuotes=true, because there are a lot of back-quotes in en-US.ini,
// then Crowdin will output:
// > key = "`x \" y`"
// Then Gitea will read a string with back-quotes, which is incorrect.
// TODO: Crowdin might generate multi-line strings, quoted by double-quote, it's not supported by LocaleStore
// LocaleStore uses back-quote for multi-line strings, it's not supported by Crowdin.
// TODO: Crowdin doesn't support back-quote as string quoter, it mainly uses double-quote
// so, the following line will be parsed as: value="`first", comment="second`" on Crowdin
// > a = `first; second`
}

View File

@ -2140,10 +2140,10 @@ settings.dismiss_stale_approvals_desc = When new commits that change the content
settings.require_signed_commits = Require Signed Commits
settings.require_signed_commits_desc = Reject pushes to this branch if they are unsigned or unverifiable.
settings.protect_branch_name_pattern = Protected Branch Name Pattern
settings.protect_protected_file_patterns = "Protected file patterns (separated using semicolon ';'):"
settings.protect_protected_file_patterns_desc = "Protected files are not allowed to be changed directly even if user has rights to add, edit, or delete files in this branch. Multiple patterns can be separated using semicolon (';'). See <a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>."
settings.protect_unprotected_file_patterns = "Unprotected file patterns (separated using semicolon ';'):"
settings.protect_unprotected_file_patterns_desc = "Unprotected files that are allowed to be changed directly if user has write access, bypassing push restriction. Multiple patterns can be separated using semicolon (';'). See <a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>."
settings.protect_protected_file_patterns = `Protected file patterns (separated using semicolon ';'):`
settings.protect_protected_file_patterns_desc = `Protected files are not allowed to be changed directly even if user has rights to add, edit, or delete files in this branch. Multiple patterns can be separated using semicolon (';'). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.`
settings.protect_unprotected_file_patterns = `Unprotected file patterns (separated using semicolon ';'):`
settings.protect_unprotected_file_patterns_desc = `Unprotected files that are allowed to be changed directly if user has write access, bypassing push restriction. Multiple patterns can be separated using semicolon (';'). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.`
settings.add_protected_branch = Enable protection
settings.delete_protected_branch = Disable protection
settings.update_protect_branch_success = Branch protection for rule '%s' has been updated.

View File

@ -2280,8 +2280,6 @@ diff.image.side_by_side=Lado a Lado
diff.image.swipe=Deslizar
diff.image.overlay=Sobrepor
diff.has_escaped=Esta linha tem caracteres unicode escondidos
diff.show_file_tree=Mostrar árvore de ficheiros
diff.hide_file_tree=Esconder árvore de ficheiros
releases.desc=Acompanhe as versões e as descargas do repositório.
release.releases=Lançamentos
@ -3366,7 +3364,6 @@ runners.status.idle=Parada
runners.status.active=Em funcionamento
runners.status.offline=Desconectada
runners.version=Versão
runners.reset_registration_token_success=O código de incrição do executor foi reposto com sucesso
runs.all_workflows=Todas as sequências de trabalho
runs.open_tab=%d abertas

View File

@ -426,11 +426,9 @@ func EditAuthSourcePost(ctx *context.Context) {
source.IsActive = form.IsActive
source.IsSyncEnabled = form.IsSyncEnabled
source.Cfg = config
// FIXME: if the name conflicts, it will result in 500: Error 1062: Duplicate entry 'aa' for key 'login_source.UQE_login_source_name'
if err := auth.UpdateSource(source); err != nil {
if auth.IsErrSourceAlreadyExist(err) {
ctx.Data["Err_Name"] = true
ctx.RenderWithErr(ctx.Tr("admin.auths.login_source_exist", err.(auth.ErrSourceAlreadyExist).Name), tplAuthEdit, form)
} else if oauth2.IsErrOpenIDConnectInitialize(err) {
if oauth2.IsErrOpenIDConnectInitialize(err) {
ctx.Flash.Error(err.Error(), true)
ctx.Data["Err_DiscoveryURL"] = true
ctx.HTML(http.StatusOK, tplAuthEdit)

View File

@ -1,6 +1,6 @@
{{template "base/head" .}}
<div role="main" aria-label="{{if .IsSigned}}{{.locale.Tr "dashboard"}}{{else}}{{.locale.Tr "home"}}{{end}}" class="page-content home">
<div class="ui middle very relaxed page gt-mb-5">
<div class="ui stackable middle very relaxed page grid">
<div class="sixteen wide center aligned centered column">
<div>
<img class="logo" width="220" height="220" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{.locale.Tr "logo"}}">

View File

@ -1,5 +1,5 @@
{{if eq .State "pending"}}
{{svg "octicon-dot-fill" 18 "commit-status icon text grey"}}
{{svg "octicon-dot-fill" 18 "commit-status icon text yellow"}}
{{end}}
{{if eq .State "running"}}
{{svg "octicon-dot-fill" 18 "commit-status icon text yellow"}}

View File

@ -110,7 +110,7 @@ func testRepoCommitsWithStatus(t *testing.T, resp, respOne *httptest.ResponseRec
}
func TestRepoCommitsWithStatusPending(t *testing.T) {
doTestRepoCommitWithStatus(t, "pending", "octicon-dot-fill", "grey")
doTestRepoCommitWithStatus(t, "pending", "octicon-dot-fill", "yellow")
}
func TestRepoCommitsWithStatusSuccess(t *testing.T) {
@ -129,10 +129,6 @@ func TestRepoCommitsWithStatusWarning(t *testing.T) {
doTestRepoCommitWithStatus(t, "warning", "gitea-exclamation", "yellow")
}
func TestRepoCommitsWithStatusRunning(t *testing.T) {
doTestRepoCommitWithStatus(t, "running", "octicon-dot-fill", "yellow")
}
func TestRepoCommitsStatusParallel(t *testing.T) {
defer tests.PrepareTestEnv(t)()

View File

@ -78,6 +78,7 @@
--color-purple: #a333c8;
--color-pink: #e03997;
--color-brown: #a5673f;
--color-grey: #888888;
--color-black: #1b1c1d;
/* light variants - produced via Sass scale-color(color, $lightness: +25%) */
--color-red-light: #e45e5e;
@ -91,10 +92,9 @@
--color-purple-light: #bb64d8;
--color-pink-light: #e86bb1;
--color-brown-light: #c58b66;
--color-grey-light: #a6a6a6;
--color-black-light: #525558;
/* other colors */
--color-grey: #707070;
--color-grey-light: #838383;
--color-gold: #a1882b;
--color-white: #ffffff;
--color-diff-removed-word-bg: #fdb8c0;
@ -2657,10 +2657,6 @@ table th[data-sortt-desc] .svg {
border-radius: 0 0 var(--border-radius) var(--border-radius);
}
.ui.multiple.dropdown > .label {
box-shadow: 0 0 0 1px var(--color-secondary) inset;
}
.text-label {
display: inline-flex !important;
align-items: center !important;

View File

@ -94,15 +94,6 @@ textarea:focus,
color: var(--color-text);
}
.ui.form .required.fields:not(.grouped) > .field > label::after,
.ui.form .required.fields.grouped > label::after,
.ui.form .required.field > label::after,
.ui.form .required.fields:not(.grouped) > .field > .checkbox::after,
.ui.form .required.field > .checkbox::after,
.ui.form label.required::after {
color: var(--color-red);
}
.ui.input,
.ui.checkbox input:focus ~ label::after,
.ui.checkbox input:checked ~ label::after,

View File

@ -68,7 +68,8 @@
--color-purple: #b259d0;
--color-pink: #d22e8b;
--color-brown: #a47252;
--color-black: #2e323e;
--color-grey: #9ea2aa;
--color-black: #1e222e;
/* light variants - produced via Sass scale-color(color, $lightness: -10%) */
--color-red-light: #c23636;
--color-orange-light: #b84f0b;
@ -81,10 +82,9 @@
--color-purple-light: #a742c9;
--color-pink-light: #be297d;
--color-brown-light: #94674a;
--color-black-light: #292d38;
--color-grey-light: #8d919b;
--color-black-light: #1b1f29;
/* other colors */
--color-grey: #505665;
--color-grey-light: #a1a6b7;
--color-gold: #b1983b;
--color-white: #ffffff;
--color-diff-removed-word-bg: #6f3333;
@ -124,19 +124,19 @@
--color-orange-badge-hover-bg: #f2711c4d;
--color-git: #f05133;
/* target-based colors */
--color-body: #373b47;
--color-body: #383c4a;
--color-box-header: #404652;
--color-box-body: #2a2e3a;
--color-box-body-highlight: #353945;
--color-text-dark: #dbe0ea;
--color-text: #cbd0da;
--color-text-light: #bbbfca;
--color-text-light-1: #aaafb9;
--color-text-light-2: #9a9ea9;
--color-text-light-3: #8a8e99;
--color-text: #bbc0ca;
--color-text-light: #a6aab5;
--color-text-light-1: #979ba6;
--color-text-light-2: #8a8e99;
--color-text-light-3: #707687;
--color-footer: #2e323e;
--color-timeline: #4c525e;
--color-input-text: #dfe3ec;
--color-input-text: #d5dbe6;
--color-input-background: #232933;
--color-input-toggle-background: #454a57;
--color-input-border: #454a57;
@ -159,7 +159,7 @@
--color-secondary-bg: #2a2e3a;
--color-text-focus: #fff;
--color-expand-button: #3c404d;
--color-placeholder-text: #8a8e99;
--color-placeholder-text: #6a737d;
--color-editor-line-highlight: var(--color-primary-light-5);
--color-project-board-bg: var(--color-secondary-light-2);
--color-caret: var(--color-text); /* should ideally be --color-text-dark, see #15651 */