mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-12-05 22:46:27 +01:00
Support cbr and cbz comics and comic reader #109
This commit is contained in:
1 parent
18c1d8f1a3
commit
88e2bac3f5
12 files changed
+276
-20
No files matched your search
@@ -0,0 +1,15 @@
|
||||
|
||||
var libarchive = (function () {
|
||||
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||
return (
|
||||
function (libarchive) {
|
||||
libarchive = libarchive || {};
|
||||
|
||||
var Module = typeof libarchive !== "undefined" ? libarchive : {}; var moduleOverrides = {}; var key; for (key in Module) { if (Module.hasOwnProperty(key)) { moduleOverrides[key] = Module[key] } } Module["arguments"] = []; Module["thisProgram"] = "./this.program"; Module["quit"] = function (status, toThrow) { throw toThrow }; Module["preRun"] = []; Module["postRun"] = []; var ENVIRONMENT_IS_WEB = false; var ENVIRONMENT_IS_WORKER = false; var ENVIRONMENT_IS_NODE = false; var ENVIRONMENT_IS_SHELL = false; ENVIRONMENT_IS_WEB = typeof window === "object"; ENVIRONMENT_IS_WORKER = typeof importScripts === "function"; ENVIRONMENT_IS_NODE = typeof process === "object" && typeof require === "function" && !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_WORKER; ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; var scriptDirectory = ""; function locateFile(path) { if (Module["locateFile"]) { return Module["locateFile"](path, scriptDirectory) } else { return scriptDirectory + path } } if (ENVIRONMENT_IS_NODE) { scriptDirectory = __dirname + "/"; var nodeFS; var nodePath; Module["read"] = function shell_read(filename, binary) { var ret; if (!nodeFS) nodeFS = require("fs"); if (!nodePath) nodePath = require("path"); filename = nodePath["normalize"](filename); ret = nodeFS["readFileSync"](filename); return binary ? ret : ret.toString() }; Module["readBinary"] = function readBinary(filename) { var ret = Module["read"](filename, true); if (!ret.buffer) { ret = new Uint8Array(ret) } assert(ret.buffer); return ret }; if (process["argv"].length > 1) { Module["thisProgram"] = process["argv"][1].replace(/\\/g, "/") } Module["arguments"] = process["argv"].slice(2); process["on"]("uncaughtException", function (ex) { if (!(ex instanceof ExitStatus)) { throw ex } }); process["on"]("unhandledRejection", abort); Module["quit"] = function (status) { process["exit"](status) }; Module["inspect"] = function () { return "[Emscripten Module object]" } } else if (ENVIRONMENT_IS_SHELL) { if (typeof read != "undefined") { Module["read"] = function shell_read(f) { return read(f) } } Module["readBinary"] = function readBinary(f) { var data; if (typeof readbuffer === "function") { return new Uint8Array(readbuffer(f)) } data = read(f, "binary"); assert(typeof data === "object"); return data }; if (typeof scriptArgs != "undefined") { Module["arguments"] = scriptArgs } else if (typeof arguments != "undefined") { Module["arguments"] = arguments } if (typeof quit === "function") { Module["quit"] = function (status) { quit(status) } } } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { if (ENVIRONMENT_IS_WORKER) { scriptDirectory = self.location.href } else if (document.currentScript) { scriptDirectory = document.currentScript.src } if (_scriptDir) { scriptDirectory = _scriptDir } if (scriptDirectory.indexOf("blob:") !== 0) { scriptDirectory = scriptDirectory.substr(0, scriptDirectory.lastIndexOf("/") + 1) } else { scriptDirectory = "" } Module["read"] = function shell_read(url) { var xhr = new XMLHttpRequest; xhr.open("GET", url, false); xhr.send(null); return xhr.responseText }; if (ENVIRONMENT_IS_WORKER) { Module["readBinary"] = function readBinary(url) { var xhr = new XMLHttpRequest; xhr.open("GET", url, false); xhr.responseType = "arraybuffer"; xhr.send(null); return new Uint8Array(xhr.response) } } Module["readAsync"] = function readAsync(url, onload, onerror) { var xhr = new XMLHttpRequest; xhr.open("GET", url, true); xhr.responseType = "arraybuffer"; xhr.onload = function xhr_onload() { if (xhr.status == 200 || xhr.status == 0 && xhr.response) { onload(xhr.response); return } onerror() }; xhr.onerror = onerror; xhr.send(null) }; Module["setWindowTitle"] = function (title) { document.title = title } } else { } var out = Module["print"] || (typeof console !== "undefined" ? console.log.bind(console) : typeof print !== "undefined" ? print : null); var err = Module["printErr"] || (typeof printErr !== "undefined" ? printErr : typeof console !== "undefined" && console.warn.bind(console) || out); for (key in moduleOverrides) { if (moduleOverrides.hasOwnProperty(key)) { Module[key] = moduleOverrides[key] } } moduleOverrides = undefined; function dynamicAlloc(size) { var ret = HEAP32[DYNAMICTOP_PTR >> 2]; var end = ret + size + 15 & -16; if (end <= _emscripten_get_heap_size()) { HEAP32[DYNAMICTOP_PTR >> 2] = end } else { var success = _emscripten_resize_heap(end); if (!success) return 0 } return ret } function getNativeTypeSize(type) { switch (type) { case "i1": case "i8": return 1; case "i16": return 2; case "i32": return 4; case "i64": return 8; case "float": return 4; case "double": return 8; default: { if (type[type.length - 1] === "*") { return 4 } else if (type[0] === "i") { var bits = parseInt(type.substr(1)); assert(bits % 8 === 0, "getNativeTypeSize invalid bits " + bits + ", type " + type); return bits / 8 } else { return 0 } } } } var asm2wasmImports = { "f64-rem": function (x, y) { return x % y },Line truncated
|
||||
|
||||
|
||||
return libarchive
|
||||
}
|
||||
);
|
||||
})();
|
||||
export default libarchive;
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
!function () { "use strict"; const e = { 32768: "FILE", 16384: "DIR", 40960: "SYMBOLIC_LINK", 49152: "SOCKET", 8192: "CHARACTER_DEVICE", 24576: "BLOCK_DEVICE", 4096: "NAMED_PIPE" }; class r { constructor(e) { this._wasmModule = e, this._runCode = e.runCode, this._file = null, this._passphrase = null } open(e) { null !== this._file && (console.warn("Closing previous file"), this.close()); const { promise: r, resolve: t, reject: n } = this._promiseHandles(); this._file = e; const o = new FileReader; return o.onload = (() => this._loadFile(o.result, t, n)), o.readAsArrayBuffer(e), r } close() { this._runCode.closeArchive(this._archive), this._wasmModule._free(this._filePtr), this._file = null, this._filePtr = null, this._archive = null } hasEncryptedData() { this._archive = this._runCode.openArchive(this._filePtr, this._fileLength, this._passphrase), this._runCode.getNextEntry(this._archive); const e = this._runCode.hasEncryptedEntries(this._archive); return 0 !== e && (e > 0 || null) } setPassphrase(e) { this._passphrase = e } *entries(r = !1, t = null) { let n; for (this._archive = this._runCode.openArchive(this._filePtr, this._fileLength, this._passphrase); 0 !== (n = this._runCode.getNextEntry(this._archive));) { const o = { size: this._runCode.getEntrySize(n), path: this._runCode.getEntryName(n), type: e[this._runCode.getEntryType(n)], ref: n }; if ("FILE" === o.type) { let e = o.path.split("/"); o.fileName = e[e.length - 1] } if (r && t !== o.path) this._runCode.skipEntry(this._archive); else { const e = this._runCode.getFileData(this._archive, o.size); if (e < 0) throw new Error(this._runCode.getError(this._archive)); o.fileData = this._wasmModule.HEAP8.slice(e, e + o.size), this._wasmModule._free(e) } yield o } } _loadFile(e, r, t) { try { const n = new Uint8Array(e); this._fileLength = n.length, this._filePtr = this._runCode.malloc(this._fileLength), this._wasmModule.HEAP8.set(n, this._filePtr), r() } catch (e) { t(e) } } _promiseHandles() { let e = null, r = null; return { promise: new Promise((t, n) => { e = t, r = n }), resolve: e, reject: r } } } var t, n = (t = "undefined" != typeof document && document.currentScript ? document.currentScript.src : void 0, function (e) { var r, n = void 0 !== (e = e || {}) ? e : {}, o = {}; for (r in n) n.hasOwnProperty(r) && (o[r] = n[r]); n.arguments = [], n.thisProgram = "./this.program", n.quit = function (e, r) { throw r }, n.preRun = [], n.postRun = []; var i, a, s = !1, u = !1; s = "object" == typeof window, u = "function" == typeof importScripts, i = "object" == typeof process && "function" == typeof require && !s && !u, a = !s && !i && !u; var c, f, l = ""; i ? (l = __dirname + "/", n.read = function (e, r) { var t; return c || (c = require("fs")), f || (f = require("path")), e = f.normalize(e), t = c.readFileSync(e), r ? t : t.toString() }, n.readBinary = function (e) { var r = n.read(e, !0); return r.buffer || (r = new Uint8Array(r)), y(r.buffer), r }, process.argv.length > 1 && (n.thisProgram = process.argv[1].replace(/\\/g, "/")), n.arguments = process.argv.slice(2), process.on("uncaughtException", function (e) { if (!(e instanceof We)) throw e }), process.on("unhandledRejection", Ke), n.quit = function (e) { process.exit(e) }, n.inspect = function () { return "[Emscripten Module object]" }) : a ? ("undefined" != typeof read && (n.read = function (e) { return read(e) }), n.readBinary = function (e) { var r; return "function" == typeof readbuffer ? new Uint8Array(readbuffer(e)) : (y("object" == typeof (r = read(e, "binary"))), r) }, "undefined" != typeof scriptArgs ? n.arguments = scriptArgs : void 0 !== arguments && (n.arguments = arguments), "function" == typeof quit && (n.quit = function (e) { quit(e) })) : (s || u) && (u ? l = self.location.href : document.currentScript && (l = document.currentScript.src), t && (l = t), l = 0 !== l.indexOf("blob:") ? l.substr(0, l.lastIndexOf("/") + 1) : "", n.read = function (e) { var r = new XMLHttpRequest; return r.open("GET", e, !1), r.send(null), r.responseText }, u && (n.readBinary = function (e) { var r = new XMLHttpRequest; return r.open("GET", e, !1), r.responseType = "arraybuffer", r.send(null), new Uint8Array(r.response) }), n.readAsync = function (e, r, t) { var n = new XMLHttpRequest; n.open("GET", e, !0), n.responseType = "arraybuffer", n.onload = function () { 200 == n.status || 0 == n.status && n.response ? r(n.response) : t() }, n.onerror = t, n.send(null) }, n.setWindowTitle = function (e) { document.title = e }); var d = n.print || ("undefined" != typeof console ? console.log.bind(console) : "undefined" != typeof print ? print : null), p = n.printErr || ("undefined" != typeof printErr ? printErr : "undefined" != typeof console && console.warn.bind(console) || d); for (r in o) o.hasOwnProperty(r) && (n[r] = o[r]); function m(e) { var r = M[q >> 2], t = r + e + 15 & -16; if (t <= Fe()) M[q >> 2] = t; else if (!Ae(t)) return 0; return r } function h(e) { switch (e) { case "i1": case "i8": return 1;Line truncated
|
||||
Reference in new issue
Block a user