mirror of
https://github.com/Forceu/Gokapi.git
synced 2026-04-22 14:38:42 -05:00
Added Logout button #1, fixed sorting if items expire at the same second, refactored header template
This commit is contained in:
@@ -3,3 +3,4 @@ config/
|
||||
data/
|
||||
.idea/
|
||||
Gokapi
|
||||
templates_personal/
|
||||
|
||||
@@ -258,7 +258,11 @@ func (u *UploadView) convertGlobalConfig() *UploadView {
|
||||
result = append(result, element)
|
||||
}
|
||||
sort.Slice(result[:], func(i, j int) bool {
|
||||
return result[i].ExpireAt > result[j].ExpireAt
|
||||
if result[i].ExpireAt == result[j].ExpireAt {
|
||||
return result[i].Id > result[j].Id
|
||||
} else {
|
||||
return result[i].ExpireAt > result[j].ExpireAt
|
||||
}
|
||||
})
|
||||
u.Url = configuration.ServerSettings.ServerUrl + "d?id="
|
||||
u.HotlinkUrl = configuration.ServerSettings.ServerUrl + "hotlink/"
|
||||
@@ -362,4 +366,4 @@ func isValidPwCookie(r *http.Request, file filestructure.File) bool {
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
+15
-5
@@ -23,6 +23,12 @@ body {
|
||||
-moz-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
background-size: cover;
|
||||
display: -ms-flexbox;
|
||||
display: -webkit-box;
|
||||
display: flex;
|
||||
-ms-flex-pack: center;
|
||||
-webkit-box-pack: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
td {
|
||||
@@ -82,15 +88,20 @@ a:hover {
|
||||
}
|
||||
}
|
||||
|
||||
.cover-container {
|
||||
max-width: 42em;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Header
|
||||
*/
|
||||
|
||||
|
||||
.masthead {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.masthead-brand {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.nav-masthead .nav-link {
|
||||
padding: .25rem 0;
|
||||
font-weight: 700;
|
||||
@@ -113,4 +124,3 @@ a:hover {
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{{ define "admin" }}
|
||||
{{ template "header_admin" }}
|
||||
{{ template "header" . }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div id="container" class="card" style="width: 80%">
|
||||
<div class="card-body">
|
||||
<h2 class="card-title">Upload</h2>
|
||||
<h3 class="card-title">Upload</h3>
|
||||
<br>
|
||||
<p class="card-text"><form action="/upload"
|
||||
class="dropzone"
|
||||
|
||||
+28
-22
@@ -1,5 +1,4 @@
|
||||
{{define "header_top"}}
|
||||
<!doctype html>
|
||||
{{define "header"}}<!doctype html>
|
||||
<html lang="en" class="h-100">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
@@ -12,16 +11,23 @@
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
||||
<link rel="manifest" href="/site.webmanifest">
|
||||
{{end}}
|
||||
{{define "header_mid_admin"}}
|
||||
<link href="css/cover.css?v=3" rel="stylesheet">
|
||||
{{ if .IsAdminView }}
|
||||
<title>{{template "app_name"}} Admin</title>
|
||||
<link href="./assets/dist/css/dropzone.min.css" rel="stylesheet">
|
||||
<script src="./assets/dist/js/jquery.min.js"></script>
|
||||
<script src="./assets/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="./assets/dist/js/dropzone.min.js"></script>
|
||||
<script src="./assets/dist/js/clipboard.min.js"></script>
|
||||
{{end}}
|
||||
{{define "header_mid_nonadmin"}}
|
||||
<style>
|
||||
.masthead-brand {
|
||||
float: left;
|
||||
}
|
||||
.nav-masthead {
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
{{ else }}
|
||||
<title>{{template "app_name"}}</title>
|
||||
<style>
|
||||
body {
|
||||
@@ -29,28 +35,28 @@
|
||||
}
|
||||
</style>
|
||||
{{end}}
|
||||
{{define "header_bottom"}}
|
||||
<link href="css/cover.css?v=2" rel="stylesheet">
|
||||
</head>
|
||||
<body class="d-flex h-100 text-center text-white bg-dark">
|
||||
<div class="d-flex w-100 h-100 p-3 mx-auto flex-column">
|
||||
{{ if .IsAdminView }}
|
||||
<div class="d-flex w-100 h-100 p-3 mx-auto flex-column">
|
||||
<header class="masthead mb-auto">
|
||||
<div style="max-width: 80em; margin: 0 auto;" class="inner">
|
||||
<h1>{{template "app_name"}}</h1>
|
||||
<nav class="nav nav-masthead justify-content-center">
|
||||
<a class="nav-link active" href="#">Upload</a>
|
||||
<a class="nav-link" href="./logout">Logout</a>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
<main style="margin-top: 2rem">
|
||||
{{ else }}
|
||||
<div class="d-flex w-100 h-100 p-3 mx-auto flex-column">
|
||||
<header class="mb-auto">
|
||||
<div>
|
||||
<h1><a href="/" style="text-decoration: none;display: block;">{{template "app_name"}}</a></h1>
|
||||
<h1><a href="/index" style="text-decoration: none;display: block;">{{template "app_name"}}</a></h1>
|
||||
</div>
|
||||
</header>
|
||||
<main>
|
||||
{{ end }}
|
||||
{{end}}
|
||||
|
||||
{{define "header"}}
|
||||
{{template "header_top"}}
|
||||
{{template "header_mid_nonadmin"}}
|
||||
{{template "header_bottom"}}
|
||||
{{end}}
|
||||
|
||||
|
||||
{{define "header_admin"}}
|
||||
{{template "header_top"}}
|
||||
{{template "header_mid_admin"}}
|
||||
{{template "header_bottom"}}
|
||||
{{end}}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{{define "index"}}
|
||||
<head><meta http-equiv="Refresh" content="0; URL={{.}}"></head>
|
||||
<head><meta http-equiv="Refresh" content="0; URL={{.RedirectUrl}}"></head>
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user