From 1b1553c41688f289c703c1124c3530564e2ecfa8 Mon Sep 17 00:00:00 2001 From: delorean Date: Tue, 16 Jan 2024 03:37:08 -0600 Subject: [PATCH] more cleanup, minor frontend fixes --- main.go | 13 +- www/index.html | 328 ++++++++++++++++++++++++++++++++----------------- 2 files changed, 218 insertions(+), 123 deletions(-) diff --git a/main.go b/main.go index 0cd727d..3c8c1da 100644 --- a/main.go +++ b/main.go @@ -215,18 +215,18 @@ func main() { log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}) LoadConf() + var err error if !Exists(conf.FileFolder) { - if err := os.Mkdir(conf.FileFolder, 0755); err != nil { + if err = os.Mkdir(conf.FileFolder, 0755); err != nil { log.Fatal().Err(err).Msg("unable to create folder") } } if !Exists(conf.DBFile) { - if _, err := os.Create(conf.DBFile); err != nil { + if _, err = os.Create(conf.DBFile); err != nil { log.Fatal().Err(err).Msg("unable to create database file") } } - - if err := landlock.V2.BestEffort().RestrictPaths( + if err = landlock.V2.BestEffort().RestrictPaths( landlock.RWDirs(conf.FileFolder), landlock.RWDirs(conf.Webroot), landlock.RWFiles(conf.DBFile), @@ -234,14 +234,13 @@ func main() { log.Warn().Err(err).Msg("could not landlock") } - if _, err := os.Open("/etc/passwd"); err != nil { + if _, err = os.Open("/etc/passwd"); err == nil { log.Warn().Msg("landlock failed, could open /etc/passwd, are you on a 5.13+ kernel?") } else { log.Info().Err(err).Msg("landlocked") } - db, err := bolt.Open(conf.DBFile, 0600, nil) - if err != nil { + if db, err = bolt.Open(conf.DBFile, 0600, nil); err != nil { log.Fatal().Err(err).Msg("unable to open database file") } db.Update(func(tx *bolt.Tx) error { diff --git a/www/index.html b/www/index.html index 8e5934e..bb8cab3 100644 --- a/www/index.html +++ b/www/index.html @@ -1,126 +1,225 @@ - + - + HARDFILES
- supernets -

curl -F file=@example.png https://hardfiles.org/

+ +

curl -F file=@example.png https://hardfiles.org/

@@ -132,29 +231,26 @@

⚠️ Uploads are erased after 24 hours

-
-
+
-

A SUPERNETS

- -

SERVICE

+

A SUPERNETS

+ +

SERVICE

- -