-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[API] Expose MAX_RESPONSE_ITEMS for API #12664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I guess something like this would do? From 41bc6c6c92233d0b46aa2d0bdd5bf3c311cd1abf Mon Sep 17 00:00:00 2001
From: Andrew Thornton <[email protected]>
Date: Fri, 4 Sep 2020 11:44:53 +0100
Subject: [PATCH] Add API settings to GeneralUISettings
Fix #12664
Signed-off-by: Andrew Thornton <[email protected]>
---
modules/structs/settings.go | 6 +++++-
routers/api/v1/settings/settings.go | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/modules/structs/settings.go b/modules/structs/settings.go
index 4a6e0ce5a..456cfb74f 100644
--- a/modules/structs/settings.go
+++ b/modules/structs/settings.go
@@ -12,5 +12,9 @@ type GeneralRepoSettings struct {
// GeneralUISettings contains global ui settings exposed by API
type GeneralUISettings struct {
- AllowedReactions []string `json:"allowed_reactions"`
+ AllowedReactions []string `json:"allowed_reactions"`
+ MaxResponseItems int `json:"max_response_items"`
+ DefaultPagingNum int `json:"default_paging_num`
+ DefaultGitTreesPerPage int `json:"default_git_trees_per_page"`
+ DefaultMaxBlobSize int64 `json:"default_max_blob_size"`
}
diff --git a/routers/api/v1/settings/settings.go b/routers/api/v1/settings/settings.go
index 8403a51d3..4bf750e19 100644
--- a/routers/api/v1/settings/settings.go
+++ b/routers/api/v1/settings/settings.go
@@ -23,7 +23,11 @@ func GetGeneralUISettings(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/GeneralUISettings"
ctx.JSON(http.StatusOK, api.GeneralUISettings{
- AllowedReactions: setting.UI.Reactions,
+ AllowedReactions: setting.UI.Reactions,
+ MaxResponseItems: setting.API.MaxResponseItems,
+ DefaultPagingNum: setting.API.DefaultPagingNum,
+ DefaultGitTreesPerPage: setting.API.DefaultGitTreesPerPage,
+ DefaultMaxBlobSize: setting.API.DefaultMaxBlobSize,
})
}
--
2.25.1 |
probably would be safe to expose all of those settings as an enemy could easily work them out? |
@zeripath not all but most |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
settings -> api.MaxResponseItems could differ from instance to instance
this makes it hard to implement a proper client pagination
The text was updated successfully, but these errors were encountered: