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

[WIP] User Accounts #623

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft

[WIP] User Accounts #623

wants to merge 22 commits into from

Conversation

Syer10
Copy link
Collaborator

@Syer10 Syer10 commented Jul 29, 2023

Closes #298

  • User data is now separated to its own tables or a column USER is added based on the requirements

Todo:

  • Decide how to update user's manga, update all manga at once or separate them by user?
  • Save token secret
  • Investigate token audience
  • Implement open registration
  • Implement Permissions
  • Source settings are currently global, maybe figure out how to separate sources per user? Or make it a permission
  • Test to make sure I didn't break anything
  • Require current password to change password
  • Consider what in server.conf can be user specific settings
  • Handle downloads per-user
  • Handle library update
  • Make downloads endpoint filter by in-library?
  • Add NSFW permission

@schroda
Copy link
Collaborator

schroda commented Aug 3, 2023

what has to be considered as well are user related settings that are currently in the server config

@schroda
Copy link
Collaborator

schroda commented Aug 3, 2023

Decide how to update user's manga, update all manga at once or separate them by user?

I'd say everything should be per user.

that should also include downloads.
or how should that be handled? what if two users try to download from the same source, wouldn't then the downloads of one user block the ones from the other?

I guess this would still be a problem even with separated downloads, unless every user uses their own source instance.
but also overall, if every user has a own source instance, couldn't that, in theory, lead to basically spamming sources?

everything that is currently stored on the file system would also have to be per user right? e.g. downloads and thumbnails
I guess it could also be kept global by only deleting files if no user requires them anymore, e.g. for downloads, if a user "deletes" a chapter of manga X and other users still have that chapter downloaded, nothing would get deleted.
but then how would you handle normal or cbz downloads which could be different per user

@Syer10
Copy link
Collaborator Author

Syer10 commented Aug 3, 2023

Library update could be per user, for this I think we would need a task that runs every 6 hours, grabs manga from users who's interval has passed(could be days for some users, 6 at the minimum), and then update them.

Downloader is more special, right now my idea is allow anyone to download, and the download queue will grab the user data based on the subscriber, this would allow unique user data to go to each user. This only works on gql, so the old websocket url won't have user data. Only admins would be able to delete files. Or we could make a userDeleted field in the chapter user data, and if all users who have that manga favorited have the userDeleted field true, then actually delete the file.

I think normal vs cbz downloads would be configured by the system administrator, not per user.

Everything on the filesystem doesn't need to be per user, since manga and chapter ids won't change between users, we dont need to separate anything.

Thats right, if we separate sources per user, rate-limits won't properly apply between http clients. We may have to make source settings global that only the admin can change hmm.

@schroda
Copy link
Collaborator

schroda commented Aug 5, 2023

Library update could be per user, for this I think we would need a task that runs every 6 hours, grabs manga from users who's interval has passed(could be days for some users, 6 at the minimum), and then update them.

I guess you would have to decrease the task to 1h since in case someone has it to update between every e.g. 6h and 12h then it would only get triggered every 12h

would this be one global updater or one per user?
in case it's one global updater - what about cases were one user has a huge library while another has a small one and gets "blocked" by the other user or would this be works as expected, and you just have to wait?
e.g. user A updates 50 mangas of source A and user B updates 10 mangas of source A, but they're at the end of the queue

same for the downloader I guess?

Or we could make a userDeleted field in the chapter user data, and if all users who have that manga favorited have the userDeleted field true, then actually delete the file.

I think that would be a better experience, since you don't have to manually clean up things that aren't needed anymore

We may have to make source settings global that only the admin can change hmm.

that are the preferences right? I think doing it like that would be the easiest way, but I guess there are also settings which would make sense to be per user instead of global
e.g. going by MangaDex:

  • "Data saver" would be something that has to be decided by the one that runs the server
  • "Alternative titles in description" could be per user?
  • "Default content rating" also per user?

@Syer10
Copy link
Collaborator Author

Syer10 commented Aug 5, 2023

