mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Allow normal user to upload.
This commit is contained in:
@@ -28,6 +28,12 @@ type ServerConfig struct {
|
||||
ServerDescription string `json:"server_description"`
|
||||
// SiteInfo is an article that describes the site. It will be displayed on the home page. Markdown format.
|
||||
SiteInfo string `json:"site_info"`
|
||||
// AllowNormalUserUpload indicates whether normal users are allowed to upload files.
|
||||
AllowNormalUserUpload bool `json:"allow_normal_user_upload"`
|
||||
// MaxNormalUserUploadSizeInMB is the maximum size of files that normal users can upload.
|
||||
MaxNormalUserUploadSizeInMB int `json:"max_normal_user_upload_size_in_mb"`
|
||||
// Prompt for upload page
|
||||
UploadPrompt string `json:"upload_prompt"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
@@ -42,6 +48,9 @@ func init() {
|
||||
CloudflareTurnstileSecretKey: "",
|
||||
ServerName: "Nysoure",
|
||||
ServerDescription: "Nysoure is a file sharing service.",
|
||||
AllowNormalUserUpload: true,
|
||||
MaxNormalUserUploadSizeInMB: 16,
|
||||
UploadPrompt: "You can upload your files here.",
|
||||
}
|
||||
} else {
|
||||
data, err := os.ReadFile(p)
|
||||
@@ -106,3 +115,15 @@ func CloudflareTurnstileSecretKey() string {
|
||||
func SiteInfo() string {
|
||||
return config.SiteInfo
|
||||
}
|
||||
|
||||
func AllowNormalUserUpload() bool {
|
||||
return config.AllowNormalUserUpload
|
||||
}
|
||||
|
||||
func MaxNormalUserUploadSize() int64 {
|
||||
return int64(config.MaxNormalUserUploadSizeInMB) * 1024 * 1024
|
||||
}
|
||||
|
||||
func UploadPrompt() string {
|
||||
return config.UploadPrompt
|
||||
}
|
||||
|
Reference in New Issue
Block a user