Skip to content

Commit

Permalink
Deploying to gh-pages from @ 9555aaa 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
FaizanDurrani committed Dec 7, 2023
1 parent 44da709 commit 59970c6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 25 deletions.
31 changes: 19 additions & 12 deletions komga-tracker-test/Paperback/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2802,17 +2802,20 @@ class KomgaRequestInterceptor {
});
}
interceptRequest(request) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
// NOTE: Doing it like this will make downloads work tried every other method did not work, if there is a better method make edit it and make pull request
if (request.url.includes('intercept*')) {
const url = (_b = (_a = request === null || request === void 0 ? void 0 : request.url) === null || _a === void 0 ? void 0 : _a.split('*').pop()) !== null && _b !== void 0 ? _b : '';
request.headers = {
'authorization': yield (0, Common_1.getAuthorizationString)(this.stateManager)
};
request.url = url;
return request;
}
//
// Paper's Note: Reopen a new merge request if downloads break again,
// pages stopped loading because of this on iOS 17.0
//
// // NOTE: Doing it like this will make downloads work tried every other method did not work, if there is a better method make edit it and make pull request
// if (request.url.includes('intercept*')) {
// const url = request?.url?.split('*').pop() ?? ''
// request.headers = {
// 'authorization': await getAuthorizationString(this.stateManager)
// }
// request.url = url
// return request
// }
if (request.headers === undefined) {
request.headers = {};
}
Expand Down Expand Up @@ -3025,10 +3028,10 @@ class Paperback extends types_1.Source {
const pages = [];
for (const page of result) {
if (SUPPORTED_IMAGE_TYPES.includes(page.mediaType)) {
pages.push(`intercept*${komgaAPI}/books/${chapterId}/pages/${page.number}`);
pages.push(`${komgaAPI}/books/${chapterId}/pages/${page.number}`);
}
else {
pages.push(`intercept*${komgaAPI}/books/${chapterId}/pages/${page.number}?convert=png`);
pages.push(`${komgaAPI}/books/${chapterId}/pages/${page.number}?convert=png`);
}
}
// Determine the preferred reading direction which is only available in the serie metadata
Expand Down Expand Up @@ -3272,16 +3275,20 @@ class Paperback extends types_1.Source {
const request = App.createRequest({
url: `${komgaAPI}/books/${readAction.sourceChapterId}/read-progress`,
method: 'PATCH',
headers: { 'content-type': 'application/json' },
data: {
'page': 1,
'completed': true
}
});
const response = yield this.requestManager.schedule(request, 1);
if (response.status < 400) {
console.log(`${readAction.sourceChapterId} chapter marked as read`);
yield actionQueue.discardChapterReadAction(readAction);
}
else {
console.log(`${readAction.sourceChapterId} chapter needs to be retried`);
console.log(`${response.status} --- ${response.data}`);
yield actionQueue.retryChapterReadAction(readAction);
}
}
Expand Down
31 changes: 19 additions & 12 deletions komga-tracker-test/Paperback/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -2802,17 +2802,20 @@ class KomgaRequestInterceptor {
});
}
interceptRequest(request) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
// NOTE: Doing it like this will make downloads work tried every other method did not work, if there is a better method make edit it and make pull request
if (request.url.includes('intercept*')) {
const url = (_b = (_a = request === null || request === void 0 ? void 0 : request.url) === null || _a === void 0 ? void 0 : _a.split('*').pop()) !== null && _b !== void 0 ? _b : '';
request.headers = {
'authorization': yield (0, Common_1.getAuthorizationString)(this.stateManager)
};
request.url = url;
return request;
}
//
// Paper's Note: Reopen a new merge request if downloads break again,
// pages stopped loading because of this on iOS 17.0
//
// // NOTE: Doing it like this will make downloads work tried every other method did not work, if there is a better method make edit it and make pull request
// if (request.url.includes('intercept*')) {
// const url = request?.url?.split('*').pop() ?? ''
// request.headers = {
// 'authorization': await getAuthorizationString(this.stateManager)
// }
// request.url = url
// return request
// }
if (request.headers === undefined) {
request.headers = {};
}
Expand Down Expand Up @@ -3025,10 +3028,10 @@ class Paperback extends types_1.Source {
const pages = [];
for (const page of result) {
if (SUPPORTED_IMAGE_TYPES.includes(page.mediaType)) {
pages.push(`intercept*${komgaAPI}/books/${chapterId}/pages/${page.number}`);
pages.push(`${komgaAPI}/books/${chapterId}/pages/${page.number}`);
}
else {
pages.push(`intercept*${komgaAPI}/books/${chapterId}/pages/${page.number}?convert=png`);
pages.push(`${komgaAPI}/books/${chapterId}/pages/${page.number}?convert=png`);
}
}
// Determine the preferred reading direction which is only available in the serie metadata
Expand Down Expand Up @@ -3272,16 +3275,20 @@ class Paperback extends types_1.Source {
const request = App.createRequest({
url: `${komgaAPI}/books/${readAction.sourceChapterId}/read-progress`,
method: 'PATCH',
headers: { 'content-type': 'application/json' },
data: {
'page': 1,
'completed': true
}
});
const response = yield this.requestManager.schedule(request, 1);
if (response.status < 400) {
console.log(`${readAction.sourceChapterId} chapter marked as read`);
yield actionQueue.discardChapterReadAction(readAction);
}
else {
console.log(`${readAction.sourceChapterId} chapter needs to be retried`);
console.log(`${response.status} --- ${response.data}`);
yield actionQueue.retryChapterReadAction(readAction);
}
}
Expand Down
2 changes: 1 addition & 1 deletion komga-tracker-test/versioning.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"buildTime":"2023-11-07T19:26:08.298Z","sources":[{"id":"Paperback","name":"Paperback","author":"Lemon | Faizan Durrani","desc":"Komga client extension for Paperback","website":"https://github.com/FramboisePi","contentRating":"EVERYONE","version":"1.2.12","icon":"icon.png","tags":[{"text":"Self hosted","type":"danger"}],"websiteBaseURL":"https://komga.org","intents":39}],"builtWith":{"toolchain":"0.8.0-alpha.47","types":"0.8.0-alpha.47"}}
{"buildTime":"2023-12-07T19:10:31.363Z","sources":[{"id":"Paperback","name":"Paperback","author":"Lemon | Faizan Durrani","desc":"Komga client extension for Paperback","website":"https://github.com/FramboisePi","contentRating":"EVERYONE","version":"1.2.12","icon":"icon.png","tags":[{"text":"Self hosted","type":"danger"}],"websiteBaseURL":"https://komga.org","intents":39}],"builtWith":{"toolchain":"0.8.0-alpha.47","types":"0.8.0-alpha.47"}}

0 comments on commit 59970c6

Please sign in to comment.