There are technical limitations to source settings, since we need to have 1 source instance to preserve the rate-limit, we can't separate the sources per user, and since sources expect their settings to be in the source, we have to limit them to either be editable by everyone or admin only.

There are drawbacks to library update and downloader sharing, but its the best option we have. We could always sort manga update order according to the the ones that are used the most or updating the smaller libraries first. I think 6 hours is a fine interval, since we can always just bump the user to the next interval. If a user sets 24 hours, they will always get the update at the same time, or if a user selects 6 hours, they will always get updates.

@schroda
Copy link
Collaborator

schroda commented Aug 5, 2023

I think the limitations should be made quite clear in the documentation once that is in to prevent any wrong expectations

If the "global" update task runs every 6h then I think the possible update interval has to be changed to be only multiples of 6, since everything between them will be bumped to the next higher multiple

@Syer10
Copy link
Collaborator Author

Syer10 commented Aug 5, 2023

Hmm, right I was thinking in Tachiyomi library update terms, I forgot that users can set weird update times like every 7 hours. I think every hour would be fine then

# Conflicts:
#	server/build.gradle.kts
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/ChapterMutation.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/MangaMutation.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/server/subscriptions/ApolloSubscriptionProtocolHandler.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/server/subscriptions/ApolloSubscriptionSessionState.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/controller/UpdateController.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Library.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/update/Updater.kt
# Conflicts:
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/ChapterMutation.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/ExtensionMutation.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/CategoryQuery.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/ChapterQuery.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/ExtensionQuery.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/MangaQuery.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/MetaQuery.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/SourceQuery.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/controller/MangaController.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/chapter/ChapterForDownload.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/Downloader.kt
# Conflicts:
#	server/src/main/kotlin/suwayomi/tachidesk/global/controller/GlobalMetaController.kt
#	server/src/main/kotlin/suwayomi/tachidesk/global/controller/SettingsController.kt
#	server/src/main/kotlin/suwayomi/tachidesk/global/impl/GlobalMeta.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/dataLoaders/CategoryDataLoader.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/dataLoaders/ChapterDataLoader.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/dataLoaders/MangaDataLoader.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/dataLoaders/MetaDataLoader.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/BackupMutation.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/CategoryMutation.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/ChapterMutation.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/DownloadMutation.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/ExtensionMutation.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/MangaMutation.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/MetaMutation.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/SettingsMutation.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/SourceMutation.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/UpdateMutation.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/BackupQuery.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/CategoryQuery.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/ChapterQuery.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/ExtensionQuery.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/InfoQuery.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/MangaQuery.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/MetaQuery.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/SourceQuery.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/server/TachideskGraphQLContextFactory.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/server/TachideskGraphQLSchema.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/server/TachideskGraphQLServer.kt
#	server/src/main/kotlin/suwayomi/tachidesk/graphql/types/SettingsType.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/controller/BackupController.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/controller/CategoryController.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/controller/DownloadController.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/controller/ExtensionController.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/controller/MangaController.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/controller/SourceController.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/controller/UpdateController.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Category.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/CategoryManga.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Library.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Manga.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/MangaList.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Search.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/backup/proto/ProtoBackupExport.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/backup/proto/ProtoBackupImport.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/chapter/ChapterForDownload.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/DownloadManager.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/impl/update/Updater.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/model/table/CategoryTable.kt
#	server/src/main/kotlin/suwayomi/tachidesk/manga/model/table/ChapterTable.kt
#	server/src/main/kotlin/suwayomi/tachidesk/server/JavalinSetup.kt
#	server/src/test/kotlin/suwayomi/tachidesk/manga/impl/CategoryMangaTest.kt
#	server/src/test/kotlin/suwayomi/tachidesk/manga/impl/MangaTest.kt
#	server/src/test/kotlin/suwayomi/tachidesk/manga/impl/SearchTest.kt
@Syer10 Syer10 changed the title User Accounts [WIP] User Accounts Jan 24, 2024
@dhvcc
Copy link

dhvcc commented May 13, 2024

Hi, any progress on that? Would love to see that feature

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.

[Feature Request] Add Users Accounts on web login
3 participants