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

Add Komga plugin #1341

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add Komga plugin #1341

wants to merge 6 commits into from

Conversation

NilSilva
Copy link

This is a komga plugin. It's not perfect but I think it's good enough for a first version. I'll keep trying to improve it when I can. The biggest problem is the webview in the novel page. Because I'm using the api instead of opening that series page in komga it opens a page with the json api response.

It is using the plugin settings so the user can configure the url, email, and password.

Comment on lines +29 to +52
btoa(input: string = '') {
const chars =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
let str = input;
let output = '';

for (
let block = 0, charCode, i = 0, map = chars;
str.charAt(i | 0) || ((map = '='), i % 1);
output += map.charAt(63 & (block >> (8 - (i % 1) * 8)))
) {
charCode = str.charCodeAt((i += 3 / 4));

if (charCode > 0xff) {
throw new Error(
"'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.",
);
}

block = (block << 8) | charCode;
}

return output;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issnt btoa and atob global functions already?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it... But it complained that it wasn't a function so I implemented it myself. But I'll look into it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was implemented in hermes (facebook/hermes#1178), I think current app react native version doesnt contain it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. So I should leave this and eventually remove it when it stops being necessary.

Comment on lines +54 to +65
flattenArray(arr: any) {
return arr.reduce((acc: any, obj: any) => {
const { children, ...rest } = obj;
acc.push(rest);

if (children) {
acc.push(...this.flattenArray(children));
}

return acc;
}, []);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flat is also already a function on array, id assume hermes supports (couldent find any github posts abt it)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into this as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think hermes does have it. They have tests for this method https://github.com/facebook/hermes/blob/main/test/hermes/array-flat-recursion.js

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried it but it doesn't seem to do anything in this situation. Maybe I'm using it wrong. I'm new to hermes and can't find documentation. I'm also an idiot so that probably factor in.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's facebook fauth, they stopped update hermes changelogs. Now only facebook devs can know what JS features is are supported in what react native version

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what do you recommend?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants