Commit Graph

14415 Commits

Author SHA1 Message Date
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
Jason Song 6af809d0bd
chore: lint front 2022-11-25 22:27:34 +08:00
Jason Song 02fac6b5f0
Merge branch 'main' into feature/bots 2022-11-25 18:20:31 +08:00
Jason Song 378e1f8d01 chore: fix problems caused by rebase 2022-11-25 17:58:34 +08:00
KN4CK3R 7a4f7b35e3
Fix typo in sidebar (#21934)
Same as #21922 
I used the npm file as template which was a bad idea to spot these
casing errors...
2022-11-25 17:52:23 +08:00
Jason Song 295a7f68c8 feat: update job info 2022-11-25 17:48:48 +08:00
Jason Song 1886156329 chore: remove outdated todos 2022-11-25 17:48:48 +08:00
Jason Song 4814a6ad1b fix: fill more contexts 2022-11-25 17:48:48 +08:00
Lunny Xiao 324d6711da permission check 2022-11-25 17:48:48 +08:00
Jason Song fdd3c0434e feat: add IsForkPullRequest 2022-11-25 17:48:48 +08:00
Jason Song 6ad8bddabf feat: GetRunningTaskByToken 2022-11-25 17:48:48 +08:00
Jason Song e346581344 chore: update grpc router path 2022-11-25 17:48:48 +08:00
Jason Song 48f5c152b9 chore: mod tidy 2022-11-25 17:48:48 +08:00
Jason Song 96d9b729ee chore: upgrade act 2022-11-25 17:48:48 +08:00
Lunny Xiao 3e8de17db3 permission 2022-11-25 17:48:48 +08:00
Jason Song d17a0b13f1 chore: use bots-proto-go v0.1.0 2022-11-25 17:48:48 +08:00
Jason Song ea1bc1b662 chore: replace with code.gitea.io/bots-proto-go 2022-11-25 17:48:48 +08:00
Lunny Xiao 52b32c37ad Use a new name for bots 2022-11-25 17:48:48 +08:00
Lunny Xiao 45afa0ee9f Support most github's sdk 2022-11-25 17:48:48 +08:00
Lunny Xiao 2ecb59c092 rename builds -> bots 2022-11-25 17:48:48 +08:00
Lunny Xiao c61ac24c1c Fix bug 2022-11-25 17:48:48 +08:00
Bo-Yi.Wu 5d849cea33 chore(runner): remove update runner status
Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
2022-11-25 17:48:48 +08:00
Lunny Xiao 88b0ab89d0 Gitea bot will not fire the events otherwise it may causes a forever loop 2022-11-25 17:48:48 +08:00
Jason Song 736275f0b1 feat: support cancel button 2022-11-25 17:48:48 +08:00
Jason Song f3a9a25682 fix: remove build view header 2022-11-25 17:48:47 +08:00
Jason Song 5230c7a364 fix: remove debug log 2022-11-25 17:48:47 +08:00