mirror of
https://github.com/hkalexling/Mango.git
synced 2026-05-01 00:00:55 -04:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bec257c99f | |||
| f2df493d79 | |||
| b74f61c025 | |||
| c76c287e66 | |||
| 8e7eaa680a | |||
| 30cdb3ec8f | |||
| 9c367e7d35 | |||
| d2f95e5970 | |||
| 82bcd03f15 | |||
| fe799f30c8 | |||
| 54123917af |
@@ -1,3 +1,4 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
patreon: hkalexling
|
||||
ko_fi: hkalexling
|
||||
|
||||
@@ -50,7 +50,7 @@ The official docker images are available on [Dockerhub](https://hub.docker.com/r
|
||||
### CLI
|
||||
|
||||
```
|
||||
Mango - Manga Server and Web Reader. Version 0.5.0
|
||||
Mango - Manga Server and Web Reader. Version 0.5.2
|
||||
|
||||
Usage:
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: mango
|
||||
version: 0.5.0
|
||||
version: 0.5.2
|
||||
|
||||
authors:
|
||||
- Alex Ling <hkalexling@gmail.com>
|
||||
|
||||
+3
-3
@@ -61,7 +61,7 @@ class Entry
|
||||
TitleInfo.new @book.dir do |info|
|
||||
info_url = info.entry_cover_url[@title]?
|
||||
unless info_url.nil? || info_url.empty?
|
||||
url = info_url
|
||||
url = File.join Config.current.base_url, info_url
|
||||
end
|
||||
end
|
||||
url
|
||||
@@ -233,14 +233,14 @@ class Title
|
||||
end
|
||||
|
||||
def cover_url
|
||||
url = "img/icon.png"
|
||||
url = "#{Config.current.base_url}img/icon.png"
|
||||
if @entries.size > 0
|
||||
url = @entries[0].cover_url
|
||||
end
|
||||
TitleInfo.new @dir do |info|
|
||||
info_url = info.cover_url
|
||||
unless info_url.nil? || info_url.empty?
|
||||
url = info_url
|
||||
url = File.join Config.current.base_url, info_url
|
||||
end
|
||||
end
|
||||
url
|
||||
|
||||
+4
-2
@@ -4,7 +4,7 @@ require "./mangadex/*"
|
||||
require "option_parser"
|
||||
require "clim"
|
||||
|
||||
MANGO_VERSION = "0.5.0"
|
||||
MANGO_VERSION = "0.5.2"
|
||||
|
||||
macro common_option
|
||||
option "-c PATH", "--config=PATH", type: String,
|
||||
@@ -29,6 +29,8 @@ class CLI < Clim
|
||||
Config.load(opts.config).set_current
|
||||
MangaDex::Downloader.default
|
||||
|
||||
# empty ARGV so it won't be passed to Kemal
|
||||
ARGV.clear
|
||||
server = Server.new
|
||||
server.start
|
||||
end
|
||||
@@ -75,7 +77,7 @@ class CLI < Clim
|
||||
password.not_nil!, opts.admin
|
||||
when "list"
|
||||
users = storage.list_users
|
||||
name_length = users.map(&.[0].size).max
|
||||
name_length = users.map(&.[0].size).max? || 0
|
||||
l_cell_width = ["username".size, name_length].max
|
||||
r_cell_width = "admin access".size
|
||||
header = " #{"username".ljust l_cell_width} | admin access "
|
||||
|
||||
+11
-4
@@ -47,12 +47,22 @@ class Storage
|
||||
Logger.fatal "Error when checking tables in DB: #{e}"
|
||||
raise e
|
||||
end
|
||||
|
||||
# If the DB is initialized through CLI but no user is added, we need
|
||||
# to create the admin user when first starting the app
|
||||
user_count = db.query_one "select count(*) from users", as: Int32
|
||||
init_admin if init_user && user_count == 0
|
||||
else
|
||||
Logger.debug "Creating DB file at #{@path}"
|
||||
db.exec "create unique index username_idx on users (username)"
|
||||
db.exec "create unique index token_idx on users (token)"
|
||||
|
||||
if init_user
|
||||
init_admin if init_user
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
macro init_admin
|
||||
random_pw = random_str
|
||||
hash = hash_password random_pw
|
||||
db.exec "insert into users values (?, ?, ?, ?)",
|
||||
@@ -60,9 +70,6 @@ class Storage
|
||||
Logger.log "Initial user created. You can log in with " \
|
||||
"#{{"username" => "admin", "password" => random_pw}}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def verify_user(username, password)
|
||||
DB.open "sqlite3://#{@path}" do |db|
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="X-UA-Compatible" content="IE=edge">
|
||||
<title>Mango</title>
|
||||
<meta name="description" content="Mango Manga Server">
|
||||
<meta name="description" content="Mango - Manga Server and Web Reader">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/uikit@3.3.1/dist/css/uikit.min.css" />
|
||||
<link rel="stylesheet" href="<%= base_url %>css/mango.css" />
|
||||
<link rel="icon" href="<%= base_url %>favicon.ico">
|
||||
<script defer src="<%= base_url %>js/fontawesome.min.js"></script>
|
||||
<script defer src="<%= base_url %>js/solid.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script src="<%= base_url %>js/theme.js"></script>
|
||||
</head>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body>
|
||||
<div class="uk-offcanvas-content">
|
||||
<div class="uk-navbar-container uk-navbar-transparent" uk-navbar="uk-navbar">
|
||||
<div id="mobile-nav" uk-offcanvas="overlay: true">
|
||||
@@ -72,5 +74,6 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/uikit@3.3.1/dist/js/uikit-icons.min.js"></script>
|
||||
|
||||
<%= yield_content "script" %>
|
||||
</body>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="X-UA-Compatible" content="IE=edge">
|
||||
@@ -11,6 +12,7 @@
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script src="<%= base_url %>js/theme.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="uk-section uk-flex uk-flex-middle uk-animation-fade" uk-height-viewport="">
|
||||
<div class="uk-width-1-1">
|
||||
@@ -40,4 +42,5 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/uikit@3.3.1/dist/js/uikit.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/uikit@3.3.1/dist/js/uikit-icons.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reader-bg">
|
||||
<head>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="X-UA-Compatible" content="IE=edge">
|
||||
<title>Mango</title>
|
||||
@@ -8,9 +9,9 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/uikit@3.3.1/dist/css/uikit.min.css" />
|
||||
<link rel="stylesheet" href="<%= base_url %>css/mango.css" />
|
||||
</head>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body>
|
||||
<script src="<%= base_url %>js/theme.js"></script>
|
||||
<div class="uk-section uk-section-default uk-section-small reader-bg">
|
||||
<div class="uk-container uk-container-small">
|
||||
@@ -64,5 +65,6 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/uikit@3.3.1/dist/js/uikit-icons.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.7/ScrollMagic.min.js"></script>
|
||||
<script src="<%= base_url %>js/reader.js"></script>
|
||||
</body>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+1
-1
@@ -105,7 +105,7 @@
|
||||
<button class="uk-modal-close-default" type="button" uk-close></button>
|
||||
<div class="uk-modal-header">
|
||||
<div>
|
||||
<h3 class="uk-modal-title break-word" id="modal-title">Edit</h3>
|
||||
<h3 class="uk-modal-title break-word">Edit</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-modal-body">
|
||||
|
||||
+2
-10
@@ -2,11 +2,7 @@
|
||||
|
||||
<div class="uk-margin">
|
||||
<label class="uk-form-label" for="form-stacked-text">Username</label>
|
||||
<input class="uk-input" type="text" name="username"
|
||||
<%- if username -%>
|
||||
value=<%= username %>
|
||||
<%- end -%>
|
||||
>
|
||||
<input class="uk-input" type="text" name="username" <%- if username -%> value=<%= username %> <%- end -%>>
|
||||
</div>
|
||||
<%- if new_user -%>
|
||||
<div class="uk-margin">
|
||||
@@ -16,11 +12,7 @@
|
||||
<%- end -%>
|
||||
<div class="uk-margin">
|
||||
<label class="uk-form-label" for="form-stacked-text">Admin Access</label>
|
||||
<input class="uk-checkbox" type="checkbox" name="admin"
|
||||
<%- if admin == true -%>
|
||||
checked
|
||||
<%- end -%>
|
||||
>
|
||||
<input class="uk-checkbox" type="checkbox" name="admin" <%- if admin == true -%> checked <%- end -%>>
|
||||
</div>
|
||||
|
||||
<%- if !new_user -%>
|
||||
|
||||
Reference in New Issue
Block a user