Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xochitl 2.6+ support, and added a parent folder option for xochitl too #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion backend/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ module.exports.fetchOptions = {

module.exports.domain = config.domain;
module.exports.listURL = config.listURL;
module.exports.additionalBookLocation = config.additionalBookLocation;
module.exports.additionalBookLocation = config.additionalBookLocation;
module.exports.parentFolderUUID = config.parentFolderUUID;
7 changes: 5 additions & 2 deletions backend/download.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { writeFileSync, copyFileSync, existsSync, mkdirSync, createWriteStream, constants } = require("fs");
const { join: pathJoin, extname, basename } = require("path");
const { v4 } = require("uuid");
const { domain, fetchOptions, additionalBookLocation } = require("./common");
const { domain, fetchOptions, additionalBookLocation, parentFolderUUID} = require("./common");
const fetch = require("node-fetch");

module.exports = function (args, socket) {
Expand Down Expand Up @@ -71,14 +71,17 @@ module.exports = function (args, socket) {
"lastOpenedPage": 0,
"metadatamodified": false,
"modified": false,
"parent": "",
"parent": parentFolderUUID || "",
"pinned": false,
"synced": false,
"type": "DocumentType",
"version": 1,
"visibleName": fileName
}));

// this is needed to get xochitl to handle these files in 2.6, the fileType should be epub for all ebooks, including pdfs
writeFileSync(xochitlFolder + uuid + ".content", JSON.stringify({ "fileType": "epub" }));

copyFileSync(tempFilePath, pathJoin(xochitlFolder, uuid + fileExt), constants.COPYFILE_FICLONE);
socket.write("COPIED XOCHITL\n");
}
Expand Down
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"domain": "https://b-ok.global",
"cookie": "",
"additionalBookLocation": "/home/root/Books/",
"additionalBookLocation": null,
"parentFolderUUID": null,
"defaultQuery": {
"exactMatch": "0",
"fromYear": "2020",
Expand Down