reports!!!! and PoW!!!!!!!
this has taken quite a while (8 ish hours) but reports and proof of work challenges are completely implemented the proof of work challenges are bit iffy and could be gpu accelerated which is bad, so i plan to eventually switch to something memory hard like argon2id references used for pow: https://dev.to/ratmd/simple-proof-of-work-in-javascript-3kgm https://anubis.techaro.lol/docs/design/how-anubis-works https://anubis.techaro.lol/docs/design/why-proof-of-work as well as some other posts or repos found when searching
This commit is contained in:
@@ -17,6 +17,8 @@ type Config struct {
|
||||
Expiries []Expiry
|
||||
NormalizeMIMETypes bool
|
||||
BannedMIMETypes []string
|
||||
PoWDifficulty int
|
||||
ReportOptions []string
|
||||
|
||||
DatabasePath string
|
||||
// public host like "https://bin.zip", NOT the address minbin listens on
|
||||
@@ -58,6 +60,19 @@ func loadConfig() (Config, error) {
|
||||
expiries = append(expiries, expiry)
|
||||
}
|
||||
|
||||
powDifficultySetting := envOrDefault("MINIBIN_POW_DIFFICULTY", "18")
|
||||
powDifficulty, err := strconv.Atoi(powDifficultySetting)
|
||||
if err != nil {
|
||||
return Config{}, fmt.Errorf("failed to parse MINIBIN_POW_DIFFICULTY")
|
||||
}
|
||||
reportOptionsSetting := envOrDefault("MINIBIN_REPORT_OPTIONS", "Malware (including links),CSAM/CSEM,Copyright Infringement,Fraud")
|
||||
reportOptions := strings.Split(reportOptionsSetting, ",")
|
||||
if len(reportOptions) == 0 {
|
||||
return Config{}, fmt.Errorf("no valid report options set")
|
||||
}
|
||||
|
||||
log.Println(len(reportOptions))
|
||||
|
||||
return Config{
|
||||
UploadDir: envOrDefault("MINIBIN_UPLOAD_DIR", "uploads"),
|
||||
MaxPasteBytes: maxPasteKiB * 1024,
|
||||
@@ -65,6 +80,8 @@ func loadConfig() (Config, error) {
|
||||
Expiries: expiries,
|
||||
NormalizeMIMETypes: envOrDefault("MINIBIN_NORMALIZE_MIME_TYPES", "true") == "true",
|
||||
BannedMIMETypes: strings.Split(envOrDefault("MINIBIN_BANNED_MIME_TYPES", ""), ","),
|
||||
PoWDifficulty: powDifficulty,
|
||||
ReportOptions: reportOptions,
|
||||
|
||||
DatabasePath: envOrDefault("MINIBIN_DATABASE_PATH", "minibin.sqlite"),
|
||||
Host: envOrDefault("MINIBIN_HOST", "http://localhost:8080"),
|
||||
|
||||
Reference in New Issue
Block a user