diff --git a/internal/view/js/component/bookmark.js b/internal/view/js/component/bookmark.js
index d2e3815..fd2f287 100644
--- a/internal/view/js/component/bookmark.js
+++ b/internal/view/js/component/bookmark.js
@@ -32,6 +32,9 @@ var template = `
+
+
+
`;
@@ -47,6 +50,7 @@ export default {
imageURL: String,
hasContent: Boolean,
hasArchive: Boolean,
+ hasEbook: Boolean,
index: Number,
showId: Boolean,
editMode: Boolean,
@@ -72,6 +76,13 @@ export default {
return this.url;
}
},
+ ebookURL() {
+ if (this.hasEbook) {
+ return new URL(`bookmark/${this.id}/ebook`, document.baseURI);
+ } else {
+ return null;
+ }
+ },
hostnameURL() {
var url = new URL(this.url);
return url.hostname.replace(/^www\./, "");
@@ -112,6 +123,14 @@ export default {
},
updateBookmark() {
this.$emit("update", this.eventItem);
- }
+ },
+ downloadebook() {
+ const id = this.id;
+ const ebook_url = new URL(`bookmark/${id}/ebook`, document.baseURI);
+ const downloadLink = document.createElement("a");
+ downloadLink.href = ebook_url.toString();
+ downloadLink.download = `${this.title}.epub`;
+ downloadLink.click();
+ },
}
}
diff --git a/internal/view/js/page/base.js b/internal/view/js/page/base.js
index 3d357a7..b50ebae 100644
--- a/internal/view/js/page/base.js
+++ b/internal/view/js/page/base.js
@@ -22,6 +22,7 @@ export default {
keepMetadata: false,
useArchive: false,
+ createEbook: false,
makePublic: false,
};
}
@@ -111,4 +112,4 @@ export default {
});
},
}
-}
\ No newline at end of file
+}
diff --git a/internal/view/js/page/home.js b/internal/view/js/page/home.js
index cd52298..85bb80b 100644
--- a/internal/view/js/page/home.js
+++ b/internal/view/js/page/home.js
@@ -26,6 +26,9 @@ var template = `