-
Notifications
You must be signed in to change notification settings - Fork 79
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
base: master
Are you sure you want to change the base?
Add Komga plugin #1341
Conversation
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; | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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; | ||
}, []); | ||
} |
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
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.