shiori/internal/view/content.html
Monirzadeh 249f4b89c8
Initial Ebook Support (#623)
* generate ebook

* serve ebook file

* Update ebook.go not download same image twice anymore

* download ebook request api/ui part

* fix typo

* add stylesheet

* update hasEbook status

* download link update after ebook generate

update bookmark command in ui

* download ebook with bookmark title

* Apply suggestions from code review for better error handling

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>

* Update internal/view/js/page/home.js fix typo

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>

* import error lib and retuen missing error

* move ebook download action to update cache

* replace io/ioutil with io

* add missing error handling

* update Archive now always update ebook

* replace panic error with 404

* remove ebook with delete action

* add download ebook link to content page

* remove tags that not work correctly right now

* if file is pdf not generate ebook

* update style.css

* Revert "update style.css"

This reverts commit 519e10d6ce.

* remove download limit for api

* fix missing fmt.Errorf and change to errors.Wrap

* fix double panic

* return 404 if bookmark not exist

* change function name to GenerateEbook

* not isFatalErr anymore

* add unit test

* remove uneeded field for unit test

---------

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
2023-07-09 08:29:32 +02:00

93 lines
2.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<base href="$$.RootPath$$">
<title>$$.Book.Title$$ - Shiori - Bookmarks Manager</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="res/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="res/apple-touch-icon-144x144.png">
<link rel="icon" type="image/png" href="res/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="res/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/x-icon" href="res/favicon.ico">
<link href="css/source-sans-pro.min.css" rel="stylesheet">
<link href="css/stylesheet.css" rel="stylesheet">
<link href="css/custom-dialog.css" rel="stylesheet">
<link href="css/bookmark-item.css" rel="stylesheet">
<script src="js/dayjs.min.js"></script>
<script src="js/vue.min.js"></script>
</head>
<body class="night">
<div id="content-scene" :class="{night: appOptions.nightMode}">
<div id="header">
<p id="metadata" v-cloak>Added {{localtime()}}</p>
<p id="title" dir="auto">$$.Book.Title$$</p>
<div id="links">
<a href="$$.Book.URL$$" target="_blank" rel="noopener">View Original</a>
$$if .Book.HasArchive$$
<a href="bookmark/$$.Book.ID$$/archive">View Archive</a>
$$end$$
$$if .Book.HasEbook$$
<a href="bookmark/$$.Book.ID$$/ebook" download="$$.Book.Title$$.epub">Download Ebook</a>
$$end$$
</div>
</div>
<div id="content" dir="auto" v-pre>
$$html .Book.HTML$$
</div>
</div>
<script type="module">
// Create initial variable
import basePage from "./js/page/base.js";
new Vue({
el: '#content-scene',
mixins: [basePage],
data: {
modified: "$$.Book.Modified$$"
},
methods: {
localtime() {
var strTime = this.modified.replace(" ", "T");
if (!strTime.endsWith("Z")) {
strTime += "Z";
}
return dayjs(strTime).format("D MMMM YYYY, HH:mm:ss");
},
loadSetting() {
var opts = JSON.parse(localStorage.getItem("shiori-setting")) || {},
showId = (typeof opts.showId === "boolean") ? opts.showId : false,
listMode = (typeof opts.listMode === "boolean") ? opts.listMode : false,
nightMode = (typeof opts.nightMode === "boolean") ? opts.nightMode : false,
useArchive = (typeof opts.useArchive === "boolean") ? opts.useArchive : false;
this.appOptions = {
showId: showId,
listMode: listMode,
nightMode: nightMode,
useArchive: useArchive,
};
document.body.className = nightMode ? "night" : "";
}
},
mounted() {
this.loadSetting();
document.querySelectorAll("#content a").forEach(elem => {
elem.setAttribute("target", "_blank");
elem.setAttribute("rel", "noopener");
});
}
});
</script>
</body>
</html>