aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2022-06-18 17:05:59 -0500
committerAnthony Wang2022-06-18 17:05:59 -0500
commit4cbc831ce629acea8468a3959975a90ee2e7ad39 (patch)
treeeb02064faf44322baed309ea9735a3e5e6202927
parentfb685bf05ac1e987e04b76123372cd6ea5b4b477 (diff)
parentf602958f3c170c6b84b4ba0ece53568fddb56010 (diff)
Merge branch 'feature-activitypub' into feature-go-ap-inbox-outbox
-rw-r--r--custom/conf/app.example.ini2
-rw-r--r--docs/content/doc/advanced/config-cheat-sheet.en-us.md4
-rw-r--r--modules/context/repo.go4
-rw-r--r--routers/api/v1/activitypub/person.go6
-rw-r--r--routers/api/v1/activitypub/reqsignature.go2
-rw-r--r--routers/web/webfinger.go1
6 files changed, 12 insertions, 7 deletions
diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini
index fb7770a4a..c4b8913e4 100644
--- a/custom/conf/app.example.ini
+++ b/custom/conf/app.example.ini
@@ -2231,10 +2231,12 @@ PATH =
;;
;; Allowed domains for migrating, default is blank. Blank means everything will be allowed.
;; Multiple domains could be separated by commas.
+;; Wildcard is supported: "github.com, *.github.com"
;ALLOWED_DOMAINS =
;;
;; Blocklist for migrating, default is blank. Multiple domains could be separated by commas.
;; When ALLOWED_DOMAINS is not blank, this option has a higher priority to deny domains.
+;; Wildcard is supported.
;BLOCKED_DOMAINS =
;;
;; Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291 (false by default)
diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md
index 4710fdbe9..b50e630a8 100644
--- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md
+++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md
@@ -1081,8 +1081,8 @@ Task queue configuration has been moved to `queue.task`. However, the below conf
- `MAX_ATTEMPTS`: **3**: Max attempts per http/https request on migrations.
- `RETRY_BACKOFF`: **3**: Backoff time per http/https request retry (seconds)
-- `ALLOWED_DOMAINS`: **\<empty\>**: Domains allowlist for migrating repositories, default is blank. It means everything will be allowed. Multiple domains could be separated by commas.
-- `BLOCKED_DOMAINS`: **\<empty\>**: Domains blocklist for migrating repositories, default is blank. Multiple domains could be separated by commas. When `ALLOWED_DOMAINS` is not blank, this option has a higher priority to deny domains.
+- `ALLOWED_DOMAINS`: **\<empty\>**: Domains allowlist for migrating repositories, default is blank. It means everything will be allowed. Multiple domains could be separated by commas. Wildcard is supported: `github.com, *.github.com`.
+- `BLOCKED_DOMAINS`: **\<empty\>**: Domains blocklist for migrating repositories, default is blank. Multiple domains could be separated by commas. When `ALLOWED_DOMAINS` is not blank, this option has a higher priority to deny domains. Wildcard is supported.
- `ALLOW_LOCALNETWORKS`: **false**: Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291
- `SKIP_TLS_VERIFY`: **false**: Allow skip tls verify
diff --git a/modules/context/repo.go b/modules/context/repo.go
index 8e75ad07d..217cbd3df 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -942,6 +942,10 @@ func RepoRefByType(refType RepoRefType, ignoreNotExistErr ...bool) func(*Context
ctx.Repo.Commit, err = ctx.Repo.GitRepo.GetTagCommit(refName)
if err != nil {
+ if git.IsErrNotExist(err) {
+ ctx.NotFound("GetTagCommit", err)
+ return
+ }
ctx.ServerError("GetTagCommit", err)
return
}
diff --git a/routers/api/v1/activitypub/person.go b/routers/api/v1/activitypub/person.go
index 23d418782..1641dfa51 100644
--- a/routers/api/v1/activitypub/person.go
+++ b/routers/api/v1/activitypub/person.go
@@ -45,14 +45,14 @@ func Person(ctx *context.APIContext) {
person.Name = ap.NaturalLanguageValuesNew()
err := person.Name.Set("en", ap.Content(ctx.ContextUser.FullName))
if err != nil {
- ctx.Error(http.StatusInternalServerError, "Set Name", err)
+ ctx.ServerError("Set Name", err)
return
}
person.PreferredUsername = ap.NaturalLanguageValuesNew()
err = person.PreferredUsername.Set("en", ap.Content(ctx.ContextUser.Name))
if err != nil {
- ctx.Error(http.StatusInternalServerError, "Set PreferredUsername", err)
+ ctx.ServerError("Set PreferredUsername", err)
return
}
@@ -77,7 +77,7 @@ func Person(ctx *context.APIContext) {
publicKeyPem, err := activitypub.GetPublicKey(ctx.ContextUser)
if err != nil {
- ctx.Error(http.StatusInternalServerError, "GetPublicKey", err)
+ ctx.ServerError("GetPublicKey", err)
return
}
person.PublicKey.PublicKeyPem = publicKeyPem
diff --git a/routers/api/v1/activitypub/reqsignature.go b/routers/api/v1/activitypub/reqsignature.go
index d5b29fddf..f7a2e9b7c 100644
--- a/routers/api/v1/activitypub/reqsignature.go
+++ b/routers/api/v1/activitypub/reqsignature.go
@@ -74,7 +74,7 @@ func verifyHTTPSignatures(ctx *gitea_context.APIContext) (authenticated bool, er
func ReqHTTPSignature() func(ctx *gitea_context.APIContext) {
return func(ctx *gitea_context.APIContext) {
if authenticated, err := verifyHTTPSignatures(ctx); err != nil {
- ctx.Error(http.StatusInternalServerError, "verifyHttpSignatures", err)
+ ctx.ServerError("verifyHttpSignatures", err)
} else if !authenticated {
ctx.Error(http.StatusForbidden, "reqSignature", "request signature verification failed")
}
diff --git a/routers/web/webfinger.go b/routers/web/webfinger.go
index b52c1879a..9972e9d0e 100644
--- a/routers/web/webfinger.go
+++ b/routers/web/webfinger.go
@@ -29,7 +29,6 @@ type webfingerLink struct {
Rel string `json:"rel,omitempty"`
Type string `json:"type,omitempty"`
Href string `json:"href,omitempty"`
- Template string `json:"template,omitempty"`
Titles map[string]string `json:"titles,omitempty"`
Properties map[string]interface{} `json:"properties,omitempty"`
}