declaring 1.3.0
Package Release Number better licence image Shrunk image Fixed size MASCOT UPDATE fixed CSS and Added Mascot to main site allows Enter to Register/Login changed jpeg cover quality from 70 to 85 Wink over form more CSS fixes linked wiki corrected Readme Reviewed-on: #8 Co-authored-by: riomoo <alister@kamikishi.net> Co-committed-by: riomoo <alister@kamikishi.net> removed ico from LFS fixing ico Reviewed-on: #9 Co-authored-by: riomoo <alister@kamikishi.net> Co-committed-by: riomoo <alister@kamikishi.net> fixing lfs Reviewed-on: #10 Co-authored-by: riomoo <alister@kamikishi.net> Co-committed-by: riomoo <alister@kamikishi.net>
This commit is contained in:
parent
05a1723805
commit
f0efc83cf6
13 changed files with 111 additions and 38 deletions
|
|
@ -21,6 +21,7 @@ import (
|
|||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
"io/fs"
|
||||
"sync"
|
||||
"time"
|
||||
"runtime"
|
||||
|
|
@ -39,6 +40,9 @@ import (
|
|||
//go:embed templates/index.html
|
||||
var templateFS embed.FS
|
||||
|
||||
//go:embed all:static
|
||||
var staticFS embed.FS
|
||||
|
||||
// ComicInfo represents the standard ComicInfo.xml metadata
|
||||
type ComicInfo struct {
|
||||
XMLName xml.Name `xml:"ComicInfo"`
|
||||
|
|
@ -135,6 +139,14 @@ func main() {
|
|||
|
||||
loadUsers()
|
||||
initWatchFolders()
|
||||
// Create static sub-filesystem once
|
||||
staticSubFS, err := fs.Sub(staticFS, "static")
|
||||
if err != nil {
|
||||
log.Fatal(fmt.Errorf("failed to create static sub-filesystem: %w", err))
|
||||
}
|
||||
|
||||
// Create handlers once and reuse
|
||||
staticHandler := http.FileServer(http.FS(staticSubFS))
|
||||
|
||||
http.HandleFunc("/api/register", handleRegister)
|
||||
http.HandleFunc("/api/login", handleLogin)
|
||||
|
|
@ -154,6 +166,7 @@ func main() {
|
|||
http.HandleFunc("/api/admin/delete-comic/", authMiddleware(handleDeleteComic))
|
||||
http.HandleFunc("/api/watch-folder", authMiddleware(handleWatchFolder))
|
||||
http.HandleFunc("/", serveUI)
|
||||
http.Handle("/static/", http.StripPrefix("/static/", staticHandler))
|
||||
|
||||
go func() {
|
||||
for {
|
||||
|
|
@ -1599,7 +1612,7 @@ func saveJPEG(img image.Image, path string) error {
|
|||
defer out.Close()
|
||||
|
||||
// Lower quality = smaller memory footprint during encoding
|
||||
err = jpeg.Encode(out, img, &jpeg.Options{Quality: 70})
|
||||
err = jpeg.Encode(out, img, &jpeg.Options{Quality: 85})
|
||||
img = nil
|
||||
|
||||
runtime.GC()
|
||||
|
|
@ -1643,7 +1656,7 @@ func handleTags(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
if req.Color == "" {
|
||||
req.Color = "#1f6feb"
|
||||
req.Color = "#446B6E"
|
||||
}
|
||||
|
||||
tagsMutex.Lock()
|
||||
|
|
@ -1832,7 +1845,7 @@ func handleTryKnownPasswords(w http.ResponseWriter, r *http.Request) {
|
|||
tagData.Count++
|
||||
tags[tag] = tagData
|
||||
} else {
|
||||
tags[tag] = Tag{Name: tag, Color: "#1f6feb", Count: 1}
|
||||
tags[tag] = Tag{Name: tag, Color: "#446B6E", Count: 1}
|
||||
}
|
||||
}
|
||||
tagsMutex.Unlock()
|
||||
|
|
@ -1947,7 +1960,7 @@ func handleSetPassword(w http.ResponseWriter, r *http.Request) {
|
|||
tagData.Count++
|
||||
tags[tag] = tagData
|
||||
} else {
|
||||
tags[tag] = Tag{Name: tag, Color: "#1f6feb", Count: 1}
|
||||
tags[tag] = Tag{Name: tag, Color: "#446B6E", Count: 1}
|
||||
}
|
||||
}
|
||||
tagsMutex.Unlock()
|
||||
|
|
@ -2419,7 +2432,7 @@ func processComic(filePath, filename string, modTime time.Time) Comic {
|
|||
tagData.Count++
|
||||
tags[tag] = tagData
|
||||
} else {
|
||||
tags[tag] = Tag{Name: tag, Color: "#1f6feb", Count: 1}
|
||||
tags[tag] = Tag{Name: tag, Color: "#446B6E", Count: 1}
|
||||
}
|
||||
}
|
||||
tagsMutex.Unlock()
|
||||
|
|
@ -2481,7 +2494,7 @@ func loadComicMetadataLazy(comicID string) error {
|
|||
tagData.Count++
|
||||
tags[tag] = tagData
|
||||
} else {
|
||||
tags[tag] = Tag{Name: tag, Color: "#1f6feb", Count: 1}
|
||||
tags[tag] = Tag{Name: tag, Color: "#446B6E", Count: 1}
|
||||
}
|
||||
}
|
||||
tagsMutex.Unlock()
|
||||
|
|
|
|||
BIN
app/gopherbook/static/images/favicon/favicon.ico
Normal file
BIN
app/gopherbook/static/images/favicon/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 433 KiB |
BIN
app/gopherbook/static/images/pngs/CutePose2.png
Normal file
BIN
app/gopherbook/static/images/pngs/CutePose2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 327 KiB |
BIN
app/gopherbook/static/images/pngs/LogoPose2.png
Normal file
BIN
app/gopherbook/static/images/pngs/LogoPose2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 252 KiB |
|
|
@ -3,6 +3,7 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="/static/images/favicon/favicon.ico" rel="shortcut icon" type="image/x-icon">
|
||||
<title>Gopherbook</title>
|
||||
<style>
|
||||
* {
|
||||
|
|
@ -27,7 +28,7 @@
|
|||
header {
|
||||
background: #395E62;
|
||||
border-bottom: 1px solid #314C52;
|
||||
padding: 20px 0;
|
||||
padding: 10px 0;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
|
|
@ -43,6 +44,8 @@
|
|||
h1 {
|
||||
color: #1b1e2c;
|
||||
font-size: 24px;
|
||||
padding: 20px 10px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.auth-section {
|
||||
|
|
@ -243,7 +246,7 @@
|
|||
|
||||
.comic-artist {
|
||||
display: inline-block;
|
||||
background: #1f6feb;
|
||||
background: #446B6E;
|
||||
color: white;
|
||||
padding: 2px 8px;
|
||||
border-radius: 12px;
|
||||
|
|
@ -275,10 +278,18 @@
|
|||
width: auto;
|
||||
}
|
||||
|
||||
.tab:hover {
|
||||
color: #1b1e2c;
|
||||
}
|
||||
|
||||
.tab.active {
|
||||
color: #395E62;
|
||||
border-bottom-color: #395E62;
|
||||
}
|
||||
.tab.active:hover {
|
||||
color: #1b1e2c;
|
||||
border-bottom-color: #395E62;
|
||||
}
|
||||
|
||||
.message {
|
||||
padding: 12px;
|
||||
|
|
@ -334,7 +345,7 @@
|
|||
}
|
||||
|
||||
.bookmark-indicator {
|
||||
color: #f0883e;
|
||||
color: #395E62;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
@ -345,7 +356,7 @@
|
|||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
background: #f0883e;
|
||||
background: #395E62;
|
||||
color: white;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
|
|
@ -370,7 +381,7 @@
|
|||
}
|
||||
|
||||
.bookmark-list-title {
|
||||
color: #f0883e;
|
||||
color: #395E62;
|
||||
font-weight: 600;
|
||||
margin-bottom: 8px;
|
||||
font-size: 14px;
|
||||
|
|
@ -394,8 +405,7 @@
|
|||
}
|
||||
|
||||
.bookmark-list-item.current {
|
||||
border-color: #f0883e;
|
||||
background: rgba(240, 136, 62, 0.1);
|
||||
border-color: #395E62;
|
||||
}
|
||||
|
||||
.bookmark-delete {
|
||||
|
|
@ -539,7 +549,7 @@
|
|||
}
|
||||
|
||||
.modal-title {
|
||||
color: #58a6ff;
|
||||
color: #446B6E;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
|
@ -667,7 +677,7 @@
|
|||
}
|
||||
|
||||
.password-modal-title {
|
||||
color: #58a6ff;
|
||||
color: #446B6E;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 8px;
|
||||
|
|
@ -701,7 +711,7 @@
|
|||
|
||||
.password-input-group input:focus {
|
||||
outline: none;
|
||||
border-color: #58a6ff;
|
||||
border-color: #446B6E;
|
||||
}
|
||||
|
||||
.password-modal-buttons {
|
||||
|
|
@ -726,16 +736,22 @@
|
|||
<body>
|
||||
<header>
|
||||
<div class="header-content">
|
||||
<h1>Gopherbook</h1>
|
||||
<div id="userInfo" class="hidden">
|
||||
<button onclick="logout()" class="secondary-btn" style="width: auto; padding: 8px 16px;">Logout</button>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
<img src="/static/images/pngs/CutePose2.png" alt="on book" width="67px" height="75px">
|
||||
<h1>Gopherbook</h1>
|
||||
</div>
|
||||
<div id="userInfo" class="hidden">
|
||||
<button onclick="logout()" class="secondary-btn" style="width: auto; padding: 8px 16px;">Logout</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="container">
|
||||
<div id="authSection" class="auth-section">
|
||||
<div id="authMessage" class="message hidden"></div>
|
||||
<div style="display: flex; justify-content: center; margin: 0px 10px 20px 10px;">
|
||||
<img src="/static/images/pngs/LogoPose2.png" alt="wink" style="width: 100px; height auto;">
|
||||
</div>
|
||||
<div class="tabs">
|
||||
<button class="tab active" onclick="showTab('login')">Login</button>
|
||||
<button class="tab" onclick="showTab('register')">Register</button>
|
||||
|
|
@ -859,7 +875,7 @@
|
|||
<h4 style="font-size: 14px; color: #8b949e; margin-bottom: 12px;">Create New Tag</h4>
|
||||
<div class="add-tag-form">
|
||||
<input type="text" id="newTagName" class="add-tag-input" placeholder="Tag name">
|
||||
<input type="color" id="newTagColor" class="color-picker" value="#1f6feb">
|
||||
<input type="color" id="newTagColor" class="color-picker" value="#446B6E">
|
||||
<button onclick="createTag()" style="width: auto; padding: 8px 16px;">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1052,7 +1068,7 @@
|
|||
|
||||
selectedTags.forEach(function(tagName) {
|
||||
var tag = allTags.find(function(t) { return t.name === tagName; });
|
||||
var color = tag ? tag.color : '#1f6feb';
|
||||
var color = tag ? tag.color : '#446B6E';
|
||||
var filter = document.createElement('div');
|
||||
filter.className = 'tag-filter';
|
||||
filter.style.background = color;
|
||||
|
|
@ -1200,7 +1216,7 @@
|
|||
tagsHTML = '<div class="comic-tags">';
|
||||
comic.tags.forEach(tagName => {
|
||||
const tag = allTags.find(t => t.name === tagName);
|
||||
const color = tag ? tag.color : '#1f6feb';
|
||||
const color = tag ? tag.color : '#446B6E';
|
||||
tagsHTML += '<span class="comic-tag" style="background: ' + color + '">' + tagName + '</span>';
|
||||
});
|
||||
tagsHTML += '</div>';
|
||||
|
|
@ -1279,7 +1295,7 @@
|
|||
|
||||
managingComic.tags.forEach(tagName => {
|
||||
const tag = allTags.find(t => t.name === tagName);
|
||||
const color = tag ? tag.color : '#1f6feb';
|
||||
const color = tag ? tag.color : '#446B6E';
|
||||
|
||||
const item = document.createElement('div');
|
||||
item.className = 'tag-item';
|
||||
|
|
@ -1367,7 +1383,7 @@
|
|||
|
||||
if (res.ok) {
|
||||
document.getElementById('newTagName').value = '';
|
||||
document.getElementById('newTagColor').value = '#1f6feb';
|
||||
document.getElementById('newTagColor').value = '#446B6E';
|
||||
loadTags();
|
||||
renderAvailableTags();
|
||||
showMessage('Tag created!', 'success');
|
||||
|
|
@ -1986,6 +2002,30 @@
|
|||
.catch(function(err) {
|
||||
console.error('Initial comics fetch failed:', err);
|
||||
});
|
||||
|
||||
// Add Enter key support for login form
|
||||
document.getElementById('loginUsername').addEventListener('keypress', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
login();
|
||||
}
|
||||
});
|
||||
document.getElementById('loginPassword').addEventListener('keypress', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
login();
|
||||
}
|
||||
});
|
||||
|
||||
// Add Enter key support for register form
|
||||
document.getElementById('regUsername').addEventListener('keypress', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
register();
|
||||
}
|
||||
});
|
||||
document.getElementById('regPassword').addEventListener('keypress', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
register();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue