2020-06-04 14:46:53 +05:30
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
2022-11-27 23:50:29 +05:30
|
|
|
// SPDX-License-Identifier: MIT
|
2020-06-04 14:46:53 +05:30
|
|
|
|
2020-06-22 23:51:31 +05:30
|
|
|
package settings
|
2020-06-04 14:46:53 +05:30
|
|
|
|
|
|
|
import (
|
2020-06-04 23:36:24 +05:30
|
|
|
"net/http"
|
|
|
|
|
2020-06-04 14:46:53 +05:30
|
|
|
"code.gitea.io/gitea/modules/context"
|
|
|
|
"code.gitea.io/gitea/modules/setting"
|
2020-06-10 17:35:46 +05:30
|
|
|
api "code.gitea.io/gitea/modules/structs"
|
2020-06-04 14:46:53 +05:30
|
|
|
)
|
|
|
|
|
2020-06-22 23:51:31 +05:30
|
|
|
// GetGeneralUISettings returns instance's global settings for ui
|
|
|
|
func GetGeneralUISettings(ctx *context.APIContext) {
|
|
|
|
// swagger:operation GET /settings/ui settings getGeneralUISettings
|
2020-06-04 14:46:53 +05:30
|
|
|
// ---
|
2020-06-22 23:51:31 +05:30
|
|
|
// summary: Get instance's global settings for ui
|
2020-06-04 14:46:53 +05:30
|
|
|
// produces:
|
|
|
|
// - application/json
|
|
|
|
// responses:
|
|
|
|
// "200":
|
2020-06-22 23:51:31 +05:30
|
|
|
// "$ref": "#/responses/GeneralUISettings"
|
|
|
|
ctx.JSON(http.StatusOK, api.GeneralUISettings{
|
2020-12-03 18:23:21 +05:30
|
|
|
DefaultTheme: setting.UI.DefaultTheme,
|
2020-06-22 23:51:31 +05:30
|
|
|
AllowedReactions: setting.UI.Reactions,
|
2021-06-29 19:58:38 +05:30
|
|
|
CustomEmojis: setting.UI.CustomEmojis,
|
2020-06-22 23:51:31 +05:30
|
|
|
})
|
2020-06-04 14:46:53 +05:30
|
|
|
}
|
2020-06-10 17:35:46 +05:30
|
|
|
|
2020-09-04 23:40:15 +05:30
|
|
|
// GetGeneralAPISettings returns instance's global settings for api
|
|
|
|
func GetGeneralAPISettings(ctx *context.APIContext) {
|
|
|
|
// swagger:operation GET /settings/api settings getGeneralAPISettings
|
|
|
|
// ---
|
|
|
|
// summary: Get instance's global settings for api
|
|
|
|
// produces:
|
|
|
|
// - application/json
|
|
|
|
// responses:
|
|
|
|
// "200":
|
|
|
|
// "$ref": "#/responses/GeneralAPISettings"
|
|
|
|
ctx.JSON(http.StatusOK, api.GeneralAPISettings{
|
|
|
|
MaxResponseItems: setting.API.MaxResponseItems,
|
|
|
|
DefaultPagingNum: setting.API.DefaultPagingNum,
|
|
|
|
DefaultGitTreesPerPage: setting.API.DefaultGitTreesPerPage,
|
|
|
|
DefaultMaxBlobSize: setting.API.DefaultMaxBlobSize,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-06-10 17:35:46 +05:30
|
|
|
// GetGeneralRepoSettings returns instance's global settings for repositories
|
|
|
|
func GetGeneralRepoSettings(ctx *context.APIContext) {
|
2020-06-22 23:51:31 +05:30
|
|
|
// swagger:operation GET /settings/repository settings getGeneralRepositorySettings
|
2020-06-10 17:35:46 +05:30
|
|
|
// ---
|
|
|
|
// summary: Get instance's global settings for repositories
|
|
|
|
// produces:
|
|
|
|
// - application/json
|
|
|
|
// responses:
|
|
|
|
// "200":
|
|
|
|
// "$ref": "#/responses/GeneralRepoSettings"
|
|
|
|
ctx.JSON(http.StatusOK, api.GeneralRepoSettings{
|
2021-09-07 21:19:36 +05:30
|
|
|
MirrorsDisabled: !setting.Mirror.Enabled,
|
2021-02-20 15:47:51 +05:30
|
|
|
HTTPGitDisabled: setting.Repository.DisableHTTPGit,
|
|
|
|
MigrationsDisabled: setting.Repository.DisableMigrations,
|
2021-04-15 22:23:57 +05:30
|
|
|
StarsDisabled: setting.Repository.DisableStars,
|
2024-02-25 16:28:23 +05:30
|
|
|
ForksDisabled: setting.Repository.DisableForks,
|
2021-02-20 15:47:51 +05:30
|
|
|
TimeTrackingDisabled: !setting.Service.EnableTimetracking,
|
|
|
|
LFSDisabled: !setting.LFS.StartServer,
|
2020-06-10 17:35:46 +05:30
|
|
|
})
|
|
|
|
}
|
2020-09-05 13:13:06 +05:30
|
|
|
|
|
|
|
// GetGeneralAttachmentSettings returns instance's global settings for Attachment
|
|
|
|
func GetGeneralAttachmentSettings(ctx *context.APIContext) {
|
2020-10-06 21:46:16 +05:30
|
|
|
// swagger:operation GET /settings/attachment settings getGeneralAttachmentSettings
|
2020-09-05 13:13:06 +05:30
|
|
|
// ---
|
|
|
|
// summary: Get instance's global settings for Attachment
|
|
|
|
// produces:
|
|
|
|
// - application/json
|
|
|
|
// responses:
|
|
|
|
// "200":
|
|
|
|
// "$ref": "#/responses/GeneralAttachmentSettings"
|
|
|
|
ctx.JSON(http.StatusOK, api.GeneralAttachmentSettings{
|
|
|
|
Enabled: setting.Attachment.Enabled,
|
|
|
|
AllowedTypes: setting.Attachment.AllowedTypes,
|
|
|
|
MaxFiles: setting.Attachment.MaxFiles,
|
|
|
|
MaxSize: setting.Attachment.MaxSize,
|
|
|
|
})
|
|
|
|
}
|