14440 Commits

Author SHA1 Message Date
Jason Song
9bd773eb85
Merge branch 'main' into feature/bots 2022-12-02 09:42:42 +08:00
zeripath
64973cf18f
Use path not filepath in template filenames (#21993)
Paths in git are always separated by `/` not `\` - therefore we should
`path` and not `filepath`

Fix #21987

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2022-12-02 07:56:51 +08:00
silverwind
f0bd219a5e
Update chroma to v2.4.0 (#22000)
Did a few cursory tests, seems to work well.
2022-12-01 16:44:38 -05:00
Jason Song
f9cbf5a1bc
Util type to parse ref name (#21969)
Provide a new type to make it easier to parse a ref name.

Actually, it's picked up from #21937, to make the origin PR lighter.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2022-12-01 19:56:04 +08:00
Jason Song
4e5d4d0073
Skip initing LFS storage if disabled (#21996)
A complement to #21985.

I overlooked it because the name of the switch is `StartServer`, not
`Enabled`. I believe the weird name is a legacy, but renaming is out of
scope.
2022-12-01 11:02:04 +02:00
Jason Song
d2a4c10bc7
chore: code lint 2022-12-01 15:39:28 +08:00
Jason Song
b2745bff43
feat: support disable bots completely 2022-12-01 15:27:28 +08:00
Jason Song
ab69fdc6fe
feat: more notifications 2022-12-01 14:13:22 +08:00
Jason Song
a29babebd0
fix: skip initing bots storage if disabled 2022-12-01 13:42:48 +08:00
Jason Song
c5c9b4ae57
Merge branch 'main' into feature/bots 2022-12-01 13:39:47 +08:00
Lunny Xiao
b2c4870481
Fix parallel creating commit status bug with tests (#21911)
This PR is a follow up of #21469

Co-authored-by: Lauris BH <lauris@nix.lv>
2022-12-01 00:41:49 +08:00
Jason Song
67881ae99a
Skip initing disabled storages (#21985)
If `Attachment` or `Packages` are disabled, we don't have to init the
storages for them.
2022-11-30 21:39:02 +08:00
Jason Song
847d65d724
Merge branch 'main' into feature/bots 2022-11-30 18:25:36 +08:00
Jason Song
4487f04b14
feat: new way to notify 2022-11-30 18:24:47 +08:00
花墨
7020c4afb7
Fix leaving organization bug on user settings -> orgs (#21983)
Fix #21772

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-11-30 17:00:00 +08:00
Jason Song
9808d084ba
fix: remove useless codes 2022-11-30 16:07:00 +08:00
Jason Song
26ac9ab57d
Merge branch 'go-gitea:main' into feature/bots 2022-11-30 16:05:24 +08:00
luzpaz
fdfd77f478
Fix typos (#21979)
Found via codespell
2022-11-29 18:41:29 -06:00
Jason Song
3682fc3883
Merge branch 'main' into feature/bots 2022-11-29 18:50:02 +08:00
Jason Song
3793d55eca
fix: commit status 2022-11-29 18:48:00 +08:00
Jason Song
564937a657
feat: bots_service.CreateCommitStatus 2022-11-29 18:21:27 +08:00
Jason Song
8f2efdaf60
chore: add dbfs to migration 2022-11-29 17:19:26 +08:00
Jason Song
c1fce2cf7d
feat: remove bots resources after deleting repo 2022-11-29 16:25:58 +08:00
Saswat Padhi
715cf46dc4
Normalize AppURL according to RFC 3986 (#21950)
Fixes #21865.

Scheme-based normalization ([RFC 3986, section
6.2.3](https://www.rfc-editor.org/rfc/rfc3986#section-6.2.3)) was
already implemented, but only for `defaultAppURL`.
This PR implements the same for `AppURL`.

Signed-off-by: Saswat Padhi <saswatpadhi@protonmail.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2022-11-29 15:30:47 +08:00
Jason Song
e33d4d7700
fix: rename table name string 2022-11-29 13:47:09 +08:00
Jason Song
04d72d3500
refactor: rename tables to bot_* 2022-11-29 12:34:23 +08:00
Jason Song
3ac6bf3db4
fix: avoid hash uuid 2022-11-29 11:42:03 +08:00
Jason Song
797c21de1f
Merge branch 'main' into feature/bots 2022-11-29 11:09:20 +08:00
Jason Song
f047ee0a40
Use random bytes to generate access token (#21959) 2022-11-28 23:37:42 +08:00
Jason Song
9607750b5e
Replace fmt.Sprintf with hex.EncodeToString (#21960)
`hex.EncodeToString` has better performance than `fmt.Sprintf("%x",
[]byte)`, we should use it as much as possible.

I'm not an extreme fan of performance, so I think there are some
exceptions:

- `fmt.Sprintf("%x", func(...)[N]byte())`
- We can't slice the function return value directly, and it's not worth
adding lines.
    ```diff
    func A()[20]byte { ... }
    - a := fmt.Sprintf("%x", A())
    - a := hex.EncodeToString(A()[:]) // invalid
    + tmp := A()
    + a := hex.EncodeToString(tmp[:])
    ```
- `fmt.Sprintf("%X", []byte)`
- `strings.ToUpper(hex.EncodeToString(bytes))` has even worse
performance.
2022-11-28 11:19:18 +00:00
Jason Song
6f5c3feb2d
fix: register bots notifier when enabled only 2022-11-28 18:24:09 +08:00
Jason Song
e37b3911d8
fix: use ref in options 2022-11-28 18:21:49 +08:00
Jason Song
66b558017f
Merge branch 'main' into feature/bots 2022-11-28 17:23:53 +08:00
Jason Song
dccddd045e
test: init bot storage path 2022-11-28 17:19:15 +08:00
Jason Song
0c1d568e1d
chore: fix mods 2022-11-28 15:08:02 +08:00
Jason Song
e1c1d36234
fix: remove http2 support 2022-11-28 14:52:23 +08:00
flynnnnnnnnnn
e81ccc406b
Implement FSFE REUSE for golang files (#21840)
Change all license headers to comply with REUSE specification.

Fix #16132

Co-authored-by: flynnnnnnnnnn <flynnnnnnnnnn@github>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2022-11-27 18:20:29 +00:00
zeripath
f6fd501841
Correct the fallbacks for mailer configuration (#21945)
Unfortunately the fallback configuration code for [mailer] that were
added in #18982 are incorrect. When you read a value from an ini section
that key is added. This leads to a failure of the fallback mechanism.
Further there is also a spelling mistake in the startTLS configuration.

This PR restructures the mailer code to first map the deprecated
settings on to the new ones - and then use ini.MapTo to map those on to
the struct with additional validation as necessary.

Ref #21744

Signed-off-by: Andrew Thornton <art27@cantab.net>
2022-11-27 10:08:40 +00:00
KN4CK3R
32590db4ca [skip ci] Updated licenses and gitignores 2022-11-27 00:19:33 +00:00
KN4CK3R
4b5a6e5ef0
Fix typos (#21947)
Two typos

The `recieve` typo is also present in a translation.

5f38acd9a0/options/locale/locale_sv-SE.ini (L1760)
Someone with a Crowdin account should fix that.

... and in a license file but I don't think we can change that because
that's the official text.

5f38acd9a0/options/license/xinetd (L21)
2022-11-27 00:21:54 +08:00
Jason Song
ae018b6b48
fix: use PutVarint instead of AppendVarint 2022-11-26 22:41:03 +08:00
Jason Song
ef4b3673dd
chore: golang lint 2022-11-26 22:12:52 +08:00
Jason Song
bfe0fc1533
chore: replace spaces 2022-11-26 21:42:02 +08:00
Jason Song
dc48bf21c6
chore: add copyright 2022-11-26 21:33:05 +08:00
Jason Song
7854178da4
chore: fix duplicate to satisfy 2022-11-26 20:51:45 +08:00
Jason Song
0bd9553219
chore: golang lint 2022-11-26 20:14:03 +08:00
silverwind
5f38acd9a0
Fix markdown anchor re-clicking (#21931)
The hashchange event did not fire on re-click of a active anchor.
Instead, use the click event which always fires.

Fixes: https://github.com/go-gitea/gitea/issues/21680

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2022-11-26 19:15:44 +08:00
zeripath
d7f12af805
Prevent NPE if trying to restore an already restored deleted branch (#21940)
If a deleted-branch has already been restored, a request to restore it
again will cause a NPE. This PR adds detection for this case, but also
disables buttons when they're clicked in order to help prevent
accidental repeat requests.

Fix #21930

Signed-off-by: Andrew Thornton <art27@cantab.net>
2022-11-25 20:58:20 +00:00
Meisam
abecf632d2
add rel="me" to org.website link (#21941)
This lets organizations verify their link on 3rd party websites.
2022-11-25 09:33:37 -06:00
Jason Song
3b119f3d78
chore: npm install --package-lock-only 2022-11-25 22:27:34 +08:00