Commit Graph

3743 Commits

Author SHA1 Message Date
5f74b35377 refactor: rename files 2022-12-05 15:52:32 +08:00
704f72017d refactor: rename packages 2022-12-05 15:45:38 +08:00
fdd3444c52 fix: add missing ctx 2022-12-05 14:46:34 +08:00
bd1af5b7f8 Merge branch 'main' into feature/bots 2022-12-05 14:31:00 +08:00
a08584ee36 Ensure that Chinese punctuation is not ambiguous when locale is Chinese (#22019)
Although there are per-locale fallbacks for ambiguity the locale names
for Chinese do not quite match our locales. This PR simply maps zh-CN on
to zh-hans and other zh variants on to zh-hant.

Ref #20999

Signed-off-by: Andrew Thornton <art27@cantab.net>
2022-12-04 17:57:30 +00:00
ea86c2b56a Use GhostUser if needed for TrackedTimes (#22021)
When getting tracked times out of the db and loading their attributes
handle not exist errors in a nicer way. (Also prevent an NPE.)

Fix #22006

Signed-off-by: Andrew Thornton <art27@cantab.net>
2022-12-04 17:48:18 +00:00
46485848fa On tag/branch-exist check, dont panic if repo is nil (#21787)
fix a panic found in gitea logs
2022-12-04 10:28:57 +00:00
0a7d3ff786 refactor some functions to support ctx as first parameter (#21878)
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: Lauris BH <lauris@nix.lv>
2022-12-03 10:48:26 +08:00
8698458f48 Remove deprecated packages & staticcheck fixes (#22012)
`ioutil` is deprecated and should use `io` instead
2022-12-02 17:06:23 -05:00
b0d6c7b86e chore: use SPDX-License-Identifier 2022-12-02 22:25:31 +08:00
76869e4b76 Merge branch 'main' into feature/bots 2022-12-02 22:17:49 +08:00
f59a74852b Update gitea-vet to check FSFE REUSE (#22004)
Related to:
- #21840
- https://gitea.com/gitea/gitea-vet/pulls/21

What it looks like when it's working:
https://drone.gitea.io/go-gitea/gitea/64040/1/5

All available SPDX license identifiers: [SPDX License
List](https://spdx.org/licenses/).

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2022-12-02 22:14:57 +08:00
f869c988a5 chore: resolve conflict 2022-12-02 11:17:41 +08:00
9bd773eb85 Merge branch 'main' into feature/bots 2022-12-02 09:42:42 +08:00
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
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
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
b2745bff43 feat: support disable bots completely 2022-12-01 15:27:28 +08:00
ab69fdc6fe feat: more notifications 2022-12-01 14:13:22 +08:00
a29babebd0 fix: skip initing bots storage if disabled 2022-12-01 13:42:48 +08:00
c5c9b4ae57 Merge branch 'main' into feature/bots 2022-12-01 13:39:47 +08:00
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
4487f04b14 feat: new way to notify 2022-11-30 18:24:47 +08:00
3682fc3883 Merge branch 'main' into feature/bots 2022-11-29 18:50:02 +08:00
3793d55eca fix: commit status 2022-11-29 18:48:00 +08:00
c1fce2cf7d feat: remove bots resources after deleting repo 2022-11-29 16:25:58 +08:00
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
04d72d3500 refactor: rename tables to bot_* 2022-11-29 12:34:23 +08:00
797c21de1f Merge branch 'main' into feature/bots 2022-11-29 11:09:20 +08:00
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
6f5c3feb2d fix: register bots notifier when enabled only 2022-11-28 18:24:09 +08:00
e37b3911d8 fix: use ref in options 2022-11-28 18:21:49 +08:00
66b558017f Merge branch 'main' into feature/bots 2022-11-28 17:23:53 +08:00
e1c1d36234 fix: remove http2 support 2022-11-28 14:52:23 +08:00
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
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
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
ef4b3673dd chore: golang lint 2022-11-26 22:12:52 +08:00
0bd9553219 chore: golang lint 2022-11-26 20:14:03 +08:00
1886156329 chore: remove outdated todos 2022-11-25 17:48:48 +08:00
fdd3c0434e feat: add IsForkPullRequest 2022-11-25 17:48:48 +08:00
3e8de17db3 permission 2022-11-25 17:48:48 +08:00
ea1bc1b662 chore: replace with code.gitea.io/bots-proto-go 2022-11-25 17:48:48 +08:00
2ecb59c092 rename builds -> bots 2022-11-25 17:48:48 +08:00
88b0ab89d0 Gitea bot will not fire the events otherwise it may causes a forever loop 2022-11-25 17:48:48 +08:00
dd417a3270 chore: move job emitter to service 2022-11-25 17:48:47 +08:00
9a45572ce2 Support bot site 2022-11-25 17:48:47 +08:00
745be45e1b chore: rename to Init 2022-11-25 17:48:47 +08:00
9b021500b0 feat: ignore bots events of repo with disabled builds 2022-11-25 17:48:47 +08:00
fc2c70033a Add default bot url 2022-11-25 17:48:47 +08:00