package routes import ( "gifuu/tools" "net/http" ) const ( REPORT_REASON_EXPLICIT = 0 // Sexual, Nudity, or Fetish Content REPORT_REASON_HARASSMENT = 1 // Targeted Harassment or Hate Speech REPORT_REASON_VIOLENCE = 2 // Violence, Gore, or Abuse REPORT_REASON_SPAM = 3 // Spam, Advertising, or Solicitation REPORT_REASON_HARMFUL = 4 // Seizure-Inducing, Self-Harm, or Dangerous Content REPORT_REASON_ILLEGAL = 5 // Illegal Content (CSAM, Threats, etc.) ) type normalizerItem struct { Match string `json:"match"` Replace string `json:"replace"` Comment string `json:"comment"` } var cachedLimitsJSON []byte var cachedLimitsGZIP []byte func init() { json, gzip, err := tools.PrepareStaticJSON(map[string]any{ "upload": map[string]any{ "input_width_min": MEDIA_MIN_WIDTH, "input_height_min": MEDIA_MIN_HEIGHT, "video_width_max": VIDEO_MAX_WIDTH, "video_height_max": VIDEO_MAX_HEIGHT, "image_width_max": IMAGE_MAX_WIDTH, "image_height_max": IMAGE_MAX_HEIGHT, "duration": MEDIA_MAX_DURATION, "filesize": tools.LIMIT_FILE, "mime_types": tools.LIMIT_MIME_TYPE, }, "title": map[string]any{ "normalizers": []normalizerItem{ { /**/ `^\s+` /*---*/, `` /**/, "Trim Left"}, { /**/ `\s+$` /*---*/, `` /**/, "Trim Right"}, { /**/ `\s{2,}` /**/, ` ` /**/, "Regulate Excessive Spaces"}, }, "matcher": `^[\S\s]{1,80}$`, "max_length": 80, "min_length": 1, }, "tag": map[string]any{ "normalizers": []normalizerItem{ { /**/ `^_+` /*-*/, `` /*-*/, "Trim Left Underscores"}, { /**/ `_+$` /*-*/, `` /*-*/, "Trim Right Underscores"}, { /**/ `_+` /*--*/, `_` /**/, "Regulate Excessive Underscores"}, }, "matcher": `^[\p{L}\p{N}_]{1,32}$`, "max_length": 32, "min_length": 1, }, "comment": map[string]any{ "normalizers": []normalizerItem{ { /**/ `^\s+` /*--*/, `` /*--*/, "Trim Left Spaces"}, { /**/ `\s+$` /*--*/, `` /*--*/, "Trim Right Spaces"}, { /**/ `\n{2,}` /**/, `\n` /**/, "Regulate Excessive Newlines"}, }, "matcher": `^[\S\s]{10,240}$`, "max_length": 240, "min_length": 10, }, "report": map[string]any{ "values": []any{ map[string]any{ "id": REPORT_REASON_EXPLICIT, "title": "EXPLICIT", "description": "Sexual, Nudity, or Fetish Content"}, map[string]any{ "id": REPORT_REASON_HARASSMENT, "title": "HARASSMENT", "description": "Targeted Harassment or Hate Speech"}, map[string]any{ "id": REPORT_REASON_VIOLENCE, "title": "VIOLENCE", "description": "Violence, Gore, or Abuse"}, map[string]any{ "id": REPORT_REASON_SPAM, "title": "SPAM", "description": "Spam, Advertising, or Solicitation"}, map[string]any{ "id": REPORT_REASON_HARMFUL, "title": "HARMFUL", "description": "Seizure-Inducing, Self-Harm, or Dangerous Content"}, map[string]any{ "id": REPORT_REASON_ILLEGAL, "title": "ILLEGAL", "description": "Illegal Content (CSAM, Threats, etc.)"}, }, "normalizers": []normalizerItem{ { /**/ `^\s+` /*--*/, `` /*--*/, "Trim Left Spaces"}, { /**/ `\s+$` /*--*/, `` /*--*/, "Trim Right Spaces"}, { /**/ `\n{2,}` /**/, `\n` /**/, "Regulate Excessive Newlines"}, }, "matcher": `^[\S\s]{10,240}$`, "max_length": 240, "min_length": 10, }, }) if err != nil { panic(err) } cachedLimitsJSON = json cachedLimitsGZIP = gzip } func GET_Limits(w http.ResponseWriter, r *http.Request) { tools.SendStaticJSON(w, r, http.StatusOK, cachedLimitsJSON, cachedLimitsGZIP) }