Compare commits
No commits in common. "2c240f2f5c523902af3e459f025eb1aa87d57bc6" and "e9f2e3a5a06df92fe2429f68b1624bd16281aaf8" have entirely different histories.
2c240f2f5c
...
e9f2e3a5a0
14
api/auth.go
14
api/auth.go
@ -120,7 +120,7 @@ func (api *API) authFormLogin(c *gin.Context) {
|
|||||||
rawPassword := strings.TrimSpace(c.PostForm("password"))
|
rawPassword := strings.TrimSpace(c.PostForm("password"))
|
||||||
|
|
||||||
if username == "" || rawPassword == "" {
|
if username == "" || rawPassword == "" {
|
||||||
c.HTML(http.StatusUnauthorized, "page/login", gin.H{
|
c.HTML(http.StatusUnauthorized, "login", gin.H{
|
||||||
"RegistrationEnabled": api.Config.RegistrationEnabled,
|
"RegistrationEnabled": api.Config.RegistrationEnabled,
|
||||||
"Error": "Invalid Credentials",
|
"Error": "Invalid Credentials",
|
||||||
})
|
})
|
||||||
@ -130,7 +130,7 @@ func (api *API) authFormLogin(c *gin.Context) {
|
|||||||
// MD5 - KOSync Compatiblity
|
// MD5 - KOSync Compatiblity
|
||||||
password := fmt.Sprintf("%x", md5.Sum([]byte(rawPassword)))
|
password := fmt.Sprintf("%x", md5.Sum([]byte(rawPassword)))
|
||||||
if authorized := api.authorizeCredentials(username, password); authorized != true {
|
if authorized := api.authorizeCredentials(username, password); authorized != true {
|
||||||
c.HTML(http.StatusUnauthorized, "page/login", gin.H{
|
c.HTML(http.StatusUnauthorized, "login", gin.H{
|
||||||
"RegistrationEnabled": api.Config.RegistrationEnabled,
|
"RegistrationEnabled": api.Config.RegistrationEnabled,
|
||||||
"Error": "Invalid Credentials",
|
"Error": "Invalid Credentials",
|
||||||
})
|
})
|
||||||
@ -140,7 +140,7 @@ func (api *API) authFormLogin(c *gin.Context) {
|
|||||||
// Set Session
|
// Set Session
|
||||||
session := sessions.Default(c)
|
session := sessions.Default(c)
|
||||||
if err := setSession(session, username); err != nil {
|
if err := setSession(session, username); err != nil {
|
||||||
c.HTML(http.StatusUnauthorized, "page/login", gin.H{
|
c.HTML(http.StatusUnauthorized, "login", gin.H{
|
||||||
"RegistrationEnabled": api.Config.RegistrationEnabled,
|
"RegistrationEnabled": api.Config.RegistrationEnabled,
|
||||||
"Error": "Unknown Error",
|
"Error": "Unknown Error",
|
||||||
})
|
})
|
||||||
@ -161,7 +161,7 @@ func (api *API) authFormRegister(c *gin.Context) {
|
|||||||
rawPassword := strings.TrimSpace(c.PostForm("password"))
|
rawPassword := strings.TrimSpace(c.PostForm("password"))
|
||||||
|
|
||||||
if username == "" || rawPassword == "" {
|
if username == "" || rawPassword == "" {
|
||||||
c.HTML(http.StatusBadRequest, "page/login", gin.H{
|
c.HTML(http.StatusBadRequest, "login", gin.H{
|
||||||
"Register": true,
|
"Register": true,
|
||||||
"Error": "Registration Disabled or User Already Exists",
|
"Error": "Registration Disabled or User Already Exists",
|
||||||
})
|
})
|
||||||
@ -171,7 +171,7 @@ func (api *API) authFormRegister(c *gin.Context) {
|
|||||||
|
|
||||||
hashedPassword, err := argon2.CreateHash(password, argon2.DefaultParams)
|
hashedPassword, err := argon2.CreateHash(password, argon2.DefaultParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.HTML(http.StatusBadRequest, "page/login", gin.H{
|
c.HTML(http.StatusBadRequest, "login", gin.H{
|
||||||
"Register": true,
|
"Register": true,
|
||||||
"Error": "Registration Disabled or User Already Exists",
|
"Error": "Registration Disabled or User Already Exists",
|
||||||
})
|
})
|
||||||
@ -185,7 +185,7 @@ func (api *API) authFormRegister(c *gin.Context) {
|
|||||||
|
|
||||||
// SQL Error
|
// SQL Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.HTML(http.StatusBadRequest, "page/login", gin.H{
|
c.HTML(http.StatusBadRequest, "login", gin.H{
|
||||||
"Register": true,
|
"Register": true,
|
||||||
"Error": "Registration Disabled or User Already Exists",
|
"Error": "Registration Disabled or User Already Exists",
|
||||||
})
|
})
|
||||||
@ -194,7 +194,7 @@ func (api *API) authFormRegister(c *gin.Context) {
|
|||||||
|
|
||||||
// User Already Exists
|
// User Already Exists
|
||||||
if rows == 0 {
|
if rows == 0 {
|
||||||
c.HTML(http.StatusBadRequest, "page/login", gin.H{
|
c.HTML(http.StatusBadRequest, "login", gin.H{
|
||||||
"Register": true,
|
"Register": true,
|
||||||
"Error": "Registration Disabled or User Already Exists",
|
"Error": "Registration Disabled or User Already Exists",
|
||||||
})
|
})
|
||||||
|
@ -1,119 +0,0 @@
|
|||||||
/**
|
|
||||||
* Lato
|
|
||||||
* - Charsets: [latin,latin-ext]
|
|
||||||
* - Styles: [100,700,100italic,regular,italic,700italic]
|
|
||||||
**/
|
|
||||||
|
|
||||||
/* lato-100 - latin_latin-ext */
|
|
||||||
@font-face {
|
|
||||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
|
||||||
font-family: "Lato";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 100;
|
|
||||||
src: url("./fonts/lato-v24-latin_latin-ext-100.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* lato-100italic - latin_latin-ext */
|
|
||||||
@font-face {
|
|
||||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
|
||||||
font-family: "Lato";
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 100;
|
|
||||||
src: url("./fonts/lato-v24-latin_latin-ext-100italic.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* lato-regular - latin_latin-ext */
|
|
||||||
@font-face {
|
|
||||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
|
||||||
font-family: "Lato";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
src: url("./fonts/lato-v24-latin_latin-ext-regular.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* lato-italic - latin_latin-ext */
|
|
||||||
@font-face {
|
|
||||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
|
||||||
font-family: "Lato";
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 400;
|
|
||||||
src: url("./fonts/lato-v24-latin_latin-ext-italic.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* lato-700 - latin_latin-ext */
|
|
||||||
@font-face {
|
|
||||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
|
||||||
font-family: "Lato";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 700;
|
|
||||||
src: url("./fonts/lato-v24-latin_latin-ext-700.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* lato-700italic - latin_latin-ext */
|
|
||||||
@font-face {
|
|
||||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
|
||||||
font-family: "Lato";
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 700;
|
|
||||||
src: url("./fonts/lato-v24-latin_latin-ext-700italic.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Open Sans
|
|
||||||
* - Charsets: [latin,latin-ext]
|
|
||||||
* - Styles: [700,regular,italic,700italic]
|
|
||||||
**/
|
|
||||||
|
|
||||||
/* open-sans-regular - latin_latin-ext */
|
|
||||||
@font-face {
|
|
||||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
|
||||||
font-family: "Open Sans";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
src: url("./fonts/open-sans-v36-latin_latin-ext-regular.woff2")
|
|
||||||
format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open-sans-italic - latin_latin-ext */
|
|
||||||
@font-face {
|
|
||||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
|
||||||
font-family: "Open Sans";
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 400;
|
|
||||||
src: url("./fonts/open-sans-v36-latin_latin-ext-italic.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open-sans-700 - latin_latin-ext */
|
|
||||||
@font-face {
|
|
||||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
|
||||||
font-family: "Open Sans";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 700;
|
|
||||||
src: url("./fonts/open-sans-v36-latin_latin-ext-700.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open-sans-700italic - latin_latin-ext */
|
|
||||||
@font-face {
|
|
||||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
|
||||||
font-family: "Open Sans";
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 700;
|
|
||||||
src: url("./fonts/open-sans-v36-latin_latin-ext-700italic.woff2")
|
|
||||||
format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Arbutus Slab
|
|
||||||
* - Charsets: [latin,latin-ext]
|
|
||||||
* - Styles: [regular]
|
|
||||||
**/
|
|
||||||
|
|
||||||
/* arbutus-slab-regular - latin_latin-ext */
|
|
||||||
@font-face {
|
|
||||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
|
||||||
font-family: "Arbutus Slab";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
src: url("./fonts/arbutus-slab-v16-latin_latin-ext-regular.woff2")
|
|
||||||
format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
|
||||||
}
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
const THEMES = ["light", "tan", "blue", "gray", "black"];
|
const THEMES = ["light", "tan", "blue", "gray", "black"];
|
||||||
const THEME_FILE = "/assets/reader/themes.css";
|
const THEME_FILE = "/assets/reader/readerThemes.css";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initial load handler. Gets called on DOMContentLoaded. Responsible for
|
* Initial load handler. Gets called on DOMContentLoaded. Responsible for
|
||||||
@ -267,13 +267,20 @@ class EBookReader {
|
|||||||
// Restore Theme
|
// Restore Theme
|
||||||
this.setTheme();
|
this.setTheme();
|
||||||
|
|
||||||
// Set Fonts
|
// Set Fonts - TODO: Local
|
||||||
|
// https://gwfh.mranftl.com/fonts
|
||||||
this.rendition.getContents().forEach((c) => {
|
this.rendition.getContents().forEach((c) => {
|
||||||
|
[
|
||||||
|
"https://fonts.googleapis.com/css?family=Arbutus+Slab",
|
||||||
|
"https://fonts.googleapis.com/css?family=Open+Sans",
|
||||||
|
"https://fonts.googleapis.com/css?family=Lato:400,400i,700,700i",
|
||||||
|
].forEach((url) => {
|
||||||
let el = c.document.head.appendChild(
|
let el = c.document.head.appendChild(
|
||||||
c.document.createElement("link")
|
c.document.createElement("link")
|
||||||
);
|
);
|
||||||
el.setAttribute("rel", "stylesheet");
|
el.setAttribute("rel", "stylesheet");
|
||||||
el.setAttribute("href", "/assets/reader/fonts.css");
|
el.setAttribute("href", url);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
17
assets/sw.js
17
assets/sw.js
@ -38,7 +38,6 @@ const ROUTES = [
|
|||||||
{ route: "/local", type: CACHE_UPDATE_ASYNC },
|
{ route: "/local", type: CACHE_UPDATE_ASYNC },
|
||||||
{ route: "/reader", type: CACHE_UPDATE_ASYNC },
|
{ route: "/reader", type: CACHE_UPDATE_ASYNC },
|
||||||
{ route: "/manifest.json", type: CACHE_UPDATE_ASYNC },
|
{ route: "/manifest.json", type: CACHE_UPDATE_ASYNC },
|
||||||
{ route: /^\/assets\/reader\/fonts\//, type: CACHE_ONLY },
|
|
||||||
{ route: /^\/assets\//, type: CACHE_UPDATE_ASYNC },
|
{ route: /^\/assets\//, type: CACHE_UPDATE_ASYNC },
|
||||||
{
|
{
|
||||||
route: /^\/documents\/[a-zA-Z0-9]{32}\/(cover|file)$/,
|
route: /^\/documents\/[a-zA-Z0-9]{32}\/(cover|file)$/,
|
||||||
@ -64,10 +63,9 @@ const PRECACHE_ASSETS = [
|
|||||||
"/reader",
|
"/reader",
|
||||||
"/assets/local/index.js",
|
"/assets/local/index.js",
|
||||||
"/assets/reader/index.js",
|
"/assets/reader/index.js",
|
||||||
"/assets/reader/fonts.css",
|
|
||||||
"/assets/reader/themes.css",
|
|
||||||
"/assets/icons/icon512.png",
|
"/assets/icons/icon512.png",
|
||||||
"/assets/images/no-cover.jpg",
|
"/assets/images/no-cover.jpg",
|
||||||
|
"/assets/reader/readerThemes.css",
|
||||||
|
|
||||||
// Main App Assets
|
// Main App Assets
|
||||||
"/manifest.json",
|
"/manifest.json",
|
||||||
@ -80,19 +78,6 @@ const PRECACHE_ASSETS = [
|
|||||||
"/assets/lib/epub.min.js",
|
"/assets/lib/epub.min.js",
|
||||||
"/assets/lib/no-sleep.min.js",
|
"/assets/lib/no-sleep.min.js",
|
||||||
"/assets/lib/idb-keyval.min.js",
|
"/assets/lib/idb-keyval.min.js",
|
||||||
|
|
||||||
// Fonts
|
|
||||||
"/assets/reader/fonts/arbutus-slab-v16-latin_latin-ext-regular.woff2",
|
|
||||||
"/assets/reader/fonts/lato-v24-latin_latin-ext-100.woff2",
|
|
||||||
"/assets/reader/fonts/lato-v24-latin_latin-ext-100italic.woff2",
|
|
||||||
"/assets/reader/fonts/lato-v24-latin_latin-ext-700.woff2",
|
|
||||||
"/assets/reader/fonts/lato-v24-latin_latin-ext-700italic.woff2",
|
|
||||||
"/assets/reader/fonts/lato-v24-latin_latin-ext-italic.woff2",
|
|
||||||
"/assets/reader/fonts/lato-v24-latin_latin-ext-regular.woff2",
|
|
||||||
"/assets/reader/fonts/open-sans-v36-latin_latin-ext-700.woff2",
|
|
||||||
"/assets/reader/fonts/open-sans-v36-latin_latin-ext-700italic.woff2",
|
|
||||||
"/assets/reader/fonts/open-sans-v36-latin_latin-ext-italic.woff2",
|
|
||||||
"/assets/reader/fonts/open-sans-v36-latin_latin-ext-regular.woff2",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// ------------------------------------------------------- //
|
// ------------------------------------------------------- //
|
||||||
|
Loading…
Reference in New Issue
Block a user