2022-08-28 09:43:25 +00:00
|
|
|
// Copyright 2022 The Gitea Authors. All rights reserved.
|
2022-11-27 18:20:29 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2022-08-28 09:43:25 +00:00
|
|
|
|
|
|
|
package options
|
|
|
|
|
|
|
|
import (
|
2023-04-12 10:16:45 +00:00
|
|
|
"code.gitea.io/gitea/modules/assetfs"
|
2023-03-08 09:31:27 +00:00
|
|
|
"code.gitea.io/gitea/modules/setting"
|
2022-08-28 09:43:25 +00:00
|
|
|
)
|
|
|
|
|
2023-04-12 10:16:45 +00:00
|
|
|
func CustomAssets() *assetfs.Layer {
|
|
|
|
return assetfs.Local("custom", setting.CustomPath, "options")
|
|
|
|
}
|
|
|
|
|
|
|
|
func AssetFS() *assetfs.LayeredFS {
|
|
|
|
return assetfs.Layered(CustomAssets(), BuiltinAssets())
|
|
|
|
}
|
2023-03-21 20:02:49 +00:00
|
|
|
|
2023-03-08 09:31:27 +00:00
|
|
|
// Locale reads the content of a specific locale from static/bindata or custom path.
|
|
|
|
func Locale(name string) ([]byte, error) {
|
2023-04-12 10:16:45 +00:00
|
|
|
return AssetFS().ReadFile("locale", name)
|
2023-03-08 09:31:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Readme reads the content of a specific readme from static/bindata or custom path.
|
|
|
|
func Readme(name string) ([]byte, error) {
|
2023-04-12 10:16:45 +00:00
|
|
|
return AssetFS().ReadFile("readme", name)
|
2023-03-08 09:31:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Gitignore reads the content of a gitignore locale from static/bindata or custom path.
|
|
|
|
func Gitignore(name string) ([]byte, error) {
|
2023-04-12 10:16:45 +00:00
|
|
|
return AssetFS().ReadFile("gitignore", name)
|
2023-03-08 09:31:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// License reads the content of a specific license from static/bindata or custom path.
|
|
|
|
func License(name string) ([]byte, error) {
|
2023-04-12 10:16:45 +00:00
|
|
|
return AssetFS().ReadFile("license", name)
|
2023-03-08 09:31:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Labels reads the content of a specific labels from static/bindata or custom path.
|
|
|
|
func Labels(name string) ([]byte, error) {
|
2023-04-12 10:16:45 +00:00
|
|
|
return AssetFS().ReadFile("label", name)
|
2023-03-21 20:02:49 +00:00
|
|
|
}
|