more cleanup, minor frontend fixes
This commit is contained in:
parent
09fab10c7a
commit
1b1553c416
13
main.go
13
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 {
|
||||
|
144
www/index.html
144
www/index.html
@ -10,6 +10,7 @@
|
||||
font-family: sans-serif;
|
||||
background-image: url('https://media.tenor.com/fYnd0R6F-0UAAAAC/gun-revolver.gif');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
@ -39,12 +40,15 @@
|
||||
.hf {
|
||||
font-size: 3rem;
|
||||
}
|
||||
|
||||
.hflogo {
|
||||
width: 50% !important;
|
||||
}
|
||||
}
|
||||
@media (min-width: 992px) {
|
||||
.container {
|
||||
width: 970px;
|
||||
}
|
||||
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
.container {
|
||||
@ -57,19 +61,108 @@
|
||||
input,select {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
.file-upload{display:block;text-align:center;font-family: Helvetica, Arial, sans-serif;font-size: 12px; width: 300px;}
|
||||
.file-upload .file-select{display:block;border: 2px solid #dce4ec;color: black;cursor:pointer;height:40px;line-height:40px;text-align:left;background:#FFFFFF;overflow:hidden;position:relative;}
|
||||
.file-upload .file-select .file-select-button{background:#dce4ec;padding:0 10px;display:inline-block;height:40px;line-height:40px;}
|
||||
.file-upload .file-select .file-select-name{line-height:40px;display:inline-block;padding:0 10px;}
|
||||
.file-upload .file-select:hover{border-color:red;transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;}
|
||||
.file-upload .file-select:hover .file-select-button{background:red;color:#FFFFFF;transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;}
|
||||
.file-upload.active .file-select{border-color:red;transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;}
|
||||
.file-upload.active .file-select .file-select-button{background:red;color:#FFFFFF;transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;}
|
||||
.file-upload .file-select input[type=file]{z-index:100;cursor:pointer;position:absolute;height:100%;width:100%;top:0;left:0;opacity:0;filter:alpha(opacity=0);}
|
||||
.file-upload .file-select.file-select-disabled{opacity:0.65;}
|
||||
.file-upload .file-select.file-select-disabled:hover{cursor:default;display:block;border: 2px solid #dce4ec;color: red;cursor:pointer;height:40px;line-height:40px;margin-top:5px;text-align:left;background:#FFFFFF;overflow:hidden;position:relative;}
|
||||
.file-upload .file-select.file-select-disabled:hover .file-select-button{background:#dce4ec;color:#666666;padding:0 10px;display:inline-block;height:40px;line-height:40px;}
|
||||
.file-upload .file-select.file-select-disabled:hover .file-select-name{line-height:40px;display:inline-block;padding:0 10px;}
|
||||
.file-upload{
|
||||
display:block;
|
||||
text-align:center;
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
width: 300px;
|
||||
}
|
||||
.file-upload .file-select{
|
||||
display:block;
|
||||
border: 2px solid #dce4ec;
|
||||
color: black;
|
||||
cursor:pointer;
|
||||
height:40px;
|
||||
line-height:40px;
|
||||
text-align:left;
|
||||
background:#FFFFFF;
|
||||
overflow:hidden;
|
||||
position:relative;
|
||||
}
|
||||
.file-upload .file-select .file-select-button{
|
||||
background:#dce4ec;
|
||||
padding:0 10px;
|
||||
display:inline-block;
|
||||
height:40px;
|
||||
line-height:40px;
|
||||
}
|
||||
.file-upload .file-select .file-select-name{
|
||||
line-height:40px;
|
||||
display:inline-block;
|
||||
padding:0 10px;
|
||||
}
|
||||
.file-upload .file-select:hover{
|
||||
border-color:red;
|
||||
transition:all .2s ease-in-out;
|
||||
-moz-transition:all .2s ease-in-out;
|
||||
-webkit-transition:all .2s ease-in-out;
|
||||
-o-transition:all .2s ease-in-out;
|
||||
}
|
||||
.file-upload .file-select:hover .file-select-button{
|
||||
background:red;
|
||||
color:#FFFFFF;
|
||||
transition:all .2s ease-in-out;
|
||||
-moz-transition:all .2s ease-in-out;
|
||||
-webkit-transition:all .2s ease-in-out;
|
||||
-o-transition:all .2s ease-in-out;
|
||||
}
|
||||
.file-upload.active .file-select{
|
||||
border-color:red;
|
||||
transition:all .2s ease-in-out;
|
||||
-moz-transition:all .2s ease-in-out;
|
||||
-webkit-transition:all .2s ease-in-out;
|
||||
-o-transition:all .2s ease-in-out;
|
||||
}
|
||||
.file-upload.active .file-select .file-select-button{
|
||||
background:red;
|
||||
color:#FFFFFF;
|
||||
transition:all .2s ease-in-out;
|
||||
-moz-transition:all .2s ease-in-out;
|
||||
-webkit-transition:all .2s ease-in-out;
|
||||
-o-transition:all .2s ease-in-out;
|
||||
}
|
||||
.file-upload .file-select input[type=file]{
|
||||
z-index:100;
|
||||
cursor:pointer;
|
||||
position:absolute;
|
||||
height:100%;
|
||||
width:100%;
|
||||
top:0;
|
||||
left:0;
|
||||
opacity:0;
|
||||
filter:alpha(opacity=0);
|
||||
}
|
||||
.file-upload .file-select.file-select-disabled{
|
||||
opacity:0.65;
|
||||
}
|
||||
.file-upload .file-select.file-select-disabled:hover{
|
||||
cursor:default;
|
||||
display:block;
|
||||
border: 2px solid #dce4ec;
|
||||
color: red;
|
||||
cursor:pointer;
|
||||
height:40px;
|
||||
line-height:40px;
|
||||
margin-top:5px;
|
||||
text-align:left;
|
||||
background:#FFFFFF;
|
||||
overflow:hidden;
|
||||
position:relative;
|
||||
}
|
||||
.file-upload .file-select.file-select-disabled:hover .file-select-button{
|
||||
background:#dce4ec;
|
||||
color:#666666;
|
||||
padding:0 10px;
|
||||
display:inline-block;
|
||||
height:40px;
|
||||
line-height:40px;
|
||||
}
|
||||
.file-upload .file-select.file-select-disabled:hover .file-select-name{
|
||||
line-height:40px;
|
||||
display:inline-block;
|
||||
padding:0 10px;
|
||||
}
|
||||
.subform {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@ -90,9 +183,12 @@
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
|
||||
-moz-box-sizing: border-box; /* Firefox, other Gecko */
|
||||
box-sizing: border-box; /* Opera/IE 8+ */
|
||||
-webkit-box-sizing: border-box;
|
||||
/* Safari/Chrome, other WebKit */
|
||||
-moz-box-sizing: border-box;
|
||||
/* Firefox, other Gecko */
|
||||
box-sizing: border-box;
|
||||
/* Opera/IE 8+ */
|
||||
-webkit-font-smoothing:antialiased;
|
||||
-webkit-text-size-adjust:none;
|
||||
box-shadow: 0 1px 2px rgba(0,0,0,.15);
|
||||
@ -115,12 +211,15 @@
|
||||
background: red;
|
||||
color: #fff;
|
||||
}
|
||||
.hflogo {
|
||||
width: 90%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<img src="header.png" width="50%" alt="supernets" style="margin-top: 10rem;">
|
||||
<h2 style="font-size: 1em; color: #ffffff; font-weight: 200;">curl -F file=@example.png https://hardfiles.org/</h1>
|
||||
<img src="header.png" class="hflogo" alt="supernets" style="margin-top: 10rem;">
|
||||
<h2 style="font-size: 1rem; color: #ffffff; font-weight: 200;">curl -F file=@example.png https://hardfiles.org/</h1>
|
||||
<form method="POST" class="subform" enctype="multipart/form-data">
|
||||
<div class="file-upload" style="display: flex; justify-content: center; width: 25rem;">
|
||||
<div class="file-select" style="width: 100%;">
|
||||
@ -132,7 +231,6 @@
|
||||
</div>
|
||||
</form>
|
||||
<p style="color: white; font-weight: 300;">⚠️ Uploads are erased after 24 hours</p>
|
||||
|
||||
</div>
|
||||
<div style="position: relative;">
|
||||
<a href="https://supernets.org/" target="_blank" style="position: absolute; bottom: 10px; right:10px; display: flex; align-items: center; text-decoration: none;">
|
||||
@ -143,9 +241,8 @@
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<script>
|
||||
$('#chooseFile').bind('change', function () {
|
||||
$('#chooseFile').bind('change', function () {
|
||||
var filename = $("#chooseFile").val();
|
||||
if (/^\s*$/.test(filename)) {
|
||||
$(".file-upload").removeClass('active');
|
||||
@ -155,6 +252,5 @@ $('#chooseFile').bind('change', function () {
|
||||
$(".file-upload").addClass('active');
|
||||
$("#noFile").text(filename.replace("C:\\fakepath\\", ""));
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user