From 67ed6552b831df66713bac9e672738796128d33f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 23 Jun 2020 14:10:17 +0200 Subject: [PATCH] Reorganize client shared modules --- .../about-follows/about-follows.component.ts | 10 +- .../about-instance.component.ts | 10 +- .../about-instance/about-instance.resolver.ts | 11 +- .../contact-admin-modal.component.ts | 7 +- .../about-peertube-contributors.component.ts | 2 +- client/src/app/+about/about.module.ts | 21 +- .../account-about/account-about.component.ts | 7 +- .../account-video-channels.component.ts | 13 +- .../account-videos.component.ts | 23 +- .../src/app/+accounts/accounts.component.ts | 16 +- client/src/app/+accounts/accounts.module.ts | 21 +- client/src/app/+admin/admin-routing.module.ts | 8 +- client/src/app/+admin/admin.component.ts | 6 +- client/src/app/+admin/admin.module.ts | 52 +-- client/src/app/+admin/config/config.routes.ts | 2 +- .../edit-custom-config.component.ts | 16 +- .../+admin/config/shared/config.service.ts | 6 +- .../followers-list.component.ts | 11 +- .../following-list.component.ts | 14 +- .../src/app/+admin/follows/follows.routes.ts | 9 +- .../shared/redundancy-checkbox.component.ts | 2 +- .../follows/video-redundancies-list/index.ts | 1 + .../video-redundancies-list.component.ts | 12 +- client/src/app/+admin/moderation/index.ts | 1 + .../instance-account-blocklist.component.ts | 6 +- .../instance-server-blocklist.component.ts | 6 +- .../+admin/moderation/moderation.component.ts | 2 +- .../+admin/moderation/moderation.routes.ts | 8 +- .../moderation-comment-modal.component.ts | 8 +- .../video-abuse-details.component.ts | 5 +- .../video-abuse-list.component.ts | 25 +- .../video-block-list.component.ts | 18 +- .../plugin-list-installed.component.ts | 15 +- .../plugin-search/plugin-search.component.ts | 14 +- .../plugin-show-installed.component.ts | 15 +- .../plugins/shared/plugin-api.service.ts | 26 +- .../+admin/system/debug/debug.component.ts | 4 +- .../app/+admin/system/debug/debug.service.ts | 7 +- client/src/app/+admin/system/index.ts | 1 + .../src/app/+admin/system/jobs/job.service.ts | 9 +- .../app/+admin/system/jobs/jobs.component.ts | 12 +- .../app/+admin/system/logs/log-row.model.ts | 2 +- .../app/+admin/system/logs/logs.component.ts | 6 +- .../app/+admin/system/logs/logs.service.ts | 9 +- client/src/app/+admin/system/system.routes.ts | 12 +- .../users/user-edit/user-create.component.ts | 15 +- .../app/+admin/users/user-edit/user-edit.ts | 11 +- .../user-edit/user-password.component.ts | 10 +- .../users/user-edit/user-update.component.ts | 18 +- .../users/user-list/user-list.component.ts | 13 +- client/src/app/+admin/users/users.routes.ts | 8 +- ...-account-video-channel-create.component.ts | 9 +- ...-account-video-channel-edit.component.html | 0 ...-account-video-channel-edit.component.scss | 0 .../my-account-video-channel-edit.ts | 4 +- ...-account-video-channel-update.component.ts | 13 +- ...y-account-video-channels-routing.module.ts | 0 .../my-account-video-channels.component.html | 0 .../my-account-video-channels.component.scss | 0 .../my-account-video-channels.component.ts | 15 +- .../my-account-video-channels.module.ts | 18 +- .../my-account-blocklist.component.ts | 6 +- .../my-account-server-blocklist.component.ts | 6 +- .../my-account-history.component.ts | 25 +- .../my-account-notifications.component.ts | 2 +- .../my-account-accept-ownership.component.ts | 12 +- .../my-account-ownership.component.ts | 10 +- .../+my-account/my-account-routing.module.ts | 35 +- .../my-account-change-email.component.ts | 13 +- .../my-account-change-password.component.ts | 10 +- .../my-account-danger-zone.component.ts | 5 +- .../my-account-interface/index.ts | 1 - ...ount-notification-preferences.component.ts | 11 +- .../my-account-profile.component.ts | 9 +- .../my-account-settings.component.html | 4 +- .../my-account-settings.component.ts | 9 +- .../my-account-video-settings/index.ts | 1 - .../my-account-subscriptions.component.ts | 9 +- .../my-account-video-imports.component.ts | 9 +- ...account-video-playlist-create.component.ts | 9 +- .../my-account-video-playlist-edit.ts | 4 +- ...count-video-playlist-elements.component.ts | 19 +- ...account-video-playlist-update.component.ts | 16 +- .../my-account-video-playlists.component.ts | 13 +- .../my-account-videos.component.ts | 22 +- .../video-change-ownership.component.ts | 8 +- .../app/+my-account/my-account.component.ts | 2 +- .../src/app/+my-account/my-account.module.ts | 72 ++-- .../top-menu-dropdown.component.html | 0 .../top-menu-dropdown.component.scss | 0 .../top-menu-dropdown.component.ts | 15 +- .../+page-not-found/page-not-found.module.ts | 11 +- .../+register/register-routing.module.ts | 3 +- .../register-step-channel.component.ts | 10 +- .../+register/register-step-user.component.ts | 10 +- .../+signup/+register/register.component.ts | 16 +- .../app/+signup/+register/register.module.ts | 19 +- ...verify-account-ask-send-email.component.ts | 7 +- .../verify-account-email.component.ts | 6 +- .../+verify-account/verify-account.module.ts | 9 +- .../+signup/shared/signup-shared.module.ts | 14 +- .../video-channel-about.component.ts | 7 +- .../video-channel-playlists.component.ts | 14 +- .../video-channel-videos.component.ts | 23 +- .../video-channels-routing.module.ts | 6 +- .../video-channels.component.ts | 16 +- .../+video-channels/video-channels.module.ts | 21 +- client/src/app/app-routing.module.ts | 3 +- client/src/app/app.component.ts | 34 +- client/src/app/app.module.ts | 40 ++- client/src/app/core/auth/auth-user.model.ts | 18 +- client/src/app/core/auth/auth.service.ts | 13 +- client/src/app/core/core.module.ts | 48 ++- client/src/app/core/index.ts | 9 +- client/src/app/core/menu/menu.service.ts | 4 +- .../user-notification-socket.service.ts | 4 +- client/src/app/core/plugins/hooks.service.ts | 3 +- client/src/app/core/plugins/index.ts | 2 + client/src/app/core/plugins/plugin.service.ts | 44 +-- .../renderer/html-renderer.service.ts | 2 +- .../app/{shared => core}/renderer/index.ts | 0 .../renderer/linkifier.service.ts | 2 +- .../renderer/markdown.service.ts | 6 +- .../rest/component-pagination.model.ts | 0 client/src/app/{shared => core}/rest/index.ts | 3 +- .../rest/rest-extractor.service.ts | 4 +- .../{shared => core}/rest/rest-pagination.ts | 0 .../app/{shared => core}/rest/rest-table.ts | 2 +- .../app/{shared => core}/rest/rest.service.ts | 0 .../routing}/can-deactivate-guard.service.ts | 4 +- client/src/app/core/routing/index.ts | 9 +- .../app/core/routing/login-guard.service.ts | 1 - .../app/core/routing/menu-guard.service.ts | 4 +- .../routing/preload-selected-modules-list.ts | 1 + .../routing/server-config-resolver.service.ts | 2 +- .../core/routing/unlogged-guard.service.ts | 3 +- .../core/routing/user-right-guard.service.ts | 9 +- client/src/app/core/server/server.service.ts | 18 +- client/src/app/core/theme/theme.service.ts | 16 +- .../src/app/{shared => core}/users/index.ts | 1 - .../app/{shared => core}/users/user.model.ts | 14 +- .../{shared => core}/users/user.service.ts | 20 +- client/src/app/core/wrappers/index.ts | 2 + .../misc => core/wrappers}/screen.service.ts | 0 .../misc => core/wrappers}/storage.service.ts | 7 +- .../app/header/search-typeahead.component.ts | 7 +- client/src/app/header/suggestion.component.ts | 4 +- .../app/{shared/misc => helpers}/constants.ts | 0 .../{shared/i18n => helpers}/i18n-utils.ts | 2 +- client/src/app/helpers/index.ts | 6 + client/src/app/helpers/locales/index.ts | 1 + .../{shared/locale => helpers/locales}/oc.ts | 0 .../misc => helpers}/peertube-web-storage.ts | 0 .../src/app/{shared/misc => helpers}/utils.ts | 4 +- .../src/app/{shared/rxjs => helpers}/zone.ts | 0 client/src/app/login/login.component.ts | 18 +- client/src/app/login/login.module.ts | 10 +- .../app/menu/avatar-notification.component.ts | 11 +- .../app/menu/language-chooser.component.ts | 8 +- client/src/app/menu/menu.component.ts | 10 +- .../confirm => modal}/confirm.component.html | 0 .../confirm => modal}/confirm.component.scss | 0 .../confirm => modal}/confirm.component.ts | 6 +- ...instance-config-warning-modal.component.ts | 3 +- .../modal/quick-settings-modal.component.html | 8 +- .../modal/quick-settings-modal.component.ts | 11 +- .../src/app/modal/welcome-modal.component.ts | 3 +- .../reset-password-routing.module.ts | 2 - .../reset-password.component.ts | 6 +- .../reset-password/reset-password.module.ts | 8 +- .../src/app/search/advanced-search.model.ts | 3 +- .../angular => search}/highlight.pipe.ts | 0 .../app/search/search-filters.component.ts | 6 +- client/src/app/search/search.component.ts | 19 +- client/src/app/search/search.module.ts | 22 +- client/src/app/search/search.service.ts | 14 +- .../app/shared/angular/object-length.pipe.ts | 8 - client/src/app/shared/blocklist/index.ts | 4 - client/src/app/shared/forms/index.ts | 4 - client/src/app/shared/index.ts | 7 - client/src/app/shared/moderation/index.ts | 2 - client/src/app/shared/overview/index.ts | 1 - .../{forms => shared-forms}/form-reactive.ts | 2 +- .../batch-domains-validators.service.ts | 7 +- .../custom-config-validators.service.ts | 2 +- .../form-validators/form-validator.service.ts | 2 +- .../form-validators/host.ts | 0 .../form-validators/index.ts | 9 +- .../instance-validators.service.ts | 2 +- .../login-validators.service.ts | 2 +- .../reset-password-validators.service.ts | 2 +- .../user-validators.service.ts | 2 +- .../video-abuse-validators.service.ts | 2 +- ...deo-accept-ownership-validators.service.ts | 2 +- .../video-block-validators.service.ts | 2 +- .../video-captions-validators.service.ts | 2 +- ...deo-change-ownership-validators.service.ts | 2 +- .../video-channel-validators.service.ts | 2 +- .../video-comment-validators.service.ts | 2 +- .../video-playlist-validators.service.ts | 2 +- .../video-validators.service.ts | 2 +- client/src/app/shared/shared-forms/index.ts | 10 + .../input-readonly-copy.component.html | 0 .../input-readonly-copy.component.scss | 0 .../input-readonly-copy.component.ts | 0 .../markdown-textarea.component.html | 0 .../markdown-textarea.component.scss | 0 .../markdown-textarea.component.ts | 14 +- .../peertube-checkbox.component.html | 0 .../peertube-checkbox.component.scss | 0 .../peertube-checkbox.component.ts | 2 +- .../preview-upload.component.html | 0 .../preview-upload.component.scss | 0 .../preview-upload.component.ts | 0 .../reactive-file.component.html | 0 .../reactive-file.component.scss | 0 .../reactive-file.component.ts | 2 +- .../shared/shared-forms/shared-form.module.ts | 84 +++++ .../textarea-autoresize.directive.ts | 0 .../timestamp-input.component.html | 0 .../timestamp-input.component.scss | 0 .../timestamp-input.component.ts | 0 .../global-icon.component.scss | 0 .../global-icon.component.ts | 0 client/src/app/shared/shared-icons/index.ts | 3 + .../shared-icons/shared-global-icon.module.ts | 21 ++ .../feature-boolean.component.html | 0 .../feature-boolean.component.scss | 0 .../feature-boolean.component.ts | 0 .../src/app/shared/shared-instance/index.ts | 6 + .../instance-features-table.component.html | 0 .../instance-features-table.component.scss | 0 .../instance-features-table.component.ts | 0 .../instance-follow.service.ts} | 22 +- .../instance-statistics.component.html | 0 .../instance-statistics.component.scss | 0 .../instance-statistics.component.ts | 0 .../instance.service.ts | 10 +- .../shared-instance/shared-instance.module.ts | 32 ++ .../account/account.model.ts | 4 +- .../account/account.service.ts | 12 +- .../account}/actor-avatar-info.component.html | 0 .../account}/actor-avatar-info.component.scss | 0 .../account}/actor-avatar-info.component.ts | 10 +- .../account}/actor.model.ts | 5 +- .../account}/avatar.component.html | 0 .../account}/avatar.component.scss | 0 .../account}/avatar.component.ts | 0 .../app/shared/shared-main/account/index.ts | 5 + .../angular/from-now.pipe.ts | 0 .../app/shared/shared-main/angular/index.ts | 4 + .../angular}/infinite-scroller.directive.ts | 0 .../angular/number-formatter.pipe.ts | 0 .../angular/peertube-template.directive.ts | 0 .../auth/auth-interceptor.service.ts | 4 +- .../shared/{ => shared-main}/auth/index.ts | 0 .../buttons/action-dropdown.component.html | 0 .../buttons/action-dropdown.component.scss | 0 .../buttons/action-dropdown.component.ts | 2 +- .../buttons/button.component.html | 0 .../buttons/button.component.scss | 0 .../buttons/button.component.ts | 2 +- .../buttons/delete-button.component.html | 0 .../buttons/delete-button.component.ts | 0 .../buttons/edit-button.component.html | 0 .../buttons/edit-button.component.ts | 0 .../app/shared/shared-main/buttons/index.ts | 4 + .../date/date-toggle.component.html | 0 .../date/date-toggle.component.scss | 0 .../date/date-toggle.component.ts | 5 +- .../src/app/shared/shared-main/date/index.ts | 1 + .../feeds}/feed.component.html | 0 .../feeds}/feed.component.scss | 0 .../feeds}/feed.component.ts | 2 +- .../src/app/shared/shared-main/feeds/index.ts | 2 + .../feeds}/syndication.model.ts | 2 +- client/src/app/shared/shared-main/index.ts | 12 + .../app/shared/shared-main/loaders/index.ts | 2 + .../loaders}/loader.component.html | 0 .../loaders}/loader.component.scss | 0 .../loaders}/loader.component.ts | 0 .../loaders}/small-loader.component.html | 0 .../loaders}/small-loader.component.ts | 0 .../misc/help.component.html | 0 .../misc/help.component.scss | 0 .../{ => shared-main}/misc/help.component.ts | 4 +- .../src/app/shared/shared-main/misc/index.ts | 2 + .../misc/list-overflow.component.html | 0 .../misc/list-overflow.component.scss | 0 .../misc/list-overflow.component.ts | 6 +- .../shared/shared-main/shared-main.module.ts | 164 +++++++++ .../src/app/shared/shared-main/users/index.ts | 4 + .../users/user-history.service.ts | 12 +- .../users/user-notification.model.ts | 4 +- .../users/user-notification.service.ts | 15 +- .../users/user-notifications.component.html | 0 .../users/user-notifications.component.scss | 0 .../users/user-notifications.component.ts | 11 +- .../shared/shared-main/video-caption/index.ts | 2 + .../video-caption/video-caption-edit.model.ts | 0 .../video-caption/video-caption.service.ts | 14 +- .../shared/shared-main/video-channel/index.ts | 2 + .../video-channel/video-channel.model.ts | 5 +- .../video-channel/video-channel.service.ts | 16 +- .../src/app/shared/shared-main/video/index.ts | 7 + .../video/redundancy.service.ts | 8 +- .../video/video-details.model.ts | 17 +- .../video/video-edit.model.ts | 5 +- .../video}/video-import.service.ts | 17 +- .../video}/video-ownership.service.ts | 13 +- .../{ => shared-main}/video/video.model.ts | 24 +- .../{ => shared-main}/video/video.service.ts | 59 +-- .../account-block.model.ts | 4 +- .../account-blocklist.component.html | 0 .../account-blocklist.component.scss | 0 .../account-blocklist.component.ts | 9 +- .../batch-domains-modal.component.html | 0 .../batch-domains-modal.component.scss | 0 .../batch-domains-modal.component.ts | 8 +- .../blocklist.service.ts | 14 +- .../bulk.service.ts | 9 +- .../src/app/shared/shared-moderation/index.ts | 13 + .../server-blocklist.component.html | 0 .../server-blocklist.component.scss | 0 .../server-blocklist.component.ts | 17 +- .../shared-moderation.module.ts | 46 +++ .../user-ban-modal.component.html | 0 .../user-ban-modal.component.scss | 0 .../user-ban-modal.component.ts | 10 +- .../user-moderation-dropdown.component.html | 0 .../user-moderation-dropdown.component.ts | 15 +- .../video-abuse.service.ts | 10 +- .../video-block.component.html | 0 .../video-block.component.scss | 0 .../video-block.component.ts | 11 +- .../video-block.service.ts | 10 +- .../video-report.component.html | 0 .../video-report.component.scss | 0 .../video-report.component.ts | 18 +- .../src/app/shared/shared-thumbnail/index.ts | 2 + .../shared-thumbnail.module.ts | 23 ++ .../video-thumbnail.component.html | 0 .../video-thumbnail.component.scss | 0 .../video-thumbnail.component.ts | 4 +- .../app/shared/shared-user-settings/index.ts | 4 + .../shared-user-settings.module.ts | 26 ++ .../user-interface-settings.component.html} | 0 .../user-interface-settings.component.scss} | 0 .../user-interface-settings.component.ts} | 21 +- .../user-video-settings.component.html} | 0 .../user-video-settings.component.scss} | 0 .../user-video-settings.component.ts} | 25 +- .../index.ts | 2 + .../remote-subscribe.component.html | 0 .../remote-subscribe.component.scss | 0 .../remote-subscribe.component.ts | 6 +- .../shared-user-subscription.module.ts | 29 ++ .../subscribe-button.component.html | 0 .../subscribe-button.component.scss | 0 .../subscribe-button.component.ts | 12 +- .../user-subscription.service.ts | 39 +- .../abstract-video-list.html | 0 .../abstract-video-list.scss | 0 .../abstract-video-list.ts | 30 +- .../shared/shared-video-miniature/index.ts | 7 + .../shared-video-miniature.module.ts | 40 +++ .../video-actions-dropdown.component.html | 0 .../video-actions-dropdown.component.scss | 0 .../video-actions-dropdown.component.ts | 19 +- .../video-download.component.html | 0 .../video-download.component.scss | 0 .../video-download.component.ts | 14 +- .../video-miniature.component.html | 0 .../video-miniature.component.scss | 0 .../video-miniature.component.ts | 10 +- .../videos-selection.component.html | 0 .../videos-selection.component.scss | 0 .../videos-selection.component.ts | 18 +- .../app/shared/shared-video-playlist/index.ts | 8 + .../shared-video-playlist.module.ts | 36 ++ .../video-add-to-playlist.component.html | 0 .../video-add-to-playlist.component.scss | 0 .../video-add-to-playlist.component.ts | 14 +- ...-playlist-element-miniature.component.html | 0 ...-playlist-element-miniature.component.scss | 0 ...eo-playlist-element-miniature.component.ts | 19 +- .../video-playlist-element.model.ts | 2 +- .../video-playlist-miniature.component.html | 0 .../video-playlist-miniature.component.scss | 0 .../video-playlist-miniature.component.ts | 2 +- .../video-playlist.model.ts | 9 +- .../video-playlist.service.ts | 44 ++- client/src/app/shared/shared.module.ts | 337 ------------------ client/src/app/shared/video-abuse/index.ts | 1 - client/src/app/shared/video-block/index.ts | 1 - client/src/app/shared/video-caption/index.ts | 1 - client/src/app/shared/video-import/index.ts | 1 - .../src/app/shared/video-ownership/index.ts | 1 - .../src/app/shared/video/sort-field.type.ts | 10 - .../shared/i18n-primeng-calendar.service.ts} | 0 .../video-caption-add-modal.component.ts | 8 +- .../shared/video-edit.component.ts | 26 +- .../+video-edit/shared/video-edit.module.ts | 16 +- .../video-import-torrent.component.ts | 18 +- .../video-import-url.component.ts | 20 +- .../video-add-components/video-send.ts | 16 +- .../video-upload.component.ts | 19 +- .../+video-edit/video-add-routing.module.ts | 5 +- .../videos/+video-edit/video-add.component.ts | 9 +- .../videos/+video-edit/video-add.module.ts | 23 +- .../video-update-routing.module.ts | 7 +- .../+video-edit/video-update.component.ts | 12 +- .../videos/+video-edit/video-update.module.ts | 13 +- .../+video-edit/video-update.resolver.ts | 8 +- .../comment/video-comment-add.component.ts | 15 +- .../video-comment-thread-tree.model.ts | 4 +- .../comment/video-comment.component.ts | 14 +- .../comment/video-comment.model.ts | 7 +- .../comment/video-comment.service.ts | 17 +- .../comment/video-comments.component.ts | 21 +- .../modal/video-share.component.ts | 8 +- .../modal/video-support.component.ts | 4 +- .../timestamp-route-transformer.directive.ts | 0 .../video-duration-formatter.pipe.ts | 0 .../video-watch-playlist.component.ts | 13 +- .../video-watch-routing.module.ts | 2 - .../+video-watch/video-watch.component.ts | 42 +-- .../videos/+video-watch/video-watch.module.ts | 34 +- .../recent-videos-recommendation.service.ts | 10 +- .../recommendation-info.model.ts | 0 .../recommendations/recommendations.module.ts | 19 +- .../recommendations.service.ts | 4 +- .../recommended-videos.component.ts | 15 +- .../recommended-videos.store.ts | 12 +- client/src/app/videos/video-list/index.ts | 1 + .../app/videos/video-list/overview/index.ts | 3 + .../video-list}/overview/overview.service.ts | 15 +- .../video-overview.component.html | 0 .../video-overview.component.scss | 0 .../video-overview.component.ts | 10 +- .../overview/videos-overview.model.ts | 4 +- .../video-list/video-local.component.ts | 22 +- .../video-list/video-most-liked.component.ts | 20 +- .../video-recently-added.component.ts | 20 +- .../video-list/video-trending.component.ts | 20 +- .../video-user-subscriptions.component.ts | 25 +- .../src/app/videos/videos-routing.module.ts | 4 +- client/src/app/videos/videos.module.ts | 21 +- server/controllers/api/users/me.ts | 21 +- server/lib/auth.ts | 2 +- server/lib/plugins/plugin-helpers.ts | 2 +- server/lib/plugins/plugin-manager.ts | 28 +- server/lib/plugins/register-helpers-store.ts | 26 +- server/models/utils.ts | 18 - server/types/index.ts | 3 + .../types/models/account/account-blocklist.ts | 2 +- server/types/models/account/account.ts | 2 +- server/types/models/account/actor-follow.ts | 2 +- server/types/models/account/actor.ts | 2 +- server/types/models/account/avatar.ts | 2 +- server/types/models/oauth/oauth-token.ts | 2 +- .../types/models/server/server-blocklist.ts | 2 +- server/types/models/server/server.ts | 2 +- server/types/models/user/user-notification.ts | 2 +- server/types/models/user/user.ts | 2 +- .../models/video/schedule-video-update.ts | 2 +- server/types/models/video/video-abuse.ts | 2 +- server/types/models/video/video-blacklist.ts | 2 +- server/types/models/video/video-caption.ts | 2 +- .../models/video/video-change-ownership.ts | 2 +- server/types/models/video/video-channels.ts | 2 +- server/types/models/video/video-comment.ts | 2 +- server/types/models/video/video-file.ts | 2 +- server/types/models/video/video-import.ts | 2 +- .../models/video/video-playlist-element.ts | 2 +- server/types/models/video/video-playlist.ts | 2 +- server/types/models/video/video-rate.ts | 2 +- server/types/models/video/video-redundancy.ts | 2 +- server/types/models/video/video-share.ts | 2 +- .../models/video/video-streaming-playlist.ts | 2 +- server/types/models/video/video.ts | 2 +- .../index.d.ts => types/plugins/index.ts} | 3 +- .../plugins/plugin-library.model.ts | 0 .../plugins/register-server-auth.model.ts | 4 +- .../plugins/register-server-option.model.ts | 26 +- server/typings/express/index.d.ts | 28 +- shared/core-utils/index.ts | 3 + shared/core-utils/logs/index.ts | 1 + shared/core-utils/miscs/index.ts | 3 + .../core-utils/miscs/types.ts | 17 + shared/core-utils/plugins/index.ts | 1 + shared/extra-utils/server/config.ts | 2 +- shared/models/actors/index.ts | 1 + shared/models/index.ts | 3 +- shared/models/plugins/index.ts | 24 ++ .../plugin-playlist-privacy-manager.model.ts | 2 +- .../plugin-video-privacy-manager.model.ts | 2 +- shared/models/search/index.ts | 1 + shared/models/server/index.ts | 1 + shared/models/users/index.ts | 10 +- shared/models/videos/abuse/index.ts | 5 + shared/models/videos/blacklist/index.ts | 3 + shared/models/videos/caption/index.ts | 2 + shared/models/videos/channel/index.ts | 3 + shared/models/videos/import/index.ts | 3 + shared/models/videos/index.ts | 63 ++-- shared/models/videos/playlist/index.ts | 10 + shared/models/videos/rate/index.ts | 5 + shared/models/videos/video-file-metadata.ts | 4 +- shared/models/videos/video-sort-field.type.ts | 8 + 510 files changed, 2282 insertions(+), 2212 deletions(-) rename client/src/app/+my-account/{my-account-video-channels => +my-account-video-channels}/my-account-video-channel-create.component.ts (86%) rename client/src/app/+my-account/{my-account-video-channels => +my-account-video-channels}/my-account-video-channel-edit.component.html (100%) rename client/src/app/+my-account/{my-account-video-channels => +my-account-video-channels}/my-account-video-channel-edit.component.scss (100%) rename client/src/app/+my-account/{my-account-video-channels => +my-account-video-channels}/my-account-video-channel-edit.ts (81%) rename client/src/app/+my-account/{my-account-video-channels => +my-account-video-channels}/my-account-video-channel-update.component.ts (89%) rename client/src/app/+my-account/{my-account-video-channels => +my-account-video-channels}/my-account-video-channels-routing.module.ts (100%) rename client/src/app/+my-account/{my-account-video-channels => +my-account-video-channels}/my-account-video-channels.component.html (100%) rename client/src/app/+my-account/{my-account-video-channels => +my-account-video-channels}/my-account-video-channels.component.scss (100%) rename client/src/app/+my-account/{my-account-video-channels => +my-account-video-channels}/my-account-video-channels.component.ts (91%) rename client/src/app/+my-account/{my-account-video-channels => +my-account-video-channels}/my-account-video-channels.module.ts (73%) delete mode 100644 client/src/app/+my-account/my-account-settings/my-account-interface/index.ts delete mode 100644 client/src/app/+my-account/my-account-settings/my-account-video-settings/index.ts rename client/src/app/{shared/menu => +my-account}/top-menu-dropdown.component.html (100%) rename client/src/app/{shared/menu => +my-account}/top-menu-dropdown.component.scss (100%) rename client/src/app/{shared/menu => +my-account}/top-menu-dropdown.component.ts (91%) create mode 100644 client/src/app/core/plugins/index.ts rename client/src/app/{shared => core}/renderer/html-renderer.service.ts (93%) rename client/src/app/{shared => core}/renderer/index.ts (100%) rename client/src/app/{shared => core}/renderer/linkifier.service.ts (98%) rename client/src/app/{shared => core}/renderer/markdown.service.ts (97%) rename client/src/app/{shared => core}/rest/component-pagination.model.ts (100%) rename client/src/app/{shared => core}/rest/index.ts (75%) rename client/src/app/{shared => core}/rest/rest-extractor.service.ts (97%) rename client/src/app/{shared => core}/rest/rest-pagination.ts (100%) rename client/src/app/{shared => core}/rest/rest-table.ts (96%) rename client/src/app/{shared => core}/rest/rest.service.ts (100%) rename client/src/app/{shared/guards => core/routing}/can-deactivate-guard.service.ts (94%) rename client/src/app/{shared => core}/users/index.ts (56%) rename client/src/app/{shared => core}/users/user.model.ts (89%) rename client/src/app/{shared => core}/users/user.service.ts (95%) create mode 100644 client/src/app/core/wrappers/index.ts rename client/src/app/{shared/misc => core/wrappers}/screen.service.ts (100%) rename client/src/app/{shared/misc => core/wrappers}/storage.service.ts (92%) rename client/src/app/{shared/misc => helpers}/constants.ts (100%) rename client/src/app/{shared/i18n => helpers}/i18n-utils.ts (76%) create mode 100644 client/src/app/helpers/index.ts create mode 100644 client/src/app/helpers/locales/index.ts rename client/src/app/{shared/locale => helpers/locales}/oc.ts (100%) rename client/src/app/{shared/misc => helpers}/peertube-web-storage.ts (100%) rename client/src/app/{shared/misc => helpers}/utils.ts (98%) rename client/src/app/{shared/rxjs => helpers}/zone.ts (100%) rename client/src/app/{shared/confirm => modal}/confirm.component.html (100%) rename client/src/app/{shared/confirm => modal}/confirm.component.scss (100%) rename client/src/app/{shared/confirm => modal}/confirm.component.ts (92%) rename client/src/app/{shared/angular => search}/highlight.pipe.ts (100%) delete mode 100644 client/src/app/shared/angular/object-length.pipe.ts delete mode 100644 client/src/app/shared/blocklist/index.ts delete mode 100644 client/src/app/shared/forms/index.ts delete mode 100644 client/src/app/shared/index.ts delete mode 100644 client/src/app/shared/moderation/index.ts delete mode 100644 client/src/app/shared/overview/index.ts rename client/src/app/shared/{forms => shared-forms}/form-reactive.ts (96%) rename client/src/app/{+admin/config/shared => shared/shared-forms/form-validators}/batch-domains-validators.service.ts (91%) rename client/src/app/shared/{forms => shared-forms}/form-validators/custom-config-validators.service.ts (98%) rename client/src/app/shared/{forms => shared-forms}/form-validators/form-validator.service.ts (98%) rename client/src/app/shared/{forms => shared-forms}/form-validators/host.ts (100%) rename client/src/app/shared/{forms => shared-forms}/form-validators/index.ts (93%) rename client/src/app/shared/{forms => shared-forms}/form-validators/instance-validators.service.ts (96%) rename client/src/app/shared/{forms => shared-forms}/form-validators/login-validators.service.ts (91%) rename client/src/app/shared/{forms => shared-forms}/form-validators/reset-password-validators.service.ts (88%) rename client/src/app/shared/{forms => shared-forms}/form-validators/user-validators.service.ts (98%) rename client/src/app/shared/{forms => shared-forms}/form-validators/video-abuse-validators.service.ts (94%) rename client/src/app/shared/{forms => shared-forms}/form-validators/video-accept-ownership-validators.service.ts (87%) rename client/src/app/shared/{forms => shared-forms}/form-validators/video-block-validators.service.ts (90%) rename client/src/app/shared/{forms => shared-forms}/form-validators/video-captions-validators.service.ts (91%) rename client/src/app/shared/{forms => shared-forms}/form-validators/video-change-ownership-validators.service.ts (92%) rename client/src/app/shared/{forms => shared-forms}/form-validators/video-channel-validators.service.ts (97%) rename client/src/app/shared/{forms => shared-forms}/form-validators/video-comment-validators.service.ts (91%) rename client/src/app/shared/{forms => shared-forms}/form-validators/video-playlist-validators.service.ts (97%) rename client/src/app/shared/{forms => shared-forms}/form-validators/video-validators.service.ts (97%) create mode 100644 client/src/app/shared/shared-forms/index.ts rename client/src/app/shared/{forms => shared-forms}/input-readonly-copy.component.html (100%) rename client/src/app/shared/{forms => shared-forms}/input-readonly-copy.component.scss (100%) rename client/src/app/shared/{forms => shared-forms}/input-readonly-copy.component.ts (100%) rename client/src/app/shared/{forms => shared-forms}/markdown-textarea.component.html (100%) rename client/src/app/shared/{forms => shared-forms}/markdown-textarea.component.scss (100%) rename client/src/app/shared/{forms => shared-forms}/markdown-textarea.component.ts (89%) rename client/src/app/shared/{forms => shared-forms}/peertube-checkbox.component.html (100%) rename client/src/app/shared/{forms => shared-forms}/peertube-checkbox.component.scss (100%) rename client/src/app/shared/{forms => shared-forms}/peertube-checkbox.component.ts (95%) rename client/src/app/shared/{images => shared-forms}/preview-upload.component.html (100%) rename client/src/app/shared/{images => shared-forms}/preview-upload.component.scss (100%) rename client/src/app/shared/{images => shared-forms}/preview-upload.component.ts (100%) rename client/src/app/shared/{forms => shared-forms}/reactive-file.component.html (100%) rename client/src/app/shared/{forms => shared-forms}/reactive-file.component.scss (100%) rename client/src/app/shared/{forms => shared-forms}/reactive-file.component.ts (96%) create mode 100644 client/src/app/shared/shared-forms/shared-form.module.ts rename client/src/app/shared/{forms => shared-forms}/textarea-autoresize.directive.ts (100%) rename client/src/app/shared/{forms => shared-forms}/timestamp-input.component.html (100%) rename client/src/app/shared/{forms => shared-forms}/timestamp-input.component.scss (100%) rename client/src/app/shared/{forms => shared-forms}/timestamp-input.component.ts (100%) rename client/src/app/shared/{images => shared-icons}/global-icon.component.scss (100%) rename client/src/app/shared/{images => shared-icons}/global-icon.component.ts (100%) create mode 100644 client/src/app/shared/shared-icons/index.ts create mode 100644 client/src/app/shared/shared-icons/shared-global-icon.module.ts rename client/src/app/shared/{instance => shared-instance}/feature-boolean.component.html (100%) rename client/src/app/shared/{instance => shared-instance}/feature-boolean.component.scss (100%) rename client/src/app/shared/{instance => shared-instance}/feature-boolean.component.ts (100%) create mode 100644 client/src/app/shared/shared-instance/index.ts rename client/src/app/shared/{instance => shared-instance}/instance-features-table.component.html (100%) rename client/src/app/shared/{instance => shared-instance}/instance-features-table.component.scss (100%) rename client/src/app/shared/{instance => shared-instance}/instance-features-table.component.ts (100%) rename client/src/app/shared/{instance/follow.service.ts => shared-instance/instance-follow.service.ts} (79%) rename client/src/app/shared/{instance => shared-instance}/instance-statistics.component.html (100%) rename client/src/app/shared/{instance => shared-instance}/instance-statistics.component.scss (100%) rename client/src/app/shared/{instance => shared-instance}/instance-statistics.component.ts (100%) rename client/src/app/shared/{instance => shared-instance}/instance.service.ts (89%) create mode 100644 client/src/app/shared/shared-instance/shared-instance.module.ts rename client/src/app/shared/{ => shared-main}/account/account.model.ts (84%) rename client/src/app/shared/{ => shared-main}/account/account.service.ts (69%) rename client/src/app/{+my-account/shared => shared/shared-main/account}/actor-avatar-info.component.html (100%) rename client/src/app/{+my-account/shared => shared/shared-main/account}/actor-avatar-info.component.scss (100%) rename client/src/app/{+my-account/shared => shared/shared-main/account}/actor-avatar-info.component.ts (88%) rename client/src/app/shared/{actor => shared-main/account}/actor.model.ts (87%) rename client/src/app/shared/{channel => shared-main/account}/avatar.component.html (100%) rename client/src/app/shared/{channel => shared-main/account}/avatar.component.scss (100%) rename client/src/app/shared/{channel => shared-main/account}/avatar.component.ts (100%) create mode 100644 client/src/app/shared/shared-main/account/index.ts rename client/src/app/shared/{ => shared-main}/angular/from-now.pipe.ts (100%) create mode 100644 client/src/app/shared/shared-main/angular/index.ts rename client/src/app/shared/{video => shared-main/angular}/infinite-scroller.directive.ts (100%) rename client/src/app/shared/{ => shared-main}/angular/number-formatter.pipe.ts (100%) rename client/src/app/shared/{ => shared-main}/angular/peertube-template.directive.ts (100%) rename client/src/app/shared/{ => shared-main}/auth/auth-interceptor.service.ts (97%) rename client/src/app/shared/{ => shared-main}/auth/index.ts (100%) rename client/src/app/shared/{ => shared-main}/buttons/action-dropdown.component.html (100%) rename client/src/app/shared/{ => shared-main}/buttons/action-dropdown.component.scss (100%) rename client/src/app/shared/{ => shared-main}/buttons/action-dropdown.component.ts (95%) rename client/src/app/shared/{ => shared-main}/buttons/button.component.html (100%) rename client/src/app/shared/{ => shared-main}/buttons/button.component.scss (100%) rename client/src/app/shared/{ => shared-main}/buttons/button.component.ts (85%) rename client/src/app/shared/{ => shared-main}/buttons/delete-button.component.html (100%) rename client/src/app/shared/{ => shared-main}/buttons/delete-button.component.ts (100%) rename client/src/app/shared/{ => shared-main}/buttons/edit-button.component.html (100%) rename client/src/app/shared/{ => shared-main}/buttons/edit-button.component.ts (100%) create mode 100644 client/src/app/shared/shared-main/buttons/index.ts rename client/src/app/shared/{ => shared-main}/date/date-toggle.component.html (100%) rename client/src/app/shared/{ => shared-main}/date/date-toggle.component.scss (100%) rename client/src/app/shared/{ => shared-main}/date/date-toggle.component.ts (85%) create mode 100644 client/src/app/shared/shared-main/date/index.ts rename client/src/app/shared/{video => shared-main/feeds}/feed.component.html (100%) rename client/src/app/shared/{video => shared-main/feeds}/feed.component.scss (100%) rename client/src/app/shared/{video => shared-main/feeds}/feed.component.ts (78%) create mode 100644 client/src/app/shared/shared-main/feeds/index.ts rename client/src/app/shared/{video => shared-main/feeds}/syndication.model.ts (51%) create mode 100644 client/src/app/shared/shared-main/index.ts create mode 100644 client/src/app/shared/shared-main/loaders/index.ts rename client/src/app/shared/{misc => shared-main/loaders}/loader.component.html (100%) rename client/src/app/shared/{misc => shared-main/loaders}/loader.component.scss (100%) rename client/src/app/shared/{misc => shared-main/loaders}/loader.component.ts (100%) rename client/src/app/shared/{misc => shared-main/loaders}/small-loader.component.html (100%) rename client/src/app/shared/{misc => shared-main/loaders}/small-loader.component.ts (100%) rename client/src/app/shared/{ => shared-main}/misc/help.component.html (100%) rename client/src/app/shared/{ => shared-main}/misc/help.component.scss (100%) rename client/src/app/shared/{ => shared-main}/misc/help.component.ts (94%) create mode 100644 client/src/app/shared/shared-main/misc/index.ts rename client/src/app/shared/{ => shared-main}/misc/list-overflow.component.html (100%) rename client/src/app/shared/{ => shared-main}/misc/list-overflow.component.scss (100%) rename client/src/app/shared/{ => shared-main}/misc/list-overflow.component.ts (98%) create mode 100644 client/src/app/shared/shared-main/shared-main.module.ts create mode 100644 client/src/app/shared/shared-main/users/index.ts rename client/src/app/shared/{ => shared-main}/users/user-history.service.ts (79%) rename client/src/app/shared/{ => shared-main}/users/user-notification.model.ts (96%) rename client/src/app/shared/{ => shared-main}/users/user-notification.service.ts (87%) rename client/src/app/shared/{ => shared-main}/users/user-notifications.component.html (100%) rename client/src/app/shared/{ => shared-main}/users/user-notifications.component.scss (100%) rename client/src/app/shared/{ => shared-main}/users/user-notifications.component.ts (87%) create mode 100644 client/src/app/shared/shared-main/video-caption/index.ts rename client/src/app/shared/{ => shared-main}/video-caption/video-caption-edit.model.ts (100%) rename client/src/app/shared/{ => shared-main}/video-caption/video-caption.service.ts (85%) create mode 100644 client/src/app/shared/shared-main/video-channel/index.ts rename client/src/app/shared/{ => shared-main}/video-channel/video-channel.model.ts (84%) rename client/src/app/shared/{ => shared-main}/video-channel/video-channel.service.ts (86%) create mode 100644 client/src/app/shared/shared-main/video/index.ts rename client/src/app/shared/{ => shared-main}/video/redundancy.service.ts (97%) rename client/src/app/shared/{ => shared-main}/video/video-details.model.ts (73%) rename client/src/app/shared/{ => shared-main}/video/video-edit.model.ts (91%) rename client/src/app/shared/{video-import => shared-main/video}/video-import.service.ts (85%) rename client/src/app/shared/{video-ownership => shared-main/video}/video-ownership.service.ts (81%) rename client/src/app/shared/{ => shared-main}/video/video.model.ts (88%) rename client/src/app/shared/{ => shared-main}/video/video.service.ts (84%) rename client/src/app/shared/{blocklist => shared-moderation}/account-block.model.ts (72%) rename client/src/app/shared/{blocklist => shared-moderation}/account-blocklist.component.html (100%) rename client/src/app/shared/{blocklist => shared-moderation}/account-blocklist.component.scss (100%) rename client/src/app/shared/{blocklist => shared-moderation}/account-blocklist.component.ts (91%) rename client/src/app/{+admin/config/shared => shared/shared-moderation}/batch-domains-modal.component.html (100%) rename client/src/app/{+admin/config/shared => shared/shared-moderation}/batch-domains-modal.component.scss (100%) rename client/src/app/{+admin/config/shared => shared/shared-moderation}/batch-domains-modal.component.ts (81%) rename client/src/app/shared/{blocklist => shared-moderation}/blocklist.service.ts (96%) rename client/src/app/shared/{bulk => shared-moderation}/bulk.service.ts (75%) create mode 100644 client/src/app/shared/shared-moderation/index.ts rename client/src/app/shared/{blocklist => shared-moderation}/server-blocklist.component.html (100%) rename client/src/app/shared/{blocklist => shared-moderation}/server-blocklist.component.scss (100%) rename client/src/app/shared/{blocklist => shared-moderation}/server-blocklist.component.ts (89%) create mode 100644 client/src/app/shared/shared-moderation/shared-moderation.module.ts rename client/src/app/shared/{moderation => shared-moderation}/user-ban-modal.component.html (100%) rename client/src/app/shared/{moderation => shared-moderation}/user-ban-modal.component.scss (100%) rename client/src/app/shared/{moderation => shared-moderation}/user-ban-modal.component.ts (86%) rename client/src/app/shared/{moderation => shared-moderation}/user-moderation-dropdown.component.html (100%) rename client/src/app/shared/{moderation => shared-moderation}/user-moderation-dropdown.component.ts (95%) rename client/src/app/shared/{video-abuse => shared-moderation}/video-abuse.service.ts (96%) rename client/src/app/shared/{video/modals => shared-moderation}/video-block.component.html (100%) rename client/src/app/shared/{video/modals => shared-moderation}/video-block.component.scss (100%) rename client/src/app/shared/{video/modals => shared-moderation}/video-block.component.ts (85%) rename client/src/app/shared/{video-block => shared-moderation}/video-block.service.ts (91%) rename client/src/app/shared/{video/modals => shared-moderation}/video-report.component.html (100%) rename client/src/app/shared/{video/modals => shared-moderation}/video-report.component.scss (100%) rename client/src/app/shared/{video/modals => shared-moderation}/video-report.component.ts (90%) create mode 100644 client/src/app/shared/shared-thumbnail/index.ts create mode 100644 client/src/app/shared/shared-thumbnail/shared-thumbnail.module.ts rename client/src/app/shared/{video => shared-thumbnail}/video-thumbnail.component.html (100%) rename client/src/app/shared/{video => shared-thumbnail}/video-thumbnail.component.scss (100%) rename client/src/app/shared/{video => shared-thumbnail}/video-thumbnail.component.ts (93%) create mode 100644 client/src/app/shared/shared-user-settings/index.ts create mode 100644 client/src/app/shared/shared-user-settings/shared-user-settings.module.ts rename client/src/app/{+my-account/my-account-settings/my-account-interface/my-account-interface-settings.component.html => shared/shared-user-settings/user-interface-settings.component.html} (100%) rename client/src/app/{+my-account/my-account-settings/my-account-interface/my-account-interface-settings.component.scss => shared/shared-user-settings/user-interface-settings.component.scss} (100%) rename client/src/app/{+my-account/my-account-settings/my-account-interface/my-account-interface-settings.component.ts => shared/shared-user-settings/user-interface-settings.component.ts} (72%) rename client/src/app/{+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html => shared/shared-user-settings/user-video-settings.component.html} (100%) rename client/src/app/{+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.scss => shared/shared-user-settings/user-video-settings.component.scss} (100%) rename client/src/app/{+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts => shared/shared-user-settings/user-video-settings.component.ts} (85%) rename client/src/app/shared/{user-subscription => shared-user-subscription}/index.ts (72%) rename client/src/app/shared/{user-subscription => shared-user-subscription}/remote-subscribe.component.html (100%) rename client/src/app/shared/{user-subscription => shared-user-subscription}/remote-subscribe.component.scss (100%) rename client/src/app/shared/{user-subscription => shared-user-subscription}/remote-subscribe.component.ts (91%) create mode 100644 client/src/app/shared/shared-user-subscription/shared-user-subscription.module.ts rename client/src/app/shared/{user-subscription => shared-user-subscription}/subscribe-button.component.html (100%) rename client/src/app/shared/{user-subscription => shared-user-subscription}/subscribe-button.component.scss (100%) rename client/src/app/shared/{user-subscription => shared-user-subscription}/subscribe-button.component.ts (92%) rename client/src/app/shared/{user-subscription => shared-user-subscription}/user-subscription.service.ts (82%) rename client/src/app/shared/{video => shared-video-miniature}/abstract-video-list.html (100%) rename client/src/app/shared/{video => shared-video-miniature}/abstract-video-list.scss (100%) rename client/src/app/shared/{video => shared-video-miniature}/abstract-video-list.ts (90%) create mode 100644 client/src/app/shared/shared-video-miniature/index.ts create mode 100644 client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts rename client/src/app/shared/{video => shared-video-miniature}/video-actions-dropdown.component.html (100%) rename client/src/app/shared/{video => shared-video-miniature}/video-actions-dropdown.component.scss (100%) rename client/src/app/shared/{video => shared-video-miniature}/video-actions-dropdown.component.ts (88%) rename client/src/app/shared/{video/modals => shared-video-miniature}/video-download.component.html (100%) rename client/src/app/shared/{video/modals => shared-video-miniature}/video-download.component.scss (100%) rename client/src/app/shared/{video/modals => shared-video-miniature}/video-download.component.ts (96%) rename client/src/app/shared/{video => shared-video-miniature}/video-miniature.component.html (100%) rename client/src/app/shared/{video => shared-video-miniature}/video-miniature.component.scss (100%) rename client/src/app/shared/{video => shared-video-miniature}/video-miniature.component.ts (95%) rename client/src/app/shared/{video => shared-video-miniature}/videos-selection.component.html (100%) rename client/src/app/shared/{video => shared-video-miniature}/videos-selection.component.scss (100%) rename client/src/app/shared/{video => shared-video-miniature}/videos-selection.component.ts (79%) create mode 100644 client/src/app/shared/shared-video-playlist/index.ts create mode 100644 client/src/app/shared/shared-video-playlist/shared-video-playlist.module.ts rename client/src/app/shared/{video-playlist => shared-video-playlist}/video-add-to-playlist.component.html (100%) rename client/src/app/shared/{video-playlist => shared-video-playlist}/video-add-to-playlist.component.scss (100%) rename client/src/app/shared/{video-playlist => shared-video-playlist}/video-add-to-playlist.component.ts (94%) rename client/src/app/shared/{video-playlist => shared-video-playlist}/video-playlist-element-miniature.component.html (100%) rename client/src/app/shared/{video-playlist => shared-video-playlist}/video-playlist-element-miniature.component.scss (100%) rename client/src/app/shared/{video-playlist => shared-video-playlist}/video-playlist-element-miniature.component.ts (90%) rename client/src/app/shared/{video-playlist => shared-video-playlist}/video-playlist-element.model.ts (92%) rename client/src/app/shared/{video-playlist => shared-video-playlist}/video-playlist-miniature.component.html (100%) rename client/src/app/shared/{video-playlist => shared-video-playlist}/video-playlist-miniature.component.scss (100%) rename client/src/app/shared/{video-playlist => shared-video-playlist}/video-playlist-miniature.component.ts (89%) rename client/src/app/shared/{video-playlist => shared-video-playlist}/video-playlist.model.ts (91%) rename client/src/app/shared/{video-playlist => shared-video-playlist}/video-playlist.service.ts (89%) delete mode 100644 client/src/app/shared/shared.module.ts delete mode 100644 client/src/app/shared/video-abuse/index.ts delete mode 100644 client/src/app/shared/video-block/index.ts delete mode 100644 client/src/app/shared/video-caption/index.ts delete mode 100644 client/src/app/shared/video-import/index.ts delete mode 100644 client/src/app/shared/video-ownership/index.ts delete mode 100644 client/src/app/shared/video/sort-field.type.ts rename client/src/app/{shared/i18n/i18n-primeng-calendar.ts => videos/+video-edit/shared/i18n-primeng-calendar.service.ts} (100%) rename client/src/app/{shared/angular => videos/+video-watch}/timestamp-route-transformer.directive.ts (100%) rename client/src/app/{shared/angular => videos/+video-watch}/video-duration-formatter.pipe.ts (100%) rename client/src/app/{shared/video => videos/recommendations}/recommendation-info.model.ts (100%) create mode 100644 client/src/app/videos/video-list/overview/index.ts rename client/src/app/{shared => videos/video-list}/overview/overview.service.ts (83%) rename client/src/app/videos/video-list/{ => overview}/video-overview.component.html (100%) rename client/src/app/videos/video-list/{ => overview}/video-overview.component.scss (100%) rename client/src/app/videos/video-list/{ => overview}/video-overview.component.ts (87%) rename client/src/app/{shared => videos/video-list}/overview/videos-overview.model.ts (76%) create mode 100644 server/types/index.ts rename server/{typings/plugins/index.d.ts => types/plugins/index.ts} (65%) rename server/{typings => types}/plugins/plugin-library.model.ts (100%) rename {shared/models => server/types}/plugins/register-server-auth.model.ts (96%) rename server/{typings => types}/plugins/register-server-option.model.ts (66%) create mode 100644 shared/core-utils/index.ts create mode 100644 shared/core-utils/logs/index.ts create mode 100644 shared/core-utils/miscs/index.ts rename server/types/utils.ts => shared/core-utils/miscs/types.ts (51%) create mode 100644 shared/core-utils/plugins/index.ts create mode 100644 shared/models/plugins/index.ts create mode 100644 shared/models/videos/abuse/index.ts create mode 100644 shared/models/videos/blacklist/index.ts create mode 100644 shared/models/videos/caption/index.ts create mode 100644 shared/models/videos/channel/index.ts create mode 100644 shared/models/videos/import/index.ts create mode 100644 shared/models/videos/playlist/index.ts create mode 100644 shared/models/videos/rate/index.ts create mode 100644 shared/models/videos/video-sort-field.type.ts diff --git a/client/src/app/+about/about-follows/about-follows.component.ts b/client/src/app/+about/about-follows/about-follows.component.ts index fc265fecb..17c6903b8 100644 --- a/client/src/app/+about/about-follows/about-follows.component.ts +++ b/client/src/app/+about/about-follows/about-follows.component.ts @@ -1,10 +1,8 @@ -import { Component, OnInit } from '@angular/core' -import { FollowService } from '@app/shared/instance/follow.service' -import { ComponentPagination, hasMoreItems } from '@app/shared/rest/component-pagination.model' -import { Notifier } from '@app/core' -import { RestService } from '@app/shared' import { SortMeta } from 'primeng/api' import { Subject } from 'rxjs' +import { Component, OnInit } from '@angular/core' +import { ComponentPagination, hasMoreItems, Notifier, RestService } from '@app/core' +import { InstanceFollowService } from '@app/shared/shared-instance' @Component({ selector: 'my-about-follows', @@ -38,7 +36,7 @@ export class AboutFollowsComponent implements OnInit { constructor ( private restService: RestService, private notifier: Notifier, - private followService: FollowService + private followService: InstanceFollowService ) { } ngOnInit () { diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.ts index 15841be74..c57ac69ab 100644 --- a/client/src/app/+about/about-instance/about-instance.component.ts +++ b/client/src/app/+about/about-instance/about-instance.component.ts @@ -1,11 +1,11 @@ -import { Component, OnInit, ViewChild, AfterViewChecked } from '@angular/core' -import { Notifier, ServerService } from '@app/core' +import { ViewportScroller } from '@angular/common' +import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' +import { ActivatedRoute } from '@angular/router' import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' -import { InstanceService } from '@app/shared/instance/instance.service' +import { ServerService } from '@app/core' +import { InstanceService } from '@app/shared/shared-instance' import { ServerConfig } from '@shared/models' -import { ActivatedRoute } from '@angular/router' import { ResolverData } from './about-instance.resolver' -import { ViewportScroller } from '@angular/common' @Component({ selector: 'my-about-instance', diff --git a/client/src/app/+about/about-instance/about-instance.resolver.ts b/client/src/app/+about/about-instance/about-instance.resolver.ts index 94c6abe5a..b2349ba12 100644 --- a/client/src/app/+about/about-instance/about-instance.resolver.ts +++ b/client/src/app/+about/about-instance/about-instance.resolver.ts @@ -1,17 +1,16 @@ +import { forkJoin } from 'rxjs' +import { map, switchMap } from 'rxjs/operators' import { Injectable } from '@angular/core' import { ActivatedRouteSnapshot, Resolve } from '@angular/router' -import { map, switchMap } from 'rxjs/operators' -import { forkJoin } from 'rxjs' -import { InstanceService } from '@app/shared/instance/instance.service' +import { InstanceService } from '@app/shared/shared-instance' import { About } from '@shared/models/server' export type ResolverData = { about: About, languages: string[], categories: string[] } @Injectable() export class AboutInstanceResolver implements Resolve { - constructor ( - private instanceService: InstanceService - ) {} + + constructor (private instanceService: InstanceService) {} resolve (route: ActivatedRouteSnapshot) { return this.instanceService.getAbout() diff --git a/client/src/app/+about/about-instance/contact-admin-modal.component.ts b/client/src/app/+about/about-instance/contact-admin-modal.component.ts index d5e146b82..5199402e6 100644 --- a/client/src/app/+about/about-instance/contact-admin-modal.component.ts +++ b/client/src/app/+about/about-instance/contact-admin-modal.component.ts @@ -1,11 +1,10 @@ import { Component, OnInit, ViewChild } from '@angular/core' import { Notifier, ServerService } from '@app/core' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' +import { FormReactive, FormValidatorService, InstanceValidatorsService } from '@app/shared/shared-forms' +import { InstanceService } from '@app/shared/shared-instance' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { FormReactive, InstanceValidatorsService } from '@app/shared' -import { InstanceService } from '@app/shared/instance/instance.service' +import { I18n } from '@ngx-translate/i18n-polyfill' import { ServerConfig } from '@shared/models' @Component({ diff --git a/client/src/app/+about/about-peertube/about-peertube-contributors.component.ts b/client/src/app/+about/about-peertube/about-peertube-contributors.component.ts index fa2c0daa0..da1fcdc92 100644 --- a/client/src/app/+about/about-peertube/about-peertube-contributors.component.ts +++ b/client/src/app/+about/about-peertube/about-peertube-contributors.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core' -import { MarkdownService } from '@app/shared/renderer' +import { MarkdownService } from '@app/core' @Component({ selector: 'my-about-peertube-contributors', diff --git a/client/src/app/+about/about.module.ts b/client/src/app/+about/about.module.ts index 84d697540..1aca14033 100644 --- a/client/src/app/+about/about.module.ts +++ b/client/src/app/+about/about.module.ts @@ -1,18 +1,25 @@ import { NgModule } from '@angular/core' -import { AboutRoutingModule } from './about-routing.module' -import { AboutComponent } from './about.component' -import { SharedModule } from '../shared' +import { AboutFollowsComponent } from '@app/+about/about-follows/about-follows.component' import { AboutInstanceComponent } from '@app/+about/about-instance/about-instance.component' -import { AboutPeertubeComponent } from '@app/+about/about-peertube/about-peertube.component' +import { AboutInstanceResolver } from '@app/+about/about-instance/about-instance.resolver' import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' -import { AboutFollowsComponent } from '@app/+about/about-follows/about-follows.component' import { AboutPeertubeContributorsComponent } from '@app/+about/about-peertube/about-peertube-contributors.component' -import { AboutInstanceResolver } from '@app/+about/about-instance/about-instance.resolver' +import { AboutPeertubeComponent } from '@app/+about/about-peertube/about-peertube.component' +import { SharedFormModule } from '@app/shared/shared-forms' +import { SharedGlobalIconModule } from '@app/shared/shared-icons' +import { SharedInstanceModule } from '@app/shared/shared-instance' +import { SharedMainModule } from '@app/shared/shared-main' +import { AboutRoutingModule } from './about-routing.module' +import { AboutComponent } from './about.component' @NgModule({ imports: [ AboutRoutingModule, - SharedModule + + SharedMainModule, + SharedFormModule, + SharedInstanceModule, + SharedGlobalIconModule ], declarations: [ diff --git a/client/src/app/+accounts/account-about/account-about.component.ts b/client/src/app/+accounts/account-about/account-about.component.ts index d1616490f..8c01e4007 100644 --- a/client/src/app/+accounts/account-about/account-about.component.ts +++ b/client/src/app/+accounts/account-about/account-about.component.ts @@ -1,9 +1,8 @@ +import { Subscription } from 'rxjs' import { Component, OnDestroy, OnInit } from '@angular/core' -import { Account } from '@app/shared/account/account.model' -import { AccountService } from '@app/shared/account/account.service' +import { MarkdownService } from '@app/core' +import { Account, AccountService } from '@app/shared/shared-main' import { I18n } from '@ngx-translate/i18n-polyfill' -import { Subscription } from 'rxjs' -import { MarkdownService } from '@app/shared/renderer' @Component({ selector: 'my-account-about', diff --git a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts index eba1acfa1..205245675 100644 --- a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts +++ b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts @@ -1,16 +1,9 @@ import { from, Subject, Subscription } from 'rxjs' import { concatMap, map, switchMap, tap } from 'rxjs/operators' import { Component, OnDestroy, OnInit } from '@angular/core' -import { User, UserService } from '@app/shared' -import { Account } from '@app/shared/account/account.model' -import { AccountService } from '@app/shared/account/account.service' -import { ScreenService } from '@app/shared/misc/screen.service' -import { ComponentPagination, hasMoreItems } from '@app/shared/rest/component-pagination.model' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { VideoSortField } from '@app/shared/video/sort-field.type' -import { Video } from '@app/shared/video/video.model' -import { VideoService } from '@app/shared/video/video.service' +import { ComponentPagination, hasMoreItems, ScreenService, User, UserService } from '@app/core' +import { Account, AccountService, Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' +import { VideoSortField } from '@shared/models' @Component({ selector: 'my-account-video-channels', diff --git a/client/src/app/+accounts/account-videos/account-videos.component.ts b/client/src/app/+accounts/account-videos/account-videos.component.ts index 41b27b541..dd47589c1 100644 --- a/client/src/app/+accounts/account-videos/account-videos.component.ts +++ b/client/src/app/+accounts/account-videos/account-videos.component.ts @@ -1,25 +1,18 @@ +import { Subscription } from 'rxjs' +import { first, tap } from 'rxjs/operators' import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { immutableAssign } from '@app/shared/misc/utils' -import { AuthService } from '../../core/auth' -import { ConfirmService } from '../../core/confirm' -import { AbstractVideoList } from '../../shared/video/abstract-video-list' -import { VideoService } from '../../shared/video/video.service' -import { Account } from '@app/shared/account/account.model' -import { AccountService } from '@app/shared/account/account.service' -import { first, tap } from 'rxjs/operators' +import { AuthService, ConfirmService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' +import { immutableAssign } from '@app/helpers' +import { Account, AccountService, VideoService } from '@app/shared/shared-main' +import { AbstractVideoList } from '@app/shared/shared-video-miniature' import { I18n } from '@ngx-translate/i18n-polyfill' -import { Subscription } from 'rxjs' -import { ScreenService } from '@app/shared/misc/screen.service' -import { Notifier, ServerService } from '@app/core' -import { UserService } from '@app/shared' -import { LocalStorageService } from '@app/shared/misc/storage.service' @Component({ selector: 'my-account-videos', - templateUrl: '../../shared/video/abstract-video-list.html', + templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html', styleUrls: [ - '../../shared/video/abstract-video-list.scss', + '../../shared/shared-video-miniature/abstract-video-list.scss', './account-videos.component.scss' ] }) diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts index bf71179f3..01911cac2 100644 --- a/client/src/app/+accounts/accounts.component.ts +++ b/client/src/app/+accounts/accounts.component.ts @@ -1,17 +1,11 @@ +import { Subscription } from 'rxjs' +import { catchError, distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators' import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute } from '@angular/router' -import { AccountService } from '@app/shared/account/account.service' -import { Account } from '@app/shared/account/account.model' -import { RestExtractor, UserService } from '@app/shared' -import { catchError, distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators' -import { Subscription } from 'rxjs' -import { AuthService, Notifier, RedirectService } from '@app/core' -import { User, UserRight } from '../../../../shared' +import { AuthService, Notifier, RedirectService, RestExtractor, ScreenService, UserService } from '@app/core' +import { Account, AccountService, ListOverflowItem, VideoChannel, VideoChannelService } from '@app/shared/shared-main' import { I18n } from '@ngx-translate/i18n-polyfill' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' -import { ListOverflowItem } from '@app/shared/misc/list-overflow.component' -import { ScreenService } from '@app/shared/misc/screen.service' +import { User, UserRight } from '@shared/models' @Component({ templateUrl: './accounts.component.html', diff --git a/client/src/app/+accounts/accounts.module.ts b/client/src/app/+accounts/accounts.module.ts index 8e679822a..815360341 100644 --- a/client/src/app/+accounts/accounts.module.ts +++ b/client/src/app/+accounts/accounts.module.ts @@ -1,15 +1,26 @@ import { NgModule } from '@angular/core' -import { SharedModule } from '../shared' -import { AccountsRoutingModule } from './accounts-routing.module' -import { AccountsComponent } from './accounts.component' -import { AccountVideosComponent } from './account-videos/account-videos.component' +import { SharedFormModule } from '@app/shared/shared-forms' +import { SharedGlobalIconModule } from '@app/shared/shared-icons' +import { SharedMainModule } from '@app/shared/shared-main' +import { SharedModerationModule } from '@app/shared/shared-moderation' +import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription' +import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' import { AccountAboutComponent } from './account-about/account-about.component' import { AccountVideoChannelsComponent } from './account-video-channels/account-video-channels.component' +import { AccountVideosComponent } from './account-videos/account-videos.component' +import { AccountsRoutingModule } from './accounts-routing.module' +import { AccountsComponent } from './accounts.component' @NgModule({ imports: [ AccountsRoutingModule, - SharedModule + + SharedMainModule, + SharedFormModule, + SharedUserSubscriptionModule, + SharedModerationModule, + SharedVideoMiniatureModule, + SharedGlobalIconModule ], declarations: [ diff --git a/client/src/app/+admin/admin-routing.module.ts b/client/src/app/+admin/admin-routing.module.ts index 79c57221b..986dae8eb 100644 --- a/client/src/app/+admin/admin-routing.module.ts +++ b/client/src/app/+admin/admin-routing.module.ts @@ -1,15 +1,13 @@ import { NgModule } from '@angular/core' import { RouterModule, Routes } from '@angular/router' import { ConfigRoutes } from '@app/+admin/config' - +import { ModerationRoutes } from '@app/+admin/moderation/moderation.routes' +import { PluginsRoutes } from '@app/+admin/plugins/plugins.routes' +import { SystemRoutes } from '@app/+admin/system' import { MetaGuard } from '@ngx-meta/core' - import { AdminComponent } from './admin.component' import { FollowsRoutes } from './follows' import { UsersRoutes } from './users' -import { ModerationRoutes } from '@app/+admin/moderation/moderation.routes' -import { SystemRoutes } from '@app/+admin/system' -import { PluginsRoutes } from '@app/+admin/plugins/plugins.routes' const adminRoutes: Routes = [ { diff --git a/client/src/app/+admin/admin.component.ts b/client/src/app/+admin/admin.component.ts index a97a33cf5..e47c7a8f4 100644 --- a/client/src/app/+admin/admin.component.ts +++ b/client/src/app/+admin/admin.component.ts @@ -1,8 +1,8 @@ import { Component, OnInit } from '@angular/core' -import { UserRight } from '../../../../shared' -import { AuthService } from '../core/auth/auth.service' -import { ListOverflowItem } from '@app/shared/misc/list-overflow.component' +import { AuthService } from '@app/core' +import { ListOverflowItem } from '@app/shared/shared-main' import { I18n } from '@ngx-translate/i18n-polyfill' +import { UserRight } from '@shared/models' @Component({ templateUrl: './admin.component.html' diff --git a/client/src/app/+admin/admin.module.ts b/client/src/app/+admin/admin.module.ts index eccec8a49..728227a84 100644 --- a/client/src/app/+admin/admin.module.ts +++ b/client/src/app/+admin/admin.module.ts @@ -1,39 +1,41 @@ -import { NgModule } from '@angular/core' -import { ConfigComponent, EditCustomConfigComponent } from '@app/+admin/config' -import { ConfigService } from '@app/+admin/config/shared/config.service' +import { ChartModule } from 'primeng/chart' +import { SelectButtonModule } from 'primeng/selectbutton' import { TableModule } from 'primeng/table' -import { SharedModule } from '../shared' +import { NgModule } from '@angular/core' +import { SharedFormModule } from '@app/shared/shared-forms' +import { SharedGlobalIconModule } from '@app/shared/shared-icons' +import { SharedMainModule } from '@app/shared/shared-main' +import { SharedModerationModule } from '@app/shared/shared-moderation' import { AdminRoutingModule } from './admin-routing.module' import { AdminComponent } from './admin.component' +import { ConfigComponent, EditCustomConfigComponent } from './config' +import { ConfigService } from './config/shared/config.service' import { FollowersListComponent, FollowsComponent, VideoRedundanciesListComponent } from './follows' import { FollowingListComponent } from './follows/following-list/following-list.component' -import { UserCreateComponent, UserListComponent, UserPasswordComponent, UsersComponent, UserUpdateComponent } from './users' -import { - ModerationCommentModalComponent, - VideoAbuseListComponent, - VideoBlockListComponent -} from './moderation' -import { ModerationComponent } from '@app/+admin/moderation/moderation.component' -import { RedundancyCheckboxComponent } from '@app/+admin/follows/shared/redundancy-checkbox.component' -import { InstanceAccountBlocklistComponent, InstanceServerBlocklistComponent } from '@app/+admin/moderation/instance-blocklist' -import { JobsComponent } from '@app/+admin/system/jobs/jobs.component' -import { JobService, LogsComponent, LogsService, SystemComponent } from '@app/+admin/system' -import { DebugComponent, DebugService } from '@app/+admin/system/debug' -import { PluginsComponent } from '@app/+admin/plugins/plugins.component' -import { PluginListInstalledComponent } from '@app/+admin/plugins/plugin-list-installed/plugin-list-installed.component' -import { PluginSearchComponent } from '@app/+admin/plugins/plugin-search/plugin-search.component' -import { PluginShowInstalledComponent } from '@app/+admin/plugins/plugin-show-installed/plugin-show-installed.component' -import { SelectButtonModule } from 'primeng/selectbutton' -import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service' -import { VideoRedundancyInformationComponent } from '@app/+admin/follows/video-redundancies-list/video-redundancy-information.component' -import { ChartModule } from 'primeng/chart' +import { RedundancyCheckboxComponent } from './follows/shared/redundancy-checkbox.component' +import { VideoRedundancyInformationComponent } from './follows/video-redundancies-list/video-redundancy-information.component' +import { ModerationCommentModalComponent, VideoAbuseListComponent, VideoBlockListComponent } from './moderation' +import { InstanceAccountBlocklistComponent, InstanceServerBlocklistComponent } from './moderation/instance-blocklist' +import { ModerationComponent } from './moderation/moderation.component' import { VideoAbuseDetailsComponent } from './moderation/video-abuse-list/video-abuse-details.component' +import { PluginListInstalledComponent } from './plugins/plugin-list-installed/plugin-list-installed.component' +import { PluginSearchComponent } from './plugins/plugin-search/plugin-search.component' +import { PluginShowInstalledComponent } from './plugins/plugin-show-installed/plugin-show-installed.component' +import { PluginsComponent } from './plugins/plugins.component' +import { PluginApiService } from './plugins/shared/plugin-api.service' +import { JobService, LogsComponent, LogsService, SystemComponent } from './system' +import { DebugComponent, DebugService } from './system/debug' +import { JobsComponent } from './system/jobs/jobs.component' +import { UserCreateComponent, UserListComponent, UserPasswordComponent, UsersComponent, UserUpdateComponent } from './users' @NgModule({ imports: [ AdminRoutingModule, - SharedModule, + SharedMainModule, + SharedFormModule, + SharedModerationModule, + SharedGlobalIconModule, TableModule, SelectButtonModule, diff --git a/client/src/app/+admin/config/config.routes.ts b/client/src/app/+admin/config/config.routes.ts index 2ca2f8fde..7c1a1a166 100644 --- a/client/src/app/+admin/config/config.routes.ts +++ b/client/src/app/+admin/config/config.routes.ts @@ -1,7 +1,7 @@ import { Routes } from '@angular/router' import { EditCustomConfigComponent } from '@app/+admin/config/edit-custom-config' import { UserRightGuard } from '@app/core' -import { UserRight } from '../../../../../shared/models/users' +import { UserRight } from '@shared/models' import { ConfigComponent } from './config.component' export const ConfigRoutes: Routes = [ diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index 3a47ba25e..69629770f 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts @@ -1,16 +1,14 @@ -import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' -import { ConfigService } from '@app/+admin/config/shared/config.service' -import { ServerService } from '@app/core/server/server.service' -import { CustomConfigValidatorsService, FormReactive, UserValidatorsService } from '@app/shared' -import { Notifier } from '@app/core' -import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' import { SelectItem } from 'primeng/api' import { forkJoin } from 'rxjs' -import { ServerConfig } from '@shared/models' import { ViewportScroller } from '@angular/common' +import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' +import { ConfigService } from '@app/+admin/config/shared/config.service' +import { Notifier } from '@app/core' +import { ServerService } from '@app/core/server/server.service' +import { CustomConfigValidatorsService, FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' import { NgbNav } from '@ng-bootstrap/ng-bootstrap' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { CustomConfig, ServerConfig } from '@shared/models' @Component({ selector: 'my-edit-custom-config', diff --git a/client/src/app/+admin/config/shared/config.service.ts b/client/src/app/+admin/config/shared/config.service.ts index 874b8094d..f182946b8 100644 --- a/client/src/app/+admin/config/shared/config.service.ts +++ b/client/src/app/+admin/config/shared/config.service.ts @@ -1,10 +1,10 @@ import { catchError } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' -import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model' -import { environment } from '../../../../environments/environment' -import { RestExtractor } from '../../../shared' +import { RestExtractor } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' +import { CustomConfig } from '@shared/models' +import { environment } from '../../../../environments/environment' @Injectable() export class ConfigService { diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts index 17352a601..63135f898 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts @@ -1,10 +1,9 @@ -import { Component, OnInit } from '@angular/core' -import { ConfirmService, Notifier } from '@app/core' import { SortMeta } from 'primeng/api' -import { ActorFollow } from '../../../../../../shared/models/actors/follow.model' -import { RestPagination, RestTable } from '../../../shared' -import { FollowService } from '@app/shared/instance/follow.service' +import { Component, OnInit } from '@angular/core' +import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' +import { InstanceFollowService } from '@app/shared/shared-instance' import { I18n } from '@ngx-translate/i18n-polyfill' +import { ActorFollow } from '@shared/models' @Component({ selector: 'my-followers-list', @@ -21,7 +20,7 @@ export class FollowersListComponent extends RestTable implements OnInit { private confirmService: ConfirmService, private notifier: Notifier, private i18n: I18n, - private followService: FollowService + private followService: InstanceFollowService ) { super() } diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts index 6ddbf02d6..dae8923b5 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.ts +++ b/client/src/app/+admin/follows/following-list/following-list.component.ts @@ -1,12 +1,10 @@ -import { Component, OnInit, ViewChild } from '@angular/core' -import { Notifier } from '@app/core' import { SortMeta } from 'primeng/api' -import { ActorFollow } from '../../../../../../shared/models/actors/follow.model' -import { ConfirmService } from '../../../core/confirm/confirm.service' -import { RestPagination, RestTable } from '../../../shared' -import { FollowService } from '@app/shared/instance/follow.service' +import { Component, OnInit, ViewChild } from '@angular/core' +import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' +import { InstanceFollowService } from '@app/shared/shared-instance' +import { BatchDomainsModalComponent } from '@app/shared/shared-moderation' import { I18n } from '@ngx-translate/i18n-polyfill' -import { BatchDomainsModalComponent } from '@app/+admin/config/shared/batch-domains-modal.component' +import { ActorFollow } from '@shared/models' @Component({ selector: 'my-followers-list', @@ -24,7 +22,7 @@ export class FollowingListComponent extends RestTable implements OnInit { constructor ( private notifier: Notifier, private confirmService: ConfirmService, - private followService: FollowService, + private followService: InstanceFollowService, private i18n: I18n ) { super() diff --git a/client/src/app/+admin/follows/follows.routes.ts b/client/src/app/+admin/follows/follows.routes.ts index 8270ae444..817074536 100644 --- a/client/src/app/+admin/follows/follows.routes.ts +++ b/client/src/app/+admin/follows/follows.routes.ts @@ -1,11 +1,10 @@ import { Routes } from '@angular/router' - -import { UserRightGuard } from '../../core' -import { FollowsComponent } from './follows.component' +import { VideoRedundanciesListComponent } from '@app/+admin/follows/video-redundancies-list' +import { UserRightGuard } from '@app/core' +import { UserRight } from '@shared/models' import { FollowersListComponent } from './followers-list' -import { UserRight } from '../../../../../shared' import { FollowingListComponent } from './following-list/following-list.component' -import { VideoRedundanciesListComponent } from '@app/+admin/follows/video-redundancies-list' +import { FollowsComponent } from './follows.component' export const FollowsRoutes: Routes = [ { diff --git a/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts b/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts index 9d7883d97..662143abc 100644 --- a/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts +++ b/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts @@ -1,7 +1,7 @@ import { Component, Input } from '@angular/core' import { Notifier } from '@app/core' +import { RedundancyService } from '@app/shared/shared-main' import { I18n } from '@ngx-translate/i18n-polyfill' -import { RedundancyService } from '@app/shared/video/redundancy.service' @Component({ selector: 'my-redundancy-checkbox', diff --git a/client/src/app/+admin/follows/video-redundancies-list/index.ts b/client/src/app/+admin/follows/video-redundancies-list/index.ts index 6a7c7f483..07e734b1a 100644 --- a/client/src/app/+admin/follows/video-redundancies-list/index.ts +++ b/client/src/app/+admin/follows/video-redundancies-list/index.ts @@ -1 +1,2 @@ export * from './video-redundancies-list.component' +export * from './video-redundancy-information.component' diff --git a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts index 267a1f58e..0048882bc 100644 --- a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts +++ b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts @@ -1,14 +1,12 @@ -import { Component, OnInit } from '@angular/core' -import { Notifier, ServerService } from '@app/core' +import { BytesPipe } from 'ngx-pipes' import { SortMeta } from 'primeng/api' -import { ConfirmService } from '../../../core/confirm/confirm.service' -import { RestPagination, RestTable } from '../../../shared' +import { Component, OnInit } from '@angular/core' +import { ConfirmService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' +import { peertubeLocalStorage } from '@app/helpers/peertube-web-storage' +import { RedundancyService } from '@app/shared/shared-main' import { I18n } from '@ngx-translate/i18n-polyfill' import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' -import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' import { VideosRedundancyStats } from '@shared/models/server' -import { BytesPipe } from 'ngx-pipes' -import { RedundancyService } from '@app/shared/video/redundancy.service' @Component({ selector: 'my-video-redundancies-list', diff --git a/client/src/app/+admin/moderation/index.ts b/client/src/app/+admin/moderation/index.ts index e99244b74..16249236c 100644 --- a/client/src/app/+admin/moderation/index.ts +++ b/client/src/app/+admin/moderation/index.ts @@ -1,3 +1,4 @@ +export * from './instance-blocklist' export * from './video-abuse-list' export * from './video-block-list' export * from './moderation.component' diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts index 90a176194..d9fec29ce 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts @@ -1,10 +1,10 @@ import { Component } from '@angular/core' -import { GenericAccountBlocklistComponent, BlocklistComponentType } from '@app/shared/blocklist' +import { BlocklistComponentType, GenericAccountBlocklistComponent } from '@app/shared/shared-moderation' @Component({ selector: 'my-instance-account-blocklist', - styleUrls: [ '../moderation.component.scss', '../../../shared/blocklist/account-blocklist.component.scss' ], - templateUrl: '../../../shared/blocklist/account-blocklist.component.html' + styleUrls: [ '../moderation.component.scss', '../../../shared/shared-moderation/account-blocklist.component.scss' ], + templateUrl: '../../../shared/shared-moderation/account-blocklist.component.html' }) export class InstanceAccountBlocklistComponent extends GenericAccountBlocklistComponent { mode = BlocklistComponentType.Instance diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts index 9d4ec174a..3afae529f 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts @@ -1,10 +1,10 @@ import { Component } from '@angular/core' -import { GenericServerBlocklistComponent, BlocklistComponentType } from '@app/shared/blocklist' +import { GenericServerBlocklistComponent, BlocklistComponentType } from '@app/shared/shared-moderation' @Component({ selector: 'my-instance-server-blocklist', - styleUrls: [ '../../../shared/blocklist/server-blocklist.component.scss' ], - templateUrl: '../../../shared/blocklist/server-blocklist.component.html' + styleUrls: [ '../../../shared/shared-moderation/server-blocklist.component.scss' ], + templateUrl: '../../../shared/shared-moderation/server-blocklist.component.html' }) export class InstanceServerBlocklistComponent extends GenericServerBlocklistComponent { mode = BlocklistComponentType.Instance diff --git a/client/src/app/+admin/moderation/moderation.component.ts b/client/src/app/+admin/moderation/moderation.component.ts index 1b1df6f09..806f9d100 100644 --- a/client/src/app/+admin/moderation/moderation.component.ts +++ b/client/src/app/+admin/moderation/moderation.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core' -import { UserRight } from '../../../../../shared' import { AuthService, ServerService } from '@app/core' +import { UserRight } from '@shared/models' @Component({ templateUrl: './moderation.component.html', diff --git a/client/src/app/+admin/moderation/moderation.routes.ts b/client/src/app/+admin/moderation/moderation.routes.ts index c08333f17..cd837bcb9 100644 --- a/client/src/app/+admin/moderation/moderation.routes.ts +++ b/client/src/app/+admin/moderation/moderation.routes.ts @@ -1,10 +1,10 @@ import { Routes } from '@angular/router' -import { UserRight } from '../../../../../shared' -import { UserRightGuard } from '@app/core' +import { InstanceAccountBlocklistComponent, InstanceServerBlocklistComponent } from '@app/+admin/moderation/instance-blocklist' +import { ModerationComponent } from '@app/+admin/moderation/moderation.component' import { VideoAbuseListComponent } from '@app/+admin/moderation/video-abuse-list' import { VideoBlockListComponent } from '@app/+admin/moderation/video-block-list' -import { ModerationComponent } from '@app/+admin/moderation/moderation.component' -import { InstanceAccountBlocklistComponent, InstanceServerBlocklistComponent } from '@app/+admin/moderation/instance-blocklist' +import { UserRightGuard } from '@app/core' +import { UserRight } from '@shared/models' export const ModerationRoutes: Routes = [ { diff --git a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts index a0471f2b0..3cd763ca4 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts @@ -1,11 +1,11 @@ import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' import { Notifier } from '@app/core' -import { FormReactive, VideoAbuseService, VideoAbuseValidatorsService } from '../../../shared' -import { I18n } from '@ngx-translate/i18n-polyfill' +import { FormReactive, FormValidatorService, VideoAbuseValidatorsService } from '@app/shared/shared-forms' +import { VideoAbuseService } from '@app/shared/shared-moderation' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { FormValidatorService } from '../../../shared/forms/form-validators/form-validator.service' -import { VideoAbuse } from '../../../../../../shared/models/videos' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoAbuse } from '@shared/models' @Component({ selector: 'my-moderation-comment-modal', diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.ts index 13485124f..9aa70288d 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.ts @@ -1,9 +1,8 @@ import { Component, Input } from '@angular/core' -import { Actor } from '@app/shared/actor/actor.model' +import { Actor } from '@app/shared/shared-main' +import { I18n } from '@ngx-translate/i18n-polyfill' import { VideoAbusePredefinedReasonsString } from '../../../../../../shared/models/videos/abuse/video-abuse-reason.model' import { ProcessedVideoAbuse } from './video-abuse-list.component' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { durationToString } from '@app/shared/misc/utils' @Component({ selector: 'my-video-abuse-details', diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts index d7f5beef3..b0a655e71 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts @@ -1,23 +1,16 @@ -import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core' -import { Account } from '@app/shared/account/account.model' -import { Notifier } from '@app/core' import { SortMeta } from 'primeng/api' -import { VideoAbuse, VideoAbuseState } from '../../../../../../shared' -import { RestPagination, RestTable, VideoAbuseService, VideoBlockService } from '../../../shared' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { DropdownAction } from '../../../shared/buttons/action-dropdown.component' -import { ConfirmService } from '../../../core/index' -import { ModerationCommentModalComponent } from './moderation-comment-modal.component' -import { Video } from '../../../shared/video/video.model' -import { MarkdownService } from '@app/shared/renderer' -import { Actor } from '@app/shared/actor/actor.model' +import { filter } from 'rxjs/operators' import { buildVideoEmbed, buildVideoLink } from 'src/assets/player/utils' +import { environment } from 'src/environments/environment' +import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core' import { DomSanitizer } from '@angular/platform-browser' -import { BlocklistService } from '@app/shared/blocklist' -import { VideoService } from '@app/shared/video/video.service' import { ActivatedRoute, Params, Router } from '@angular/router' -import { filter } from 'rxjs/operators' -import { environment } from 'src/environments/environment' +import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core' +import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main' +import { BlocklistService, VideoAbuseService, VideoBlockService } from '@app/shared/shared-moderation' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoAbuse, VideoAbuseState } from '@shared/models' +import { ModerationCommentModalComponent } from './moderation-comment-modal.component' export type ProcessedVideoAbuse = VideoAbuse & { moderationCommentHtml?: string, diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts index c0ac32242..c03f9248e 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts @@ -1,16 +1,12 @@ -import { Component, OnInit, AfterViewInit } from '@angular/core' import { SortMeta } from 'primeng/api' -import { Notifier, ServerService } from '@app/core' -import { ConfirmService } from '../../../core' -import { RestPagination, RestTable, VideoBlockService } from '../../../shared' -import { VideoBlacklist, VideoBlacklistType } from '../../../../../../shared' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { DropdownAction } from '../../../shared/buttons/action-dropdown.component' -import { Video } from '../../../shared/video/video.model' -import { MarkdownService } from '@app/shared/renderer' -import { Params, ActivatedRoute, Router } from '@angular/router' import { filter, switchMap } from 'rxjs/operators' -import { VideoService } from '@app/shared/video/video.service' +import { AfterViewInit, Component, OnInit } from '@angular/core' +import { ActivatedRoute, Params, Router } from '@angular/router' +import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' +import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' +import { VideoBlockService } from '@app/shared/shared-moderation' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoBlacklist, VideoBlacklistType } from '@shared/models' @Component({ selector: 'my-video-block-list', diff --git a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts index a8973f2b2..af31f1144 100644 --- a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts +++ b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts @@ -1,14 +1,13 @@ +import { Subject } from 'rxjs' import { Component, OnInit } from '@angular/core' -import { PluginType } from '@shared/models/plugins/plugin.type' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service' -import { ComponentPagination, hasMoreItems } from '@app/shared/rest/component-pagination.model' -import { ConfirmService, Notifier } from '@app/core' -import { PeerTubePlugin } from '@shared/models/plugins/peertube-plugin.model' import { ActivatedRoute, Router } from '@angular/router' -import { compareSemVer } from '@shared/core-utils/miscs/miscs' +import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service' +import { ComponentPagination, ConfirmService, hasMoreItems, Notifier } from '@app/core' import { PluginService } from '@app/core/plugins/plugin.service' -import { Subject } from 'rxjs' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { compareSemVer } from '@shared/core-utils/miscs/miscs' +import { PeerTubePlugin } from '@shared/models/plugins/peertube-plugin.model' +import { PluginType } from '@shared/models/plugins/plugin.type' @Component({ selector: 'my-plugin-list-installed', diff --git a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts index dc59e759b..ccf9f1ed5 100644 --- a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts +++ b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts @@ -1,14 +1,12 @@ +import { Subject } from 'rxjs' +import { debounceTime, distinctUntilChanged } from 'rxjs/operators' import { Component, OnInit } from '@angular/core' -import { Notifier, ServerService } from '@app/core' -import { ConfirmService } from '../../../core' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { PluginType } from '@shared/models/plugins/plugin.type' -import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service' -import { ComponentPagination, hasMoreItems } from '@app/shared/rest/component-pagination.model' import { ActivatedRoute, Router } from '@angular/router' +import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service' +import { ComponentPagination, ConfirmService, hasMoreItems, Notifier, ServerService } from '@app/core' +import { I18n } from '@ngx-translate/i18n-polyfill' import { PeerTubePluginIndex } from '@shared/models/plugins/peertube-plugin-index.model' -import { Subject } from 'rxjs' -import { debounceTime, distinctUntilChanged } from 'rxjs/operators' +import { PluginType } from '@shared/models/plugins/plugin.type' @Component({ selector: 'my-plugin-search', diff --git a/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts b/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts index 13d12b145..dde03f1da 100644 --- a/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts +++ b/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts @@ -1,13 +1,12 @@ -import { Component, OnDestroy, OnInit } from '@angular/core' -import { PeerTubePlugin } from '@shared/models/plugins/peertube-plugin.model' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service' -import { Notifier } from '@app/core' -import { ActivatedRoute } from '@angular/router' import { Subscription } from 'rxjs' import { map, switchMap } from 'rxjs/operators' -import { BuildFormArgument, FormReactive, FormValidatorService } from '@app/shared' -import { RegisterServerSettingOptions } from '@shared/models/plugins/register-server-setting.model' +import { Component, OnDestroy, OnInit } from '@angular/core' +import { ActivatedRoute } from '@angular/router' +import { Notifier } from '@app/core' +import { BuildFormArgument, FormReactive, FormValidatorService } from '@app/shared/shared-forms' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { PeerTubePlugin, RegisterServerSettingOptions } from '@shared/models' +import { PluginApiService } from '../shared/plugin-api.service' @Component({ selector: 'my-plugin-show-installed', diff --git a/client/src/app/+admin/plugins/shared/plugin-api.service.ts b/client/src/app/+admin/plugins/shared/plugin-api.service.ts index f6ef68e9c..bf9129e01 100644 --- a/client/src/app/+admin/plugins/shared/plugin-api.service.ts +++ b/client/src/app/+admin/plugins/shared/plugin-api.service.ts @@ -1,19 +1,21 @@ +import { Observable } from 'rxjs' import { catchError, map, switchMap } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' -import { environment } from '../../../../environments/environment' -import { RestExtractor, RestService } from '../../../shared' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { PluginType } from '@shared/models/plugins/plugin.type' -import { ComponentPagination } from '@app/shared/rest/component-pagination.model' -import { peertubeTranslate, ResultList } from '@shared/models' -import { PeerTubePlugin } from '@shared/models/plugins/peertube-plugin.model' -import { ManagePlugin } from '@shared/models/plugins/manage-plugin.model' -import { InstallOrUpdatePlugin } from '@shared/models/plugins/install-plugin.model' -import { PeerTubePluginIndex } from '@shared/models/plugins/peertube-plugin-index.model' -import { RegisteredServerSettings, RegisterServerSettingOptions } from '@shared/models/plugins/register-server-setting.model' +import { ComponentPagination, RestExtractor, RestService } from '@app/core' import { PluginService } from '@app/core/plugins/plugin.service' -import { Observable } from 'rxjs' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { + InstallOrUpdatePlugin, + ManagePlugin, + PeerTubePlugin, + PeerTubePluginIndex, + peertubeTranslate, + PluginType, + RegisteredServerSettings, + ResultList +} from '@shared/models' +import { environment } from '../../../../environments/environment' @Injectable() export class PluginApiService { diff --git a/client/src/app/+admin/system/debug/debug.component.ts b/client/src/app/+admin/system/debug/debug.component.ts index 8a77f79f7..a88d837f3 100644 --- a/client/src/app/+admin/system/debug/debug.component.ts +++ b/client/src/app/+admin/system/debug/debug.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core' import { Notifier } from '@app/core' -import { Debug } from '@shared/models/server' -import { DebugService } from '@app/+admin/system/debug/debug.service' +import { Debug } from '@shared/models' +import { DebugService } from './debug.service' @Component({ templateUrl: './debug.component.html', diff --git a/client/src/app/+admin/system/debug/debug.service.ts b/client/src/app/+admin/system/debug/debug.service.ts index 6c722d177..ab1d0a7fa 100644 --- a/client/src/app/+admin/system/debug/debug.service.ts +++ b/client/src/app/+admin/system/debug/debug.service.ts @@ -1,10 +1,10 @@ +import { Observable } from 'rxjs' import { catchError } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' -import { Observable } from 'rxjs' +import { RestExtractor } from '@app/core' +import { Debug } from '@shared/models' import { environment } from '../../../../environments/environment' -import { RestExtractor, RestService } from '../../../shared' -import { Debug } from '@shared/models/server' @Injectable() export class DebugService { @@ -12,7 +12,6 @@ export class DebugService { constructor ( private authHttp: HttpClient, - private restService: RestService, private restExtractor: RestExtractor ) {} diff --git a/client/src/app/+admin/system/index.ts b/client/src/app/+admin/system/index.ts index 226d999d2..8cced0cdb 100644 --- a/client/src/app/+admin/system/index.ts +++ b/client/src/app/+admin/system/index.ts @@ -1,3 +1,4 @@ +export * from './debug' export * from './jobs' export * from './logs' export * from './system.component' diff --git a/client/src/app/+admin/system/jobs/job.service.ts b/client/src/app/+admin/system/jobs/job.service.ts index 1e2291ad1..1ac50f050 100644 --- a/client/src/app/+admin/system/jobs/job.service.ts +++ b/client/src/app/+admin/system/jobs/job.service.ts @@ -1,12 +1,11 @@ +import { SortMeta } from 'primeng/api' +import { Observable } from 'rxjs' import { catchError, map } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' -import { SortMeta } from 'primeng/api' -import { Observable } from 'rxjs' -import { ResultList } from '../../../../../../shared' -import { Job } from '../../../../../../shared/models/server/job.model' +import { RestExtractor, RestPagination, RestService } from '@app/core' +import { Job, ResultList } from '@shared/models' import { environment } from '../../../../environments/environment' -import { RestExtractor, RestPagination, RestService } from '../../../shared' import { JobStateClient } from '../../../../types/job-state-client.type' import { JobTypeClient } from '../../../../types/job-type-client.type' diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts index 4f7f7c368..38a78de33 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.ts +++ b/client/src/app/+admin/system/jobs/jobs.component.ts @@ -1,14 +1,12 @@ -import { Component, OnInit } from '@angular/core' -import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' -import { Notifier } from '@app/core' import { SortMeta } from 'primeng/api' -import { Job, JobType } from '../../../../../../shared/index' -import { JobState } from '../../../../../../shared/models' -import { RestPagination, RestTable } from '../../../shared' -import { JobService } from './job.service' +import { Component, OnInit } from '@angular/core' +import { Notifier, RestPagination, RestTable } from '@app/core' +import { peertubeLocalStorage } from '@app/helpers/peertube-web-storage' import { I18n } from '@ngx-translate/i18n-polyfill' +import { Job, JobState, JobType } from '@shared/models' import { JobStateClient } from '../../../../types/job-state-client.type' import { JobTypeClient } from '../../../../types/job-type-client.type' +import { JobService } from './job.service' @Component({ selector: 'my-jobs', diff --git a/client/src/app/+admin/system/logs/log-row.model.ts b/client/src/app/+admin/system/logs/log-row.model.ts index b22581b5a..615778210 100644 --- a/client/src/app/+admin/system/logs/log-row.model.ts +++ b/client/src/app/+admin/system/logs/log-row.model.ts @@ -1,4 +1,4 @@ -import { LogLevel } from '@shared/models/server/log-level.type' +import { LogLevel } from '@shared/models' import omit from 'lodash-es/omit' export class LogRow { diff --git a/client/src/app/+admin/system/logs/logs.component.ts b/client/src/app/+admin/system/logs/logs.component.ts index b63f11953..51f047188 100644 --- a/client/src/app/+admin/system/logs/logs.component.ts +++ b/client/src/app/+admin/system/logs/logs.component.ts @@ -1,9 +1,9 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' -import { LogsService } from '@app/+admin/system/logs/logs.service' import { Notifier } from '@app/core' -import { LogRow } from '@app/+admin/system/logs/log-row.model' import { I18n } from '@ngx-translate/i18n-polyfill' -import { LogLevel } from '@shared/models/server/log-level.type' +import { LogLevel } from '@shared/models' +import { LogRow } from './log-row.model' +import { LogsService } from './logs.service' @Component({ templateUrl: './logs.component.html', diff --git a/client/src/app/+admin/system/logs/logs.service.ts b/client/src/app/+admin/system/logs/logs.service.ts index 41b38c7ba..69439a179 100644 --- a/client/src/app/+admin/system/logs/logs.service.ts +++ b/client/src/app/+admin/system/logs/logs.service.ts @@ -1,11 +1,11 @@ +import { Observable } from 'rxjs' import { catchError, map } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' -import { Observable } from 'rxjs' +import { RestExtractor } from '@app/core' +import { LogLevel } from '@shared/models' import { environment } from '../../../../environments/environment' -import { RestExtractor, RestService } from '../../../shared' -import { LogRow } from '@app/+admin/system/logs/log-row.model' -import { LogLevel } from '@shared/models/server/log-level.type' +import { LogRow } from './log-row.model' @Injectable() export class LogsService { @@ -14,7 +14,6 @@ export class LogsService { constructor ( private authHttp: HttpClient, - private restService: RestService, private restExtractor: RestExtractor ) {} diff --git a/client/src/app/+admin/system/system.routes.ts b/client/src/app/+admin/system/system.routes.ts index 2d851794d..0e8d98519 100644 --- a/client/src/app/+admin/system/system.routes.ts +++ b/client/src/app/+admin/system/system.routes.ts @@ -1,10 +1,10 @@ import { Routes } from '@angular/router' -import { UserRightGuard } from '../../core' -import { UserRight } from '../../../../../shared' -import { JobsComponent } from '@app/+admin/system/jobs/jobs.component' -import { LogsComponent } from '@app/+admin/system/logs' -import { SystemComponent } from '@app/+admin/system/system.component' -import { DebugComponent } from '@app/+admin/system/debug' +import { UserRightGuard } from '@app/core' +import { UserRight } from '@shared/models' +import { DebugComponent } from './debug' +import { JobsComponent } from './jobs/jobs.component' +import { LogsComponent } from './logs' +import { SystemComponent } from './system.component' export const SystemRoutes: Routes = [ { diff --git a/client/src/app/+admin/users/user-edit/user-create.component.ts b/client/src/app/+admin/users/user-edit/user-create.component.ts index b459eb8fa..f9f5b90bd 100644 --- a/client/src/app/+admin/users/user-edit/user-create.component.ts +++ b/client/src/app/+admin/users/user-edit/user-create.component.ts @@ -1,14 +1,11 @@ import { Component, OnInit } from '@angular/core' -import { Router, ActivatedRoute } from '@angular/router' -import { AuthService, Notifier, ServerService } from '@app/core' -import { UserCreate, UserRole } from '../../../../../../shared' -import { UserEdit } from './user-edit' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' +import { ActivatedRoute, Router } from '@angular/router' import { ConfigService } from '@app/+admin/config/shared/config.service' -import { UserService } from '@app/shared' -import { ScreenService } from '@app/shared/misc/screen.service' +import { AuthService, Notifier, ScreenService, ServerService, UserService } from '@app/core' +import { FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { UserCreate, UserRole } from '@shared/models' +import { UserEdit } from './user-edit' @Component({ selector: 'my-user-create', diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts index 5f5cc590c..8fa4b0635 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts @@ -1,11 +1,8 @@ -import { AuthService, ServerService } from '../../../core' -import { FormReactive } from '../../../shared' -import { ServerConfig, USER_ROLE_LABELS, UserRole, VideoResolution } from '../../../../../../shared' -import { ConfigService } from '@app/+admin/config/shared/config.service' -import { UserAdminFlag } from '@shared/models/users/user-flag.model' import { OnInit } from '@angular/core' -import { User } from '@app/shared/users/user.model' -import { ScreenService } from '@app/shared/misc/screen.service' +import { ConfigService } from '@app/+admin/config/shared/config.service' +import { AuthService, ScreenService, ServerService, User } from '@app/core' +import { FormReactive } from '@app/shared/shared-forms' +import { ServerConfig, USER_ROLE_LABELS, UserAdminFlag, UserRole, VideoResolution } from '@shared/models' export abstract class UserEdit extends FormReactive implements OnInit { videoQuotaOptions: { value: string, label: string, disabled?: boolean }[] = [] diff --git a/client/src/app/+admin/users/user-edit/user-password.component.ts b/client/src/app/+admin/users/user-edit/user-password.component.ts index ecad000f7..33c7de31f 100644 --- a/client/src/app/+admin/users/user-edit/user-password.component.ts +++ b/client/src/app/+admin/users/user-edit/user-password.component.ts @@ -1,12 +1,8 @@ import { Component, Input, OnInit } from '@angular/core' -import { ActivatedRoute, Router } from '@angular/router' -import { UserService } from '@app/shared/users/user.service' -import { Notifier } from '../../../core' -import { User, UserUpdate } from '../../../../../../shared' +import { Notifier, UserService } from '@app/core' +import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' -import { FormReactive } from '../../../shared' +import { UserUpdate } from '@shared/models' @Component({ selector: 'my-user-password', diff --git a/client/src/app/+admin/users/user-edit/user-update.component.ts b/client/src/app/+admin/users/user-edit/user-update.component.ts index 035c0d4bb..870880fee 100644 --- a/client/src/app/+admin/users/user-edit/user-update.component.ts +++ b/client/src/app/+admin/users/user-edit/user-update.component.ts @@ -1,18 +1,12 @@ +import { Subscription } from 'rxjs' import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { Subscription } from 'rxjs' -import { AuthService, Notifier } from '@app/core' -import { ServerService } from '../../../core' -import { UserEdit } from './user-edit' -import { User as UserType, UserUpdate, UserRole } from '../../../../../../shared' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' import { ConfigService } from '@app/+admin/config/shared/config.service' -import { UserService } from '@app/shared' -import { UserAdminFlag } from '@shared/models/users/user-flag.model' -import { User } from '@app/shared/users/user.model' -import { ScreenService } from '@app/shared/misc/screen.service' +import { AuthService, Notifier, ScreenService, ServerService, User, UserService } from '@app/core' +import { FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { User as UserType, UserAdminFlag, UserRole, UserUpdate } from '@shared/models' +import { UserEdit } from './user-edit' @Component({ selector: 'my-user-update', diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index da50b7ed0..8f01c7d51 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts @@ -1,13 +1,10 @@ -import { Component, OnInit, ViewChild } from '@angular/core' -import { AuthService, Notifier } from '@app/core' import { SortMeta } from 'primeng/api' -import { ConfirmService, ServerService } from '../../../core' -import { RestPagination, RestTable, UserService } from '../../../shared' +import { Component, OnInit, ViewChild } from '@angular/core' +import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService, UserService } from '@app/core' +import { Actor, DropdownAction } from '@app/shared/shared-main' +import { UserBanModalComponent } from '@app/shared/shared-moderation' import { I18n } from '@ngx-translate/i18n-polyfill' -import { ServerConfig, User } from '../../../../../../shared' -import { UserBanModalComponent } from '@app/shared/moderation' -import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' -import { Actor } from '@app/shared/actor/actor.model' +import { ServerConfig, User } from '@shared/models' @Component({ selector: 'my-user-list', diff --git a/client/src/app/+admin/users/users.routes.ts b/client/src/app/+admin/users/users.routes.ts index 2d4f9305e..6560f0260 100644 --- a/client/src/app/+admin/users/users.routes.ts +++ b/client/src/app/+admin/users/users.routes.ts @@ -1,11 +1,9 @@ import { Routes } from '@angular/router' - -import { UserRightGuard } from '../../core' -import { UserRight } from '../../../../../shared' -import { UsersComponent } from './users.component' +import { ServerConfigResolver, UserRightGuard } from '@app/core' +import { UserRight } from '@shared/models' import { UserCreateComponent, UserUpdateComponent } from './user-edit' import { UserListComponent } from './user-list' -import { ServerConfigResolver } from '@app/core/routing/server-config-resolver.service' +import { UsersComponent } from './users.component' export const UsersRoutes: Routes = [ { diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts similarity index 86% rename from client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts rename to client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts index a68f79b47..039c389e4 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts +++ b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts @@ -1,12 +1,11 @@ import { Component, OnInit } from '@angular/core' import { Router } from '@angular/router' import { AuthService, Notifier } from '@app/core' -import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' -import { VideoChannelCreate } from '../../../../../shared/models/videos' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' +import { FormValidatorService, VideoChannelValidatorsService } from '@app/shared/shared-forms' +import { VideoChannelService } from '@app/shared/shared-main' import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { VideoChannelValidatorsService } from '@app/shared/forms/form-validators/video-channel-validators.service' +import { VideoChannelCreate } from '@shared/models' +import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' @Component({ selector: 'my-account-video-channel-create', diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.component.html b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-edit.component.html similarity index 100% rename from client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.component.html rename to client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-edit.component.html diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.component.scss b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-edit.component.scss similarity index 100% rename from client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.component.scss rename to client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-edit.component.scss diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.ts b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-edit.ts similarity index 81% rename from client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.ts rename to client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-edit.ts index 355cb4f55..710c51d8e 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.ts +++ b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-edit.ts @@ -1,5 +1,5 @@ -import { FormReactive } from '@app/shared' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' +import { FormReactive } from '@app/shared/shared-forms' +import { VideoChannel } from '@app/shared/shared-main' export abstract class MyAccountVideoChannelEdit extends FormReactive { // We need it even in the create component because it's used in the edit template diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-update.component.ts similarity index 89% rename from client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts rename to client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-update.component.ts index 9c948b367..489c437ea 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts +++ b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-update.component.ts @@ -1,15 +1,12 @@ +import { Subscription } from 'rxjs' import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { AuthService, Notifier, ServerService } from '@app/core' -import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' -import { VideoChannelUpdate } from '../../../../../shared/models/videos' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { Subscription } from 'rxjs' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' +import { FormValidatorService, VideoChannelValidatorsService } from '@app/shared/shared-forms' +import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { VideoChannelValidatorsService } from '@app/shared/forms/form-validators/video-channel-validators.service' -import { ServerConfig } from '@shared/models' +import { ServerConfig, VideoChannelUpdate } from '@shared/models' +import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' @Component({ selector: 'my-account-video-channel-update', diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels-routing.module.ts b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels-routing.module.ts similarity index 100% rename from client/src/app/+my-account/my-account-video-channels/my-account-video-channels-routing.module.ts rename to client/src/app/+my-account/+my-account-video-channels/my-account-video-channels-routing.module.ts diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.html b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.html similarity index 100% rename from client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.html rename to client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.html diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.scss b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.scss similarity index 100% rename from client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.scss rename to client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.scss diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.ts similarity index 91% rename from client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts rename to client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.ts index 9caefe5b1..70510d7c9 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts +++ b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.ts @@ -1,15 +1,10 @@ -import { Component, OnInit } from '@angular/core' -import { Notifier } from '@app/core' -import { AuthService } from '../../core/auth' -import { ConfirmService } from '../../core/confirm' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { ScreenService } from '@app/shared/misc/screen.service' -import { User } from '@app/shared' +import { ChartData } from 'chart.js' +import { max, maxBy, min, minBy } from 'lodash-es' import { flatMap } from 'rxjs/operators' +import { Component, OnInit } from '@angular/core' +import { AuthService, ConfirmService, Notifier, ScreenService, User } from '@app/core' +import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' import { I18n } from '@ngx-translate/i18n-polyfill' -import { min, minBy, max, maxBy } from 'lodash-es' -import { ChartData } from 'chart.js' @Component({ selector: 'my-account-video-channels', diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.module.ts b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.module.ts similarity index 73% rename from client/src/app/+my-account/my-account-video-channels/my-account-video-channels.module.ts rename to client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.module.ts index 87d6b762f..f8c6ad56b 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.module.ts +++ b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.module.ts @@ -1,16 +1,22 @@ -import { NgModule } from '@angular/core' import { ChartModule } from 'primeng/chart' -import { MyAccountVideoChannelsRoutingModule } from './my-account-video-channels-routing.module' -import { MyAccountVideoChannelsComponent } from './my-account-video-channels.component' +import { NgModule } from '@angular/core' +import { SharedFormModule } from '@app/shared/shared-forms' +import { SharedGlobalIconModule } from '@app/shared/shared-icons' +import { SharedMainModule } from '@app/shared/shared-main' import { MyAccountVideoChannelCreateComponent } from './my-account-video-channel-create.component' import { MyAccountVideoChannelUpdateComponent } from './my-account-video-channel-update.component' -import { SharedModule } from '@app/shared' +import { MyAccountVideoChannelsRoutingModule } from './my-account-video-channels-routing.module' +import { MyAccountVideoChannelsComponent } from './my-account-video-channels.component' @NgModule({ imports: [ MyAccountVideoChannelsRoutingModule, - SharedModule, - ChartModule + + ChartModule, + + SharedMainModule, + SharedFormModule, + SharedGlobalIconModule ], declarations: [ diff --git a/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts b/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts index e48c39cdf..03ec75e25 100644 --- a/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts +++ b/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts @@ -1,10 +1,10 @@ import { Component } from '@angular/core' -import { GenericAccountBlocklistComponent, BlocklistComponentType } from '@app/shared/blocklist' +import { BlocklistComponentType, GenericAccountBlocklistComponent } from '@app/shared/shared-moderation' @Component({ selector: 'my-account-blocklist', - styleUrls: [ '../../shared/blocklist/account-blocklist.component.scss' ], - templateUrl: '../../shared/blocklist/account-blocklist.component.html' + styleUrls: [ '../../shared/shared-moderation/account-blocklist.component.scss' ], + templateUrl: '../../shared/shared-moderation/account-blocklist.component.html' }) export class MyAccountBlocklistComponent extends GenericAccountBlocklistComponent { mode = BlocklistComponentType.Account diff --git a/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts b/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts index cfaba1c7b..9b983a197 100644 --- a/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts +++ b/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts @@ -1,10 +1,10 @@ import { Component } from '@angular/core' -import { GenericServerBlocklistComponent, BlocklistComponentType } from '@app/shared/blocklist' +import { BlocklistComponentType, GenericServerBlocklistComponent } from '@app/shared/shared-moderation' @Component({ selector: 'my-account-server-blocklist', - styleUrls: [ '../../+admin/moderation/moderation.component.scss', '../../shared/blocklist/server-blocklist.component.scss' ], - templateUrl: '../../shared/blocklist/server-blocklist.component.html' + styleUrls: [ '../../+admin/moderation/moderation.component.scss', '../../shared/shared-moderation/server-blocklist.component.scss' ], + templateUrl: '../../shared/shared-moderation/server-blocklist.component.html' }) export class MyAccountServerBlocklistComponent extends GenericServerBlocklistComponent { mode = BlocklistComponentType.Account diff --git a/client/src/app/+my-account/my-account-history/my-account-history.component.ts b/client/src/app/+my-account/my-account-history/my-account-history.component.ts index 5f0ccee50..dc78b3d6e 100644 --- a/client/src/app/+my-account/my-account-history/my-account-history.component.ts +++ b/client/src/app/+my-account/my-account-history/my-account-history.component.ts @@ -1,17 +1,19 @@ import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { immutableAssign } from '@app/shared/misc/utils' -import { ComponentPagination } from '@app/shared/rest/component-pagination.model' -import { AuthService } from '../../core/auth' -import { ConfirmService } from '../../core/confirm' -import { AbstractVideoList } from '../../shared/video/abstract-video-list' -import { VideoService } from '../../shared/video/video.service' +import { + AuthService, + ComponentPagination, + ConfirmService, + LocalStorageService, + Notifier, + ScreenService, + ServerService, + UserService +} from '@app/core' +import { immutableAssign } from '@app/helpers' +import { UserHistoryService } from '@app/shared/shared-main' +import { AbstractVideoList } from '@app/shared/shared-video-miniature' import { I18n } from '@ngx-translate/i18n-polyfill' -import { ScreenService } from '@app/shared/misc/screen.service' -import { UserHistoryService } from '@app/shared/users/user-history.service' -import { UserService } from '@app/shared' -import { Notifier, ServerService } from '@app/core' -import { LocalStorageService } from '@app/shared/misc/storage.service' @Component({ selector: 'my-account-history', @@ -38,7 +40,6 @@ export class MyAccountHistoryComponent extends AbstractVideoList implements OnIn protected screenService: ScreenService, protected storageService: LocalStorageService, private confirmService: ConfirmService, - private videoService: VideoService, private userHistoryService: UserHistoryService ) { super() diff --git a/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts b/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts index a50cb0fb9..0c1427d96 100644 --- a/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts +++ b/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts @@ -1,5 +1,5 @@ import { Component, ViewChild } from '@angular/core' -import { UserNotificationsComponent } from '@app/shared' +import { UserNotificationsComponent } from '@app/shared/shared-main' @Component({ templateUrl: './my-account-notifications.component.html', diff --git a/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts b/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts index d5682914e..0e62b5ca5 100644 --- a/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts +++ b/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts @@ -1,14 +1,10 @@ import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' import { AuthService, Notifier } from '@app/core' -import { FormReactive } from '@app/shared' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { VideoOwnershipService } from '@app/shared/video-ownership' -import { VideoChangeOwnership } from '../../../../../../shared/models/videos' -import { VideoAcceptOwnershipValidatorsService } from '@app/shared/forms/form-validators' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { I18n } from '@ngx-translate/i18n-polyfill' +import { FormReactive, FormValidatorService, VideoAcceptOwnershipValidatorsService } from '@app/shared/shared-forms' +import { VideoChannelService, VideoOwnershipService } from '@app/shared/shared-main' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoChangeOwnership, VideoChannel } from '@shared/models' @Component({ selector: 'my-account-accept-ownership', diff --git a/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts b/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts index f0a6303d1..5167732c2 100644 --- a/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts +++ b/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts @@ -1,10 +1,8 @@ -import { Component, OnInit, ViewChild } from '@angular/core' -import { Notifier } from '@app/core' -import { RestPagination, RestTable } from '@app/shared' import { SortMeta } from 'primeng/api' -import { VideoChangeOwnership } from '../../../../../shared' -import { VideoOwnershipService } from '@app/shared/video-ownership' -import { Account } from '@app/shared/account/account.model' +import { Component, OnInit, ViewChild } from '@angular/core' +import { Notifier, RestPagination, RestTable } from '@app/core' +import { Account, VideoOwnershipService } from '@app/shared/shared-main' +import { VideoChangeOwnership } from '@shared/models' import { MyAccountAcceptOwnershipComponent } from './my-account-accept-ownership/my-account-accept-ownership.component' @Component({ diff --git a/client/src/app/+my-account/my-account-routing.module.ts b/client/src/app/+my-account/my-account-routing.module.ts index f6b711e09..ac9cf4cfd 100644 --- a/client/src/app/+my-account/my-account-routing.module.ts +++ b/client/src/app/+my-account/my-account-routing.module.ts @@ -2,26 +2,20 @@ import { NgModule } from '@angular/core' import { RouterModule, Routes } from '@angular/router' import { MetaGuard } from '@ngx-meta/core' import { LoginGuard } from '../core' -import { MyAccountComponent } from './my-account.component' +import { MyAccountBlocklistComponent } from './my-account-blocklist/my-account-blocklist.component' +import { MyAccountServerBlocklistComponent } from './my-account-blocklist/my-account-server-blocklist.component' +import { MyAccountHistoryComponent } from './my-account-history/my-account-history.component' +import { MyAccountNotificationsComponent } from './my-account-notifications/my-account-notifications.component' +import { MyAccountOwnershipComponent } from './my-account-ownership/my-account-ownership.component' import { MyAccountSettingsComponent } from './my-account-settings/my-account-settings.component' +import { MyAccountSubscriptionsComponent } from './my-account-subscriptions/my-account-subscriptions.component' +import { MyAccountVideoImportsComponent } from './my-account-video-imports/my-account-video-imports.component' +import { MyAccountVideoPlaylistCreateComponent } from './my-account-video-playlists/my-account-video-playlist-create.component' +import { MyAccountVideoPlaylistElementsComponent } from './my-account-video-playlists/my-account-video-playlist-elements.component' +import { MyAccountVideoPlaylistUpdateComponent } from './my-account-video-playlists/my-account-video-playlist-update.component' +import { MyAccountVideoPlaylistsComponent } from './my-account-video-playlists/my-account-video-playlists.component' import { MyAccountVideosComponent } from './my-account-videos/my-account-videos.component' -import { MyAccountVideoImportsComponent } from '@app/+my-account/my-account-video-imports/my-account-video-imports.component' -import { MyAccountSubscriptionsComponent } from '@app/+my-account/my-account-subscriptions/my-account-subscriptions.component' -import { MyAccountOwnershipComponent } from '@app/+my-account/my-account-ownership/my-account-ownership.component' -import { MyAccountBlocklistComponent } from '@app/+my-account/my-account-blocklist/my-account-blocklist.component' -import { MyAccountServerBlocklistComponent } from '@app/+my-account/my-account-blocklist/my-account-server-blocklist.component' -import { MyAccountHistoryComponent } from '@app/+my-account/my-account-history/my-account-history.component' -import { MyAccountNotificationsComponent } from '@app/+my-account/my-account-notifications/my-account-notifications.component' -import { MyAccountVideoPlaylistsComponent } from '@app/+my-account/my-account-video-playlists/my-account-video-playlists.component' -import { - MyAccountVideoPlaylistCreateComponent -} from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component' -import { - MyAccountVideoPlaylistUpdateComponent -} from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component' -import { - MyAccountVideoPlaylistElementsComponent -} from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component' +import { MyAccountComponent } from './my-account.component' const myAccountRoutes: Routes = [ { @@ -46,7 +40,10 @@ const myAccountRoutes: Routes = [ { path: 'video-channels', - loadChildren: () => import('./my-account-video-channels/my-account-video-channels.module').then(m => m.MyAccountVideoChannelsModule) + loadChildren: () => { + return import('./+my-account-video-channels/my-account-video-channels.module') + .then(m => m.MyAccountVideoChannelsModule) + } }, { diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts index 9d406805f..5444b97ae 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts @@ -1,12 +1,10 @@ +import { forkJoin } from 'rxjs' +import { tap } from 'rxjs/operators' import { Component, OnInit } from '@angular/core' -import { AuthService, Notifier, ServerService } from '@app/core' -import { FormReactive, UserService } from '../../../shared' +import { AuthService, ServerService, UserService } from '@app/core' +import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' -import { User } from '../../../../../../shared' -import { tap } from 'rxjs/operators' -import { forkJoin } from 'rxjs' +import { User } from '@shared/models' @Component({ selector: 'my-account-change-email', @@ -21,7 +19,6 @@ export class MyAccountChangeEmailComponent extends FormReactive implements OnIni constructor ( protected formValidatorService: FormValidatorService, private userValidatorsService: UserValidatorsService, - private notifier: Notifier, private authService: AuthService, private userService: UserService, private serverService: ServerService, diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts index cbb068c7c..6a16f8a2c 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts @@ -1,11 +1,9 @@ +import { filter } from 'rxjs/operators' import { Component, OnInit } from '@angular/core' -import { AuthService, Notifier } from '@app/core' -import { FormReactive, UserService } from '../../../shared' +import { AuthService, Notifier, UserService } from '@app/core' +import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' -import { filter } from 'rxjs/operators' -import { User } from '../../../../../../shared' +import { User } from '@shared/models' @Component({ selector: 'my-account-change-password', diff --git a/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts b/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts index 25d862867..ae6ac5387 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts @@ -1,9 +1,6 @@ import { Component, Input } from '@angular/core' -import { Notifier } from '@app/core' -import { AuthService, ConfirmService, RedirectService } from '../../../core' -import { UserService } from '../../../shared' +import { AuthService, ConfirmService, Notifier, RedirectService, User, UserService } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' -import { User } from '@app/shared' @Component({ selector: 'my-account-danger-zone', diff --git a/client/src/app/+my-account/my-account-settings/my-account-interface/index.ts b/client/src/app/+my-account/my-account-settings/my-account-interface/index.ts deleted file mode 100644 index 62fce79a8..000000000 --- a/client/src/app/+my-account/my-account-settings/my-account-interface/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './my-account-interface-settings.component' diff --git a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts index af17a0352..cfa514b26 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts @@ -1,11 +1,10 @@ +import { debounce } from 'lodash-es' +import { Subject } from 'rxjs' import { Component, Input, OnInit } from '@angular/core' -import { User } from '@app/shared' +import { Notifier, ServerService, User } from '@app/core' +import { UserNotificationService } from '@app/shared/shared-main' import { I18n } from '@ngx-translate/i18n-polyfill' -import { Subject } from 'rxjs' -import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from '../../../../../../shared' -import { Notifier, ServerService } from '@app/core' -import { debounce } from 'lodash-es' -import { UserNotificationService } from '@app/shared/users/user-notification.service' +import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from '@shared/models' @Component({ selector: 'my-account-notification-preferences', diff --git a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts index fcad5a6c2..b0d8494e7 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts @@ -1,11 +1,8 @@ +import { Subject } from 'rxjs' import { Component, Input, OnInit } from '@angular/core' -import { Notifier } from '@app/core' -import { FormReactive, UserService } from '../../../shared' -import { User } from '@app/shared' +import { Notifier, User, UserService } from '@app/core' +import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { Subject } from 'rxjs' -import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' @Component({ selector: 'my-account-profile', diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.html b/client/src/app/+my-account/my-account-settings/my-account-settings.component.html index 040b2130f..2826d8d83 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.html @@ -34,7 +34,7 @@
- +
@@ -55,7 +55,7 @@
- +
diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts index f73f3aa1e..4800be24b 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts @@ -1,11 +1,8 @@ -import { Component, OnInit, AfterViewChecked } from '@angular/core' -import { Notifier } from '@app/core' import { BytesPipe } from 'ngx-pipes' -import { AuthService } from '../../core' -import { User } from '../../shared' -import { UserService } from '../../shared/users' -import { I18n } from '@ngx-translate/i18n-polyfill' import { ViewportScroller } from '@angular/common' +import { AfterViewChecked, Component, OnInit } from '@angular/core' +import { AuthService, Notifier, User, UserService } from '@app/core' +import { I18n } from '@ngx-translate/i18n-polyfill' @Component({ selector: 'my-account-settings', diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/index.ts b/client/src/app/+my-account/my-account-settings/my-account-video-settings/index.ts deleted file mode 100644 index 1253bd369..000000000 --- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './my-account-video-settings.component' diff --git a/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.ts b/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.ts index b347fc3fe..390293a28 100644 --- a/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.ts +++ b/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.ts @@ -1,9 +1,8 @@ -import { Component, OnInit } from '@angular/core' -import { Notifier } from '@app/core' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' -import { UserSubscriptionService } from '@app/shared/user-subscription' -import { ComponentPagination } from '@app/shared/rest/component-pagination.model' import { Subject } from 'rxjs' +import { Component, OnInit } from '@angular/core' +import { ComponentPagination, Notifier } from '@app/core' +import { VideoChannel } from '@app/shared/shared-main' +import { UserSubscriptionService } from '@app/shared/shared-user-subscription' @Component({ selector: 'my-account-subscriptions', diff --git a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts index 4452154eb..42ddb0ee2 100644 --- a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts +++ b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts @@ -1,9 +1,8 @@ -import { Component, OnInit } from '@angular/core' -import { RestPagination, RestTable } from '@app/shared' import { SortMeta } from 'primeng/api' -import { Notifier } from '@app/core' -import { VideoImport, VideoImportState } from '../../../../../shared/models/videos' -import { VideoImportService } from '@app/shared/video-import' +import { Component, OnInit } from '@angular/core' +import { Notifier, RestPagination, RestTable } from '@app/core' +import { VideoImportService } from '@app/shared/shared-main' +import { VideoImport, VideoImportState } from '@shared/models' @Component({ selector: 'my-account-video-imports', diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts index e47e5f980..e72ae2366 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts @@ -1,14 +1,13 @@ import { Component, OnInit } from '@angular/core' import { Router } from '@angular/router' import { AuthService, Notifier, ServerService } from '@app/core' -import { MyAccountVideoPlaylistEdit } from './my-account-video-playlist-edit' +import { FormValidatorService, VideoPlaylistValidatorsService } from '@app/shared/shared-forms' +import { VideoPlaylistService } from '@app/shared/shared-video-playlist' import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { VideoPlaylistValidatorsService } from '@app/shared' import { VideoPlaylistCreate } from '@shared/models/videos/playlist/video-playlist-create.model' -import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' import { VideoPlaylistPrivacy } from '@shared/models/videos/playlist/video-playlist-privacy.model' -import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' +import { MyAccountVideoPlaylistEdit } from './my-account-video-playlist-edit' +import { populateAsyncUserVideoChannels } from '@app/helpers' @Component({ selector: 'my-account-video-playlist-create', diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.ts index e94188786..7ae8de75e 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.ts @@ -1,6 +1,6 @@ -import { FormReactive } from '@app/shared' -import { VideoPlaylist } from '@shared/models/videos/playlist/video-playlist.model' +import { FormReactive } from '@app/shared/shared-forms' import { VideoConstant, VideoPlaylistPrivacy } from '@shared/models' +import { VideoPlaylist } from '@shared/models/videos/playlist/video-playlist.model' export abstract class MyAccountVideoPlaylistEdit extends FormReactive { // Declare it here to avoid errors in create template diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts index 366640618..0add81c38 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts @@ -1,16 +1,9 @@ -import { Component, OnDestroy, OnInit } from '@angular/core' -import { Notifier, ServerService } from '@app/core' -import { AuthService } from '../../core/auth' -import { ConfirmService } from '../../core/confirm' -import { ComponentPagination } from '@app/shared/rest/component-pagination.model' import { Subject, Subscription } from 'rxjs' -import { ActivatedRoute } from '@angular/router' -import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' -import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { ScreenService } from '@app/shared/misc/screen.service' import { CdkDragDrop } from '@angular/cdk/drag-drop' -import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model' +import { Component, OnDestroy, OnInit } from '@angular/core' +import { ActivatedRoute } from '@angular/router' +import { ComponentPagination, Notifier, ScreenService } from '@app/core' +import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist' @Component({ selector: 'my-account-video-playlist-elements', @@ -33,12 +26,8 @@ export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestro private paramsSub: Subscription constructor ( - private authService: AuthService, - private serverService: ServerService, private notifier: Notifier, - private confirmService: ConfirmService, private route: ActivatedRoute, - private i18n: I18n, private screenService: ScreenService, private videoPlaylistService: VideoPlaylistService ) {} diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts index 2f85cdd96..6787fb757 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts @@ -1,16 +1,14 @@ +import { forkJoin, Subscription } from 'rxjs' +import { map, switchMap } from 'rxjs/operators' import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { AuthService, Notifier, ServerService } from '@app/core' -import { forkJoin, Subscription } from 'rxjs' +import { populateAsyncUserVideoChannels } from '@app/helpers' +import { FormValidatorService, VideoPlaylistValidatorsService } from '@app/shared/shared-forms' +import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { MyAccountVideoPlaylistEdit } from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-edit' -import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' -import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' -import { VideoPlaylistValidatorsService } from '@app/shared' -import { VideoPlaylistUpdate } from '@shared/models/videos/playlist/video-playlist-update.model' -import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' -import { delayWhen, map, switchMap } from 'rxjs/operators' +import { VideoPlaylistUpdate } from '@shared/models' +import { MyAccountVideoPlaylistEdit } from './my-account-video-playlist-edit' @Component({ selector: 'my-account-video-playlist-update', diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts index c6728cc30..ea3bcde4f 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts @@ -1,15 +1,10 @@ +import { Subject } from 'rxjs' +import { debounceTime, flatMap } from 'rxjs/operators' import { Component, OnInit } from '@angular/core' -import { Notifier } from '@app/core' -import { AuthService } from '../../core/auth' -import { ConfirmService } from '../../core/confirm' -import { User } from '@app/shared' -import { flatMap, debounceTime } from 'rxjs/operators' +import { AuthService, ComponentPagination, ConfirmService, Notifier, User } from '@app/core' +import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' import { I18n } from '@ngx-translate/i18n-polyfill' -import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' -import { ComponentPagination } from '@app/shared/rest/component-pagination.model' -import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' import { VideoPlaylistType } from '@shared/models' -import { Subject } from 'rxjs' @Component({ selector: 'my-account-video-playlists', diff --git a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts index 0ec033eaf..3cfe8fb38 100644 --- a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts +++ b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts @@ -1,21 +1,15 @@ import { concat, Observable, Subject } from 'rxjs' -import { tap, toArray, debounceTime } from 'rxjs/operators' -import { Component, ViewChild, OnInit } from '@angular/core' +import { debounceTime, tap, toArray } from 'rxjs/operators' +import { Component, OnInit, ViewChild } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { immutableAssign } from '@app/shared/misc/utils' -import { ComponentPagination } from '@app/shared/rest/component-pagination.model' -import { Notifier, ServerService } from '@app/core' -import { AuthService } from '../../core/auth' -import { ConfirmService } from '../../core/confirm' -import { Video } from '../../shared/video/video.model' -import { VideoService } from '../../shared/video/video.service' +import { AuthService, ComponentPagination, ConfirmService, Notifier, ScreenService, ServerService } from '@app/core' +import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' +import { immutableAssign } from '@app/helpers' +import { Video, VideoService } from '@app/shared/shared-main' +import { MiniatureDisplayOptions, OwnerDisplayType, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature' import { I18n } from '@ngx-translate/i18n-polyfill' -import { ScreenService } from '@app/shared/misc/screen.service' +import { VideoSortField } from '@shared/models' import { VideoChangeOwnershipComponent } from './video-change-ownership/video-change-ownership.component' -import { MiniatureDisplayOptions, OwnerDisplayType } from '@app/shared/video/video-miniature.component' -import { SelectionType, VideosSelectionComponent } from '@app/shared/video/videos-selection.component' -import { VideoSortField } from '@app/shared/video/sort-field.type' -import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' @Component({ selector: 'my-account-videos', diff --git a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts b/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts index f4e2b5955..18e716a09 100644 --- a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts +++ b/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts @@ -1,11 +1,9 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' -import { Notifier } from '@app/core' +import { Notifier, UserService } from '@app/core' +import { FormReactive, FormValidatorService, VideoChangeOwnershipValidatorsService } from '@app/shared/shared-forms' +import { Video, VideoOwnershipService } from '@app/shared/shared-main' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { FormReactive, UserService } from '../../../shared/index' -import { Video } from '@app/shared/video/video.model' import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService, VideoChangeOwnershipValidatorsService } from '@app/shared' -import { VideoOwnershipService } from '@app/shared/video-ownership' @Component({ selector: 'my-video-change-ownership', diff --git a/client/src/app/+my-account/my-account.component.ts b/client/src/app/+my-account/my-account.component.ts index ca447c054..ea4da676a 100644 --- a/client/src/app/+my-account/my-account.component.ts +++ b/client/src/app/+my-account/my-account.component.ts @@ -1,8 +1,8 @@ import { Component, OnInit } from '@angular/core' import { ServerService } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' -import { TopMenuDropdownParam } from '@app/shared/menu/top-menu-dropdown.component' import { ServerConfig } from '@shared/models' +import { TopMenuDropdownParam } from './top-menu-dropdown.component' @Component({ selector: 'my-my-account', diff --git a/client/src/app/+my-account/my-account.module.ts b/client/src/app/+my-account/my-account.module.ts index 72b9fd9f2..9a11a89ea 100644 --- a/client/src/app/+my-account/my-account.module.ts +++ b/client/src/app/+my-account/my-account.module.ts @@ -1,47 +1,55 @@ -import { NgModule } from '@angular/core' -import { TableModule } from 'primeng/table' import { AutoCompleteModule } from 'primeng/autocomplete' import { InputSwitchModule } from 'primeng/inputswitch' -import { SharedModule } from '../shared' +import { TableModule } from 'primeng/table' +import { DragDropModule } from '@angular/cdk/drag-drop' +import { NgModule } from '@angular/core' +import { SharedGlobalIconModule } from '@app/shared/shared-icons' +import { SharedMainModule } from '@app/shared/shared-main' +import { SharedModerationModule } from '@app/shared/shared-moderation' +import { SharedUserInterfaceSettingsModule } from '@app/shared/shared-user-settings' +import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription/shared-user-subscription.module' +import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' +import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist/shared-video-playlist.module' +import { MyAccountBlocklistComponent } from './my-account-blocklist/my-account-blocklist.component' +import { MyAccountServerBlocklistComponent } from './my-account-blocklist/my-account-server-blocklist.component' +import { MyAccountHistoryComponent } from './my-account-history/my-account-history.component' +import { MyAccountNotificationsComponent } from './my-account-notifications/my-account-notifications.component' +import { MyAccountAcceptOwnershipComponent } from './my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component' +import { MyAccountOwnershipComponent } from './my-account-ownership/my-account-ownership.component' import { MyAccountRoutingModule } from './my-account-routing.module' +import { MyAccountChangeEmailComponent } from './my-account-settings/my-account-change-email' import { MyAccountChangePasswordComponent } from './my-account-settings/my-account-change-password/my-account-change-password.component' +import { MyAccountDangerZoneComponent } from './my-account-settings/my-account-danger-zone' +import { MyAccountNotificationPreferencesComponent } from './my-account-settings/my-account-notification-preferences' +import { MyAccountProfileComponent } from './my-account-settings/my-account-profile/my-account-profile.component' import { MyAccountSettingsComponent } from './my-account-settings/my-account-settings.component' -import { MyAccountComponent } from './my-account.component' +import { MyAccountSubscriptionsComponent } from './my-account-subscriptions/my-account-subscriptions.component' +import { MyAccountVideoImportsComponent } from './my-account-video-imports/my-account-video-imports.component' +import { MyAccountVideoPlaylistCreateComponent } from './my-account-video-playlists/my-account-video-playlist-create.component' +import { MyAccountVideoPlaylistElementsComponent } from './my-account-video-playlists/my-account-video-playlist-elements.component' +import { MyAccountVideoPlaylistUpdateComponent } from './my-account-video-playlists/my-account-video-playlist-update.component' +import { MyAccountVideoPlaylistsComponent } from './my-account-video-playlists/my-account-video-playlists.component' import { MyAccountVideosComponent } from './my-account-videos/my-account-videos.component' import { VideoChangeOwnershipComponent } from './my-account-videos/video-change-ownership/video-change-ownership.component' -import { MyAccountOwnershipComponent } from './my-account-ownership/my-account-ownership.component' -import { MyAccountAcceptOwnershipComponent } from './my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component' -import { MyAccountProfileComponent } from '@app/+my-account/my-account-settings/my-account-profile/my-account-profile.component' -import { MyAccountVideoImportsComponent } from '@app/+my-account/my-account-video-imports/my-account-video-imports.component' -import { MyAccountDangerZoneComponent } from '@app/+my-account/my-account-settings/my-account-danger-zone' -import { MyAccountSubscriptionsComponent } from '@app/+my-account/my-account-subscriptions/my-account-subscriptions.component' -import { MyAccountBlocklistComponent } from '@app/+my-account/my-account-blocklist/my-account-blocklist.component' -import { MyAccountServerBlocklistComponent } from '@app/+my-account/my-account-blocklist/my-account-server-blocklist.component' -import { MyAccountHistoryComponent } from '@app/+my-account/my-account-history/my-account-history.component' -import { MyAccountNotificationsComponent } from '@app/+my-account/my-account-notifications/my-account-notifications.component' -import { MyAccountNotificationPreferencesComponent } from '@app/+my-account/my-account-settings/my-account-notification-preferences' -import { - MyAccountVideoPlaylistCreateComponent -} from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component' -import { - MyAccountVideoPlaylistUpdateComponent -} from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component' -import { MyAccountVideoPlaylistsComponent } from '@app/+my-account/my-account-video-playlists/my-account-video-playlists.component' -import { - MyAccountVideoPlaylistElementsComponent -} from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component' -import { DragDropModule } from '@angular/cdk/drag-drop' -import { MyAccountChangeEmailComponent } from '@app/+my-account/my-account-settings/my-account-change-email' +import { MyAccountComponent } from './my-account.component' +import { TopMenuDropdownComponent } from './top-menu-dropdown.component' @NgModule({ imports: [ - TableModule, MyAccountRoutingModule, + AutoCompleteModule, - SharedModule, TableModule, InputSwitchModule, - DragDropModule + DragDropModule, + + SharedMainModule, + SharedModerationModule, + SharedVideoMiniatureModule, + SharedUserSubscriptionModule, + SharedVideoPlaylistModule, + SharedUserInterfaceSettingsModule, + SharedGlobalIconModule ], declarations: [ @@ -68,7 +76,9 @@ import { MyAccountChangeEmailComponent } from '@app/+my-account/my-account-setti MyAccountVideoPlaylistCreateComponent, MyAccountVideoPlaylistUpdateComponent, MyAccountVideoPlaylistsComponent, - MyAccountVideoPlaylistElementsComponent + MyAccountVideoPlaylistElementsComponent, + + TopMenuDropdownComponent ], exports: [ diff --git a/client/src/app/shared/menu/top-menu-dropdown.component.html b/client/src/app/+my-account/top-menu-dropdown.component.html similarity index 100% rename from client/src/app/shared/menu/top-menu-dropdown.component.html rename to client/src/app/+my-account/top-menu-dropdown.component.html diff --git a/client/src/app/shared/menu/top-menu-dropdown.component.scss b/client/src/app/+my-account/top-menu-dropdown.component.scss similarity index 100% rename from client/src/app/shared/menu/top-menu-dropdown.component.scss rename to client/src/app/+my-account/top-menu-dropdown.component.scss diff --git a/client/src/app/shared/menu/top-menu-dropdown.component.ts b/client/src/app/+my-account/top-menu-dropdown.component.ts similarity index 91% rename from client/src/app/shared/menu/top-menu-dropdown.component.ts rename to client/src/app/+my-account/top-menu-dropdown.component.ts index 3f121e785..5909db0b5 100644 --- a/client/src/app/shared/menu/top-menu-dropdown.component.ts +++ b/client/src/app/+my-account/top-menu-dropdown.component.ts @@ -1,17 +1,10 @@ -import { - Component, - Input, - OnDestroy, - OnInit, - ViewChild -} from '@angular/core' +import { Subscription } from 'rxjs' import { filter, take } from 'rxjs/operators' +import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core' import { NavigationEnd, Router } from '@angular/router' -import { Subscription } from 'rxjs' +import { MenuService, ScreenService } from '@app/core' +import { GlobalIconName } from '@app/shared/shared-icons' import { NgbDropdown, NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { GlobalIconName } from '@app/shared/images/global-icon.component' -import { ScreenService } from '@app/shared/misc/screen.service' -import { MenuService } from '@app/core/menu' export type TopMenuDropdownParam = { label: string diff --git a/client/src/app/+page-not-found/page-not-found.module.ts b/client/src/app/+page-not-found/page-not-found.module.ts index ffc1f777d..2e09ab299 100644 --- a/client/src/app/+page-not-found/page-not-found.module.ts +++ b/client/src/app/+page-not-found/page-not-found.module.ts @@ -1,12 +1,13 @@ +import { CommonModule } from '@angular/common' import { NgModule } from '@angular/core' -import { SharedModule } from '../shared' -import { PageNotFoundComponent } from '@app/+page-not-found/page-not-found.component' -import { PageNotFoundRoutingModule } from '@app/+page-not-found/page-not-found-routing.module' +import { PageNotFoundRoutingModule } from './page-not-found-routing.module' +import { PageNotFoundComponent } from './page-not-found.component' @NgModule({ imports: [ - PageNotFoundRoutingModule, - SharedModule + CommonModule, + + PageNotFoundRoutingModule ], declarations: [ diff --git a/client/src/app/+signup/+register/register-routing.module.ts b/client/src/app/+signup/+register/register-routing.module.ts index f47e80755..0deed8a9b 100644 --- a/client/src/app/+signup/+register/register-routing.module.ts +++ b/client/src/app/+signup/+register/register-routing.module.ts @@ -1,9 +1,8 @@ import { NgModule } from '@angular/core' import { RouterModule, Routes } from '@angular/router' +import { ServerConfigResolver, UnloggedGuard } from '@app/core' import { MetaGuard } from '@ngx-meta/core' import { RegisterComponent } from './register.component' -import { ServerConfigResolver } from '@app/core/routing/server-config-resolver.service' -import { UnloggedGuard } from '@app/core/routing/unlogged-guard.service' const registerRoutes: Routes = [ { diff --git a/client/src/app/+signup/+register/register-step-channel.component.ts b/client/src/app/+signup/+register/register-step-channel.component.ts index e434b91a7..8a0120840 100644 --- a/client/src/app/+signup/+register/register-step-channel.component.ts +++ b/client/src/app/+signup/+register/register-step-channel.component.ts @@ -1,10 +1,9 @@ +import { concat, of } from 'rxjs' +import { pairwise } from 'rxjs/operators' import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' -import { AuthService } from '@app/core' -import { FormReactive, UserService, VideoChannelValidatorsService } from '@app/shared' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' import { FormGroup } from '@angular/forms' -import { pairwise } from 'rxjs/operators' -import { concat, of } from 'rxjs' +import { UserService } from '@app/core' +import { FormReactive, FormValidatorService, VideoChannelValidatorsService } from '@app/shared/shared-forms' @Component({ selector: 'my-register-step-channel', @@ -17,7 +16,6 @@ export class RegisterStepChannelComponent extends FormReactive implements OnInit constructor ( protected formValidatorService: FormValidatorService, - private authService: AuthService, private userService: UserService, private videoChannelValidatorsService: VideoChannelValidatorsService ) { diff --git a/client/src/app/+signup/+register/register-step-user.component.ts b/client/src/app/+signup/+register/register-step-user.component.ts index 6c96f20b4..3d9ab8b6b 100644 --- a/client/src/app/+signup/+register/register-step-user.component.ts +++ b/client/src/app/+signup/+register/register-step-user.component.ts @@ -1,10 +1,9 @@ +import { concat, of } from 'rxjs' +import { pairwise } from 'rxjs/operators' import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' -import { AuthService } from '@app/core' -import { FormReactive, UserService, UserValidatorsService } from '@app/shared' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' import { FormGroup } from '@angular/forms' -import { pairwise } from 'rxjs/operators' -import { concat, of } from 'rxjs' +import { UserService } from '@app/core' +import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' @Component({ selector: 'my-register-step-user', @@ -20,7 +19,6 @@ export class RegisterStepUserComponent extends FormReactive implements OnInit { constructor ( protected formValidatorService: FormValidatorService, - private authService: AuthService, private userService: UserService, private userValidatorsService: UserValidatorsService ) { diff --git a/client/src/app/+signup/+register/register.component.ts b/client/src/app/+signup/+register/register.component.ts index ae944ec15..3e8171b27 100644 --- a/client/src/app/+signup/+register/register.component.ts +++ b/client/src/app/+signup/+register/register.component.ts @@ -1,14 +1,13 @@ import { Component, OnInit, ViewChild } from '@angular/core' -import { AuthService, Notifier, RedirectService, ServerService } from '@app/core' -import { UserService, UserValidatorsService } from '@app/shared' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { UserRegister } from '@shared/models/users/user-register.model' import { FormGroup } from '@angular/forms' -import { About, ServerConfig } from '@shared/models/server' -import { InstanceService } from '@app/shared/instance/instance.service' +import { ActivatedRoute } from '@angular/router' +import { AuthService, Notifier, UserService } from '@app/core' import { HooksService } from '@app/core/plugins/hooks.service' +import { InstanceService } from '@app/shared/shared-instance' import { NgbAccordion } from '@ng-bootstrap/ng-bootstrap' -import { ActivatedRoute } from '@angular/router' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { UserRegister } from '@shared/models' +import { About, ServerConfig } from '@shared/models/server' @Component({ selector: 'my-register', @@ -40,11 +39,8 @@ export class RegisterComponent implements OnInit { constructor ( private route: ActivatedRoute, private authService: AuthService, - private userValidatorsService: UserValidatorsService, private notifier: Notifier, private userService: UserService, - private serverService: ServerService, - private redirectService: RedirectService, private instanceService: InstanceService, private hooks: HooksService, private i18n: I18n diff --git a/client/src/app/+signup/+register/register.module.ts b/client/src/app/+signup/+register/register.module.ts index e55f83990..608045f58 100644 --- a/client/src/app/+signup/+register/register.module.ts +++ b/client/src/app/+signup/+register/register.module.ts @@ -1,21 +1,24 @@ +import { CdkStepperModule } from '@angular/cdk/stepper' import { NgModule } from '@angular/core' +import { SignupSharedModule } from '@app/+signup/shared/signup-shared.module' +import { SharedInstanceModule } from '@app/shared/shared-instance' +import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap' +import { CustomStepperComponent } from './custom-stepper.component' import { RegisterRoutingModule } from './register-routing.module' -import { RegisterComponent } from './register.component' -import { SharedModule } from '@app/shared' -import { CdkStepperModule } from '@angular/cdk/stepper' import { RegisterStepChannelComponent } from './register-step-channel.component' import { RegisterStepUserComponent } from './register-step-user.component' -import { CustomStepperComponent } from './custom-stepper.component' -import { SignupSharedModule } from '@app/+signup/shared/signup-shared.module' -import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap' +import { RegisterComponent } from './register.component' @NgModule({ imports: [ RegisterRoutingModule, - SharedModule, + CdkStepperModule, + NgbAccordionModule, + SignupSharedModule, - NgbAccordionModule + + SharedInstanceModule ], declarations: [ diff --git a/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts b/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts index 3bd604b66..51910471b 100644 --- a/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts +++ b/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts @@ -1,10 +1,7 @@ import { Component, OnInit } from '@angular/core' +import { Notifier, RedirectService, ServerService, UserService } from '@app/core' +import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' import { I18n } from '@ngx-translate/i18n-polyfill' -import { Notifier, RedirectService } from '@app/core' -import { ServerService } from '@app/core/server' -import { FormReactive, UserService } from '@app/shared' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' import { ServerConfig } from '@shared/models' @Component({ diff --git a/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts b/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts index 48ddd7130..586f4e231 100644 --- a/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts +++ b/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts @@ -1,8 +1,7 @@ import { Component, OnInit } from '@angular/core' -import { ActivatedRoute, Router } from '@angular/router' +import { ActivatedRoute } from '@angular/router' +import { AuthService, Notifier, UserService } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' -import { AuthService, Notifier } from '@app/core' -import { UserService } from '@app/shared' @Component({ selector: 'my-verify-account-email', @@ -21,7 +20,6 @@ export class VerifyAccountEmailComponent implements OnInit { private userService: UserService, private authService: AuthService, private notifier: Notifier, - private router: Router, private route: ActivatedRoute, private i18n: I18n ) { diff --git a/client/src/app/+signup/+verify-account/verify-account.module.ts b/client/src/app/+signup/+verify-account/verify-account.module.ts index 9fe14e81e..7255605d4 100644 --- a/client/src/app/+signup/+verify-account/verify-account.module.ts +++ b/client/src/app/+signup/+verify-account/verify-account.module.ts @@ -1,14 +1,13 @@ import { NgModule } from '@angular/core' -import { VerifyAccountRoutingModule } from './verify-account-routing.module' -import { VerifyAccountEmailComponent } from './verify-account-email/verify-account-email.component' +import { SignupSharedModule } from '../shared/signup-shared.module' import { VerifyAccountAskSendEmailComponent } from './verify-account-ask-send-email/verify-account-ask-send-email.component' -import { SharedModule } from '@app/shared' -import { SignupSharedModule } from '@app/+signup/shared/signup-shared.module' +import { VerifyAccountEmailComponent } from './verify-account-email/verify-account-email.component' +import { VerifyAccountRoutingModule } from './verify-account-routing.module' @NgModule({ imports: [ VerifyAccountRoutingModule, - SharedModule, + SignupSharedModule ], diff --git a/client/src/app/+signup/shared/signup-shared.module.ts b/client/src/app/+signup/shared/signup-shared.module.ts index cd21fdef3..56b0b3bae 100644 --- a/client/src/app/+signup/shared/signup-shared.module.ts +++ b/client/src/app/+signup/shared/signup-shared.module.ts @@ -1,10 +1,14 @@ import { NgModule } from '@angular/core' -import { SignupSuccessComponent } from '../shared/signup-success.component' -import { SharedModule } from '@app/shared' +import { SharedMainModule } from '@app/shared/shared-main' +import { SignupSuccessComponent } from './signup-success.component' +import { SharedFormModule } from '@app/shared/shared-forms' +import { SharedGlobalIconModule } from '@app/shared/shared-icons' @NgModule({ imports: [ - SharedModule + SharedMainModule, + SharedFormModule, + SharedGlobalIconModule ], declarations: [ @@ -12,6 +16,10 @@ import { SharedModule } from '@app/shared' ], exports: [ + SharedMainModule, + SharedFormModule, + SharedGlobalIconModule, + SignupSuccessComponent ], diff --git a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts index 11f9391e1..19e4bc1f4 100644 --- a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts +++ b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts @@ -1,9 +1,8 @@ +import { Subscription } from 'rxjs' import { Component, OnDestroy, OnInit } from '@angular/core' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' +import { MarkdownService } from '@app/core' +import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' import { I18n } from '@ngx-translate/i18n-polyfill' -import { Subscription } from 'rxjs' -import { MarkdownService } from '@app/shared/renderer' @Component({ selector: 'my-video-channel-about', diff --git a/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.ts b/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.ts index 0b0033082..8b507c626 100644 --- a/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.ts +++ b/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.ts @@ -1,12 +1,8 @@ -import { Component, OnDestroy, OnInit } from '@angular/core' -import { ConfirmService } from '../../core/confirm' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' import { Subject, Subscription } from 'rxjs' -import { Notifier } from '@app/core' -import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' -import { ComponentPagination, hasMoreItems } from '@app/shared/rest/component-pagination.model' -import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' +import { Component, OnDestroy, OnInit } from '@angular/core' +import { ComponentPagination, hasMoreItems } from '@app/core' +import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' +import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' @Component({ selector: 'my-video-channel-playlists', @@ -28,8 +24,6 @@ export class VideoChannelPlaylistsComponent implements OnInit, OnDestroy { private videoChannel: VideoChannel constructor ( - private notifier: Notifier, - private confirmService: ConfirmService, private videoPlaylistService: VideoPlaylistService, private videoChannelService: VideoChannelService ) {} diff --git a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts index 5749701e8..267c328f2 100644 --- a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts +++ b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts @@ -1,25 +1,18 @@ +import { Subscription } from 'rxjs' +import { first, tap } from 'rxjs/operators' import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { immutableAssign } from '@app/shared/misc/utils' -import { AuthService } from '../../core/auth' -import { ConfirmService } from '../../core/confirm' -import { AbstractVideoList } from '../../shared/video/abstract-video-list' -import { VideoService } from '../../shared/video/video.service' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' -import { first, tap } from 'rxjs/operators' +import { AuthService, ConfirmService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' +import { immutableAssign } from '@app/helpers' +import { VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' +import { AbstractVideoList } from '@app/shared/shared-video-miniature' import { I18n } from '@ngx-translate/i18n-polyfill' -import { Subscription } from 'rxjs' -import { ScreenService } from '@app/shared/misc/screen.service' -import { Notifier, ServerService } from '@app/core' -import { UserService } from '@app/shared' -import { LocalStorageService } from '@app/shared/misc/storage.service' @Component({ selector: 'my-video-channel-videos', - templateUrl: '../../shared/video/abstract-video-list.html', + templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html', styleUrls: [ - '../../shared/video/abstract-video-list.scss', + '../../shared/shared-video-miniature/abstract-video-list.scss', './video-channel-videos.component.scss' ] }) diff --git a/client/src/app/+video-channels/video-channels-routing.module.ts b/client/src/app/+video-channels/video-channels-routing.module.ts index d4872a0a5..e79e6a680 100644 --- a/client/src/app/+video-channels/video-channels-routing.module.ts +++ b/client/src/app/+video-channels/video-channels-routing.module.ts @@ -1,10 +1,10 @@ import { NgModule } from '@angular/core' import { RouterModule, Routes } from '@angular/router' import { MetaGuard } from '@ngx-meta/core' -import { VideoChannelsComponent } from './video-channels.component' -import { VideoChannelVideosComponent } from './video-channel-videos/video-channel-videos.component' import { VideoChannelAboutComponent } from './video-channel-about/video-channel-about.component' -import { VideoChannelPlaylistsComponent } from '@app/+video-channels/video-channel-playlists/video-channel-playlists.component' +import { VideoChannelPlaylistsComponent } from './video-channel-playlists/video-channel-playlists.component' +import { VideoChannelVideosComponent } from './video-channel-videos/video-channel-videos.component' +import { VideoChannelsComponent } from './video-channels.component' const videoChannelsRoutes: Routes = [ { diff --git a/client/src/app/+video-channels/video-channels.component.ts b/client/src/app/+video-channels/video-channels.component.ts index a3563c747..cae442ee7 100644 --- a/client/src/app/+video-channels/video-channels.component.ts +++ b/client/src/app/+video-channels/video-channels.component.ts @@ -1,16 +1,12 @@ +import { Hotkey, HotkeysService } from 'angular2-hotkeys' +import { Subscription } from 'rxjs' +import { catchError, distinctUntilChanged, map, switchMap } from 'rxjs/operators' import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core' import { ActivatedRoute } from '@angular/router' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { RestExtractor } from '@app/shared' -import { catchError, distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators' -import { Subscription } from 'rxjs' -import { AuthService, Notifier } from '@app/core' -import { Hotkey, HotkeysService } from 'angular2-hotkeys' -import { SubscribeButtonComponent } from '@app/shared/user-subscription/subscribe-button.component' +import { AuthService, Notifier, RestExtractor, ScreenService } from '@app/core' +import { ListOverflowItem, VideoChannel, VideoChannelService } from '@app/shared/shared-main' +import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' import { I18n } from '@ngx-translate/i18n-polyfill' -import { ListOverflowItem } from '@app/shared/misc/list-overflow.component' -import { ScreenService } from '@app/shared/misc/screen.service' @Component({ templateUrl: './video-channels.component.html', diff --git a/client/src/app/+video-channels/video-channels.module.ts b/client/src/app/+video-channels/video-channels.module.ts index 6975d05b2..05236ff85 100644 --- a/client/src/app/+video-channels/video-channels.module.ts +++ b/client/src/app/+video-channels/video-channels.module.ts @@ -1,15 +1,26 @@ import { NgModule } from '@angular/core' -import { SharedModule } from '../shared' +import { SharedFormModule } from '@app/shared/shared-forms' +import { SharedGlobalIconModule } from '@app/shared/shared-icons' +import { SharedMainModule } from '@app/shared/shared-main' +import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription' +import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' +import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist' +import { VideoChannelAboutComponent } from './video-channel-about/video-channel-about.component' +import { VideoChannelPlaylistsComponent } from './video-channel-playlists/video-channel-playlists.component' +import { VideoChannelVideosComponent } from './video-channel-videos/video-channel-videos.component' import { VideoChannelsRoutingModule } from './video-channels-routing.module' import { VideoChannelsComponent } from './video-channels.component' -import { VideoChannelVideosComponent } from './video-channel-videos/video-channel-videos.component' -import { VideoChannelAboutComponent } from './video-channel-about/video-channel-about.component' -import { VideoChannelPlaylistsComponent } from '@app/+video-channels/video-channel-playlists/video-channel-playlists.component' @NgModule({ imports: [ VideoChannelsRoutingModule, - SharedModule + + SharedMainModule, + SharedFormModule, + SharedVideoPlaylistModule, + SharedVideoMiniatureModule, + SharedUserSubscriptionModule, + SharedGlobalIconModule ], declarations: [ diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts index a87f4ce1b..ceda41415 100644 --- a/client/src/app/app-routing.module.ts +++ b/client/src/app/app-routing.module.ts @@ -1,10 +1,9 @@ import { NgModule } from '@angular/core' import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router' - -import { PreloadSelectedModulesList } from './core' import { AppComponent } from '@app/app.component' import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy' import { MenuGuards } from '@app/core/routing/menu-guard.service' +import { PreloadSelectedModulesList } from './core' const routes: Routes = [ { diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index c77dc97de..a62aa4870 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -1,28 +1,22 @@ -import { Component, OnInit, ViewChild, AfterViewInit, Inject, LOCALE_ID } from '@angular/core' +import { Hotkey, HotkeysService } from 'angular2-hotkeys' +import { concat } from 'rxjs' +import { filter, first, map, pairwise } from 'rxjs/operators' +import { DOCUMENT, PlatformLocation, ViewportScroller } from '@angular/common' +import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core' import { DomSanitizer, SafeHtml } from '@angular/platform-browser' import { Event, GuardsCheckStart, NavigationEnd, Router, Scroll } from '@angular/router' -import { AuthService, RedirectService, ServerService, ThemeService } from '@app/core' -import { is18nPath, getShortLocale } from '../../../shared/models/i18n' -import { ScreenService } from '@app/shared/misc/screen.service' -import { filter, map, pairwise, first } from 'rxjs/operators' -import { Hotkey, HotkeysService } from 'angular2-hotkeys' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { PlatformLocation, ViewportScroller, DOCUMENT } from '@angular/common' -import { PluginService } from '@app/core/plugins/plugin.service' +import { AuthService, MarkdownService, RedirectService, ScreenService, ServerService, ThemeService, User } from '@app/core' import { HooksService } from '@app/core/plugins/hooks.service' -import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { POP_STATE_MODAL_DISMISS } from '@app/shared/misc/constants' -import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' -import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' +import { PluginService } from '@app/core/plugins/plugin.service' import { CustomModalComponent } from '@app/modal/custom-modal.component' -import { ServerConfig, UserRole } from '@shared/models' -import { User } from '@app/shared' -import { InstanceService } from '@app/shared/instance/instance.service' +import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' +import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' +import { NgbModal } from '@ng-bootstrap/ng-bootstrap' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { BroadcastMessageLevel, getShortLocale, is18nPath, ServerConfig, UserRole } from '@shared/models' import { MenuService } from './core/menu/menu.service' -import { BroadcastMessageLevel } from '@shared/models/server' -import { MarkdownService } from './shared/renderer' -import { concat } from 'rxjs' -import { peertubeLocalStorage } from './shared/misc/peertube-web-storage' +import { peertubeLocalStorage, POP_STATE_MODAL_DISMISS } from './helpers' +import { InstanceService } from './shared/shared-instance' @Component({ selector: 'my-app', diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index 89332ec5f..7fbc6463b 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts @@ -1,31 +1,36 @@ +import 'focus-visible' +import { APP_BASE_HREF, registerLocaleData } from '@angular/common' import { LOCALE_ID, NgModule, TRANSLATIONS, TRANSLATIONS_FORMAT } from '@angular/core' import { BrowserModule } from '@angular/platform-browser' import { ServerService } from '@app/core' +import localeOc from '@app/helpers/locales/oc' import { ResetPasswordModule } from '@app/reset-password' +import { SearchModule } from '@app/search' import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core' -import 'focus-visible' - +import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models' import { AppRoutingModule } from './app-routing.module' import { AppComponent } from './app.component' import { CoreModule } from './core' import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header' import { LoginModule } from './login' import { AvatarNotificationComponent, LanguageChooserComponent, MenuComponent } from './menu' -import { SharedModule } from './shared' +import { ConfirmComponent } from './modal/confirm.component' +import { CustomModalComponent } from './modal/custom-modal.component' +import { InstanceConfigWarningModalComponent } from './modal/instance-config-warning-modal.component' +import { QuickSettingsModalComponent } from './modal/quick-settings-modal.component' +import { WelcomeModalComponent } from './modal/welcome-modal.component' +import { SharedFormModule } from './shared/shared-forms' +import { SharedGlobalIconModule } from './shared/shared-icons' +import { SharedInstanceModule } from './shared/shared-instance' +import { SharedMainModule } from './shared/shared-main' +import { SharedUserInterfaceSettingsModule } from './shared/shared-user-settings' import { VideosModule } from './videos' -import { SearchModule } from '@app/search' -import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' -import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' -import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models' -import { APP_BASE_HREF, registerLocaleData } from '@angular/common' -import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component' -import { CustomModalComponent } from '@app/modal/custom-modal.component' -import localeOc from '@app/shared/locale/oc' registerLocaleData(localeOc, 'oc') @NgModule({ bootstrap: [ AppComponent ], + declarations: [ AppComponent, @@ -39,19 +44,24 @@ registerLocaleData(localeOc, 'oc') CustomModalComponent, WelcomeModalComponent, - InstanceConfigWarningModalComponent + InstanceConfigWarningModalComponent, + ConfirmComponent ], + imports: [ BrowserModule, CoreModule, - SharedModule, + SharedMainModule, + SharedFormModule, + SharedUserInterfaceSettingsModule, + SharedGlobalIconModule, + SharedInstanceModule, - CoreModule, LoginModule, ResetPasswordModule, SearchModule, - SharedModule, + VideosModule, MetaModule.forRoot({ diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts index 4ad904beb..4e7801550 100644 --- a/client/src/app/core/auth/auth-user.model.ts +++ b/client/src/app/core/auth/auth-user.model.ts @@ -1,10 +1,14 @@ -import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' -import { UserRight } from '../../../../../shared/models/users/user-right.enum' -import { MyUser as ServerMyUserModel, User as ServerUserModel, MyUserSpecialPlaylist } from '../../../../../shared/models/users/user.model' -// Do not use the barrel (dependency loop) -import { hasUserRight, UserRole } from '../../../../../shared/models/users/user-role' -import { User } from '../../shared/users/user.model' -import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' +import { User } from '@app/core/users/user.model' +import { peertubeLocalStorage } from '@app/helpers/peertube-web-storage' +import { + hasUserRight, + MyUser as ServerMyUserModel, + MyUserSpecialPlaylist, + NSFWPolicyType, + User as ServerUserModel, + UserRight, + UserRole +} from '@shared/models' export type TokenOptions = { accessToken: string diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index de8c509d1..94262b9aa 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts @@ -1,20 +1,17 @@ +import { Hotkey, HotkeysService } from 'angular2-hotkeys' import { Observable, ReplaySubject, Subject, throwError as observableThrowError } from 'rxjs' import { catchError, map, mergeMap, share, tap } from 'rxjs/operators' import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { Router } from '@angular/router' import { Notifier } from '@app/core/notification/notifier.service' -import { OAuthClientLocal, MyUser as UserServerModel, UserRefreshToken } from '../../../../../shared' -import { User } from '../../../../../shared/models/users' -import { UserLogin } from '../../../../../shared/models/users/user-login.model' +import { objectToUrlEncoded, peertubeLocalStorage } from '@app/helpers' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models' import { environment } from '../../../environments/environment' -import { RestExtractor } from '../../shared/rest/rest-extractor.service' +import { RestExtractor } from '../rest/rest-extractor.service' import { AuthStatus } from './auth-status.model' import { AuthUser } from './auth-user.model' -import { objectToUrlEncoded } from '@app/shared/misc/utils' -import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { Hotkey, HotkeysService } from 'angular2-hotkeys' interface UserLoginWithUsername extends UserLogin { access_token: string diff --git a/client/src/app/core/core.module.ts b/client/src/app/core/core.module.ts index a1734ad80..22896e2e9 100644 --- a/client/src/app/core/core.module.ts +++ b/client/src/app/core/core.module.ts @@ -1,35 +1,35 @@ +import { HotkeyModule } from 'angular2-hotkeys' +import { MessageService } from 'primeng/api' +import { ToastModule } from 'primeng/toast' import { CommonModule } from '@angular/common' import { NgModule, Optional, SkipSelf } from '@angular/core' -import { FormsModule } from '@angular/forms' import { BrowserAnimationsModule } from '@angular/platform-browser/animations' -import { RouterModule } from '@angular/router' +import { UserNotificationSocket } from '@app/core/notification/user-notification-socket.service' +import { HooksService } from '@app/core/plugins/hooks.service' +import { PluginService } from '@app/core/plugins/plugin.service' +import { UnloggedGuard } from '@app/core/routing/unlogged-guard.service' import { LoadingBarModule } from '@ngx-loading-bar/core' import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client' import { LoadingBarRouterModule } from '@ngx-loading-bar/router' - import { AuthService } from './auth' import { ConfirmService } from './confirm' +import { CheatSheetComponent } from './hotkeys' +import { MenuService } from './menu' import { throwIfAlreadyLoaded } from './module-import-guard' +import { Notifier } from './notification' +import { HtmlRendererService, LinkifierService, MarkdownService } from './renderer' +import { RestExtractor, RestService } from './rest' import { LoginGuard, RedirectService, UserRightGuard } from './routing' +import { CanDeactivateGuard } from './routing/can-deactivate-guard.service' +import { ServerConfigResolver } from './routing/server-config-resolver.service' import { ServerService } from './server' import { ThemeService } from './theme' -import { MenuService } from './menu' -import { HotkeyModule } from 'angular2-hotkeys' -import { CheatSheetComponent } from './hotkeys' -import { ToastModule } from 'primeng/toast' -import { Notifier } from './notification' -import { MessageService } from 'primeng/api' -import { UserNotificationSocket } from '@app/core/notification/user-notification-socket.service' -import { ServerConfigResolver } from './routing/server-config-resolver.service' -import { UnloggedGuard } from '@app/core/routing/unlogged-guard.service' -import { PluginService } from '@app/core/plugins/plugin.service' -import { HooksService } from '@app/core/plugins/hooks.service' +import { UserService } from './users' +import { LocalStorageService, ScreenService, SessionStorageService } from './wrappers' @NgModule({ imports: [ CommonModule, - RouterModule, - FormsModule, BrowserAnimationsModule, LoadingBarHttpClientModule, @@ -68,11 +68,25 @@ import { HooksService } from '@app/core/plugins/hooks.service' PluginService, HooksService, + HtmlRendererService, + LinkifierService, + MarkdownService, + + RestExtractor, + RestService, + + UserService, + + ScreenService, + LocalStorageService, + SessionStorageService, + RedirectService, Notifier, MessageService, UserNotificationSocket, - ServerConfigResolver + ServerConfigResolver, + CanDeactivateGuard ] }) export class CoreModule { diff --git a/client/src/app/core/index.ts b/client/src/app/core/index.ts index f664aff41..a0c34543d 100644 --- a/client/src/app/core/index.ts +++ b/client/src/app/core/index.ts @@ -1,8 +1,15 @@ export * from './auth' export * from './confirm' +export * from './hotkeys' +export * from './menu' +export * from './notification' +export * from './plugins' +export * from './renderer' +export * from './rest' export * from './routing' export * from './server' -export * from './notification' export * from './theme' +export * from './users' +export * from './wrappers' export * from './core.module' diff --git a/client/src/app/core/menu/menu.service.ts b/client/src/app/core/menu/menu.service.ts index 81093c666..ef5271f97 100644 --- a/client/src/app/core/menu/menu.service.ts +++ b/client/src/app/core/menu/menu.service.ts @@ -1,7 +1,7 @@ -import { Injectable } from '@angular/core' -import { ScreenService } from '@app/shared/misc/screen.service' import { fromEvent } from 'rxjs' import { debounceTime } from 'rxjs/operators' +import { Injectable } from '@angular/core' +import { ScreenService } from '../wrappers' @Injectable() export class MenuService { diff --git a/client/src/app/core/notification/user-notification-socket.service.ts b/client/src/app/core/notification/user-notification-socket.service.ts index 3f22da476..37f0bc32c 100644 --- a/client/src/app/core/notification/user-notification-socket.service.ts +++ b/client/src/app/core/notification/user-notification-socket.service.ts @@ -1,7 +1,7 @@ +import { Subject } from 'rxjs' import { Injectable, NgZone } from '@angular/core' +import { UserNotification as UserNotificationServer } from '@shared/models' import { environment } from '../../../environments/environment' -import { UserNotification as UserNotificationServer } from '../../../../../shared' -import { Subject } from 'rxjs' import { AuthService } from '../auth' export type NotificationEvent = 'new' | 'read' | 'read-all' diff --git a/client/src/app/core/plugins/hooks.service.ts b/client/src/app/core/plugins/hooks.service.ts index 2fbf406d1..ec47aa48c 100644 --- a/client/src/app/core/plugins/hooks.service.ts +++ b/client/src/app/core/plugins/hooks.service.ts @@ -2,8 +2,7 @@ import { from, Observable } from 'rxjs' import { mergeMap, switchMap } from 'rxjs/operators' import { Injectable } from '@angular/core' import { PluginService } from '@app/core/plugins/plugin.service' -import { ClientActionHookName, ClientFilterHookName } from '@shared/models/plugins/client-hook.model' -import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' +import { ClientActionHookName, ClientFilterHookName, PluginClientScope } from '@shared/models' type RawFunction = (params: U) => T type ObservableFunction = RawFunction> diff --git a/client/src/app/core/plugins/index.ts b/client/src/app/core/plugins/index.ts new file mode 100644 index 000000000..b3239f1f3 --- /dev/null +++ b/client/src/app/core/plugins/index.ts @@ -0,0 +1,2 @@ +export * from './hooks.service' +export * from './plugin.service' diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts index c6efcac6d..3cab64142 100644 --- a/client/src/app/core/plugins/plugin.service.ts +++ b/client/src/app/core/plugins/plugin.service.ts @@ -1,28 +1,33 @@ -import { Inject, Injectable, LOCALE_ID, NgZone } from '@angular/core' -import { Router } from '@angular/router' -import { getCompleteLocale, isDefaultLocale, peertubeTranslate, ServerConfigPlugin } from '@shared/models' -import { ServerService } from '@app/core/server/server.service' -import { ClientScript } from '@shared/models/plugins/plugin-package-json.model' -import { ClientScript as ClientScriptModule } from '../../../types/client-script.model' -import { environment } from '../../../environments/environment' import { Observable, of, ReplaySubject } from 'rxjs' import { catchError, first, map, shareReplay } from 'rxjs/operators' -import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks' -import { ClientHook, ClientHookName, clientHookObject } from '@shared/models/plugins/client-hook.model' -import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' -import { RegisterClientHookOptions } from '@shared/models/plugins/register-client-hook.model' import { HttpClient } from '@angular/common/http' +import { Inject, Injectable, LOCALE_ID, NgZone } from '@angular/core' import { AuthService } from '@app/core/auth' import { Notifier } from '@app/core/notification' -import { RestExtractor } from '@app/shared/rest' -import { MarkdownService } from '@app/shared/renderer' -import { PluginType } from '@shared/models/plugins/plugin.type' -import { PublicServerSetting } from '@shared/models/plugins/public-server.setting' -import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils' -import { RegisterClientHelpers } from '../../../types/register-client-option.model' -import { PluginTranslation } from '@shared/models/plugins/plugin-translation.model' -import { importModule } from '@app/shared/misc/utils' +import { MarkdownService } from '@app/core/renderer' +import { RestExtractor } from '@app/core/rest' +import { ServerService } from '@app/core/server/server.service' +import { getDevLocale, importModule, isOnDevLocale } from '@app/helpers' import { CustomModalComponent } from '@app/modal/custom-modal.component' +import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks' +import { + ClientHook, + ClientHookName, + clientHookObject, + ClientScript, + getCompleteLocale, + isDefaultLocale, + peertubeTranslate, + PluginClientScope, + PluginTranslation, + PluginType, + PublicServerSetting, + RegisterClientHookOptions, + ServerConfigPlugin +} from '@shared/models' +import { environment } from '../../../environments/environment' +import { ClientScript as ClientScriptModule } from '../../../types/client-script.model' +import { RegisterClientHelpers } from '../../../types/register-client-option.model' interface HookStructValue extends RegisterClientHookOptions { plugin: ServerConfigPlugin @@ -64,7 +69,6 @@ export class PluginService implements ClientHook { private hooks: { [ name: string ]: HookStructValue[] } = {} constructor ( - private router: Router, private authService: AuthService, private notifier: Notifier, private markdownRenderer: MarkdownService, diff --git a/client/src/app/shared/renderer/html-renderer.service.ts b/client/src/app/core/renderer/html-renderer.service.ts similarity index 93% rename from client/src/app/shared/renderer/html-renderer.service.ts rename to client/src/app/core/renderer/html-renderer.service.ts index 1ddd8fe2f..f0527c759 100644 --- a/client/src/app/shared/renderer/html-renderer.service.ts +++ b/client/src/app/core/renderer/html-renderer.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core' -import { LinkifierService } from '@app/shared/renderer/linkifier.service' +import { LinkifierService } from './linkifier.service' @Injectable() export class HtmlRendererService { diff --git a/client/src/app/shared/renderer/index.ts b/client/src/app/core/renderer/index.ts similarity index 100% rename from client/src/app/shared/renderer/index.ts rename to client/src/app/core/renderer/index.ts diff --git a/client/src/app/shared/renderer/linkifier.service.ts b/client/src/app/core/renderer/linkifier.service.ts similarity index 98% rename from client/src/app/shared/renderer/linkifier.service.ts rename to client/src/app/core/renderer/linkifier.service.ts index 95d5f17cc..46d5b0089 100644 --- a/client/src/app/shared/renderer/linkifier.service.ts +++ b/client/src/app/core/renderer/linkifier.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core' -import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' +import { getAbsoluteAPIUrl } from '@app/helpers/utils' import * as linkify from 'linkifyjs' import linkifyHtml from 'linkifyjs/html' diff --git a/client/src/app/shared/renderer/markdown.service.ts b/client/src/app/core/renderer/markdown.service.ts similarity index 97% rename from client/src/app/shared/renderer/markdown.service.ts rename to client/src/app/core/renderer/markdown.service.ts index f0c87326f..0c43bebab 100644 --- a/client/src/app/shared/renderer/markdown.service.ts +++ b/client/src/app/core/renderer/markdown.service.ts @@ -1,7 +1,7 @@ -import { Injectable } from '@angular/core' -import { buildVideoLink } from '../../../assets/player/utils' -import { HtmlRendererService } from '@app/shared/renderer/html-renderer.service' import * as MarkdownIt from 'markdown-it' +import { buildVideoLink } from 'src/assets/player/utils' +import { Injectable } from '@angular/core' +import { HtmlRendererService } from './html-renderer.service' type MarkdownParsers = { textMarkdownIt: MarkdownIt diff --git a/client/src/app/shared/rest/component-pagination.model.ts b/client/src/app/core/rest/component-pagination.model.ts similarity index 100% rename from client/src/app/shared/rest/component-pagination.model.ts rename to client/src/app/core/rest/component-pagination.model.ts diff --git a/client/src/app/shared/rest/index.ts b/client/src/app/core/rest/index.ts similarity index 75% rename from client/src/app/shared/rest/index.ts rename to client/src/app/core/rest/index.ts index f00cda2b8..93899beaf 100644 --- a/client/src/app/shared/rest/index.ts +++ b/client/src/app/core/rest/index.ts @@ -1,4 +1,5 @@ +export * from './component-pagination.model' export * from './rest-extractor.service' export * from './rest-pagination' -export * from './rest.service' export * from './rest-table' +export * from './rest.service' diff --git a/client/src/app/shared/rest/rest-extractor.service.ts b/client/src/app/core/rest/rest-extractor.service.ts similarity index 97% rename from client/src/app/shared/rest/rest-extractor.service.ts rename to client/src/app/core/rest/rest-extractor.service.ts index e6518dd1d..9de964f79 100644 --- a/client/src/app/shared/rest/rest-extractor.service.ts +++ b/client/src/app/core/rest/rest-extractor.service.ts @@ -1,9 +1,9 @@ import { throwError as observableThrowError } from 'rxjs' import { Injectable } from '@angular/core' -import { dateToHuman } from '@app/shared/misc/utils' -import { ResultList } from '../../../../../shared' import { Router } from '@angular/router' +import { dateToHuman } from '@app/helpers' import { I18n } from '@ngx-translate/i18n-polyfill' +import { ResultList } from '@shared/models' @Injectable() export class RestExtractor { diff --git a/client/src/app/shared/rest/rest-pagination.ts b/client/src/app/core/rest/rest-pagination.ts similarity index 100% rename from client/src/app/shared/rest/rest-pagination.ts rename to client/src/app/core/rest/rest-pagination.ts diff --git a/client/src/app/shared/rest/rest-table.ts b/client/src/app/core/rest/rest-table.ts similarity index 96% rename from client/src/app/shared/rest/rest-table.ts rename to client/src/app/core/rest/rest-table.ts index d4e6cf5f2..1b35ad47d 100644 --- a/client/src/app/shared/rest/rest-table.ts +++ b/client/src/app/core/rest/rest-table.ts @@ -1,4 +1,4 @@ -import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' +import { peertubeLocalStorage } from '@app/helpers/peertube-web-storage' import { LazyLoadEvent, SortMeta } from 'primeng/api' import { RestPagination } from './rest-pagination' import { Subject } from 'rxjs' diff --git a/client/src/app/shared/rest/rest.service.ts b/client/src/app/core/rest/rest.service.ts similarity index 100% rename from client/src/app/shared/rest/rest.service.ts rename to client/src/app/core/rest/rest.service.ts diff --git a/client/src/app/shared/guards/can-deactivate-guard.service.ts b/client/src/app/core/routing/can-deactivate-guard.service.ts similarity index 94% rename from client/src/app/shared/guards/can-deactivate-guard.service.ts rename to client/src/app/core/routing/can-deactivate-guard.service.ts index 3a35fcfb3..e0405293a 100644 --- a/client/src/app/shared/guards/can-deactivate-guard.service.ts +++ b/client/src/app/core/routing/can-deactivate-guard.service.ts @@ -1,7 +1,7 @@ +import { Observable } from 'rxjs' import { Injectable } from '@angular/core' import { CanDeactivate } from '@angular/router' -import { Observable } from 'rxjs' -import { ConfirmService } from '../../core/index' +import { ConfirmService } from '@app/core/confirm' import { I18n } from '@ngx-translate/i18n-polyfill' export type CanComponentDeactivateResult = { text?: string, canDeactivate: Observable | boolean } diff --git a/client/src/app/core/routing/index.ts b/client/src/app/core/routing/index.ts index 58b83bb2a..239c27caf 100644 --- a/client/src/app/core/routing/index.ts +++ b/client/src/app/core/routing/index.ts @@ -1,5 +1,10 @@ +export * from './can-deactivate-guard.service' +export * from './custom-reuse-strategy' +export * from './disable-for-reuse-hook' export * from './login-guard.service' -export * from './user-right-guard.service' +export * from './menu-guard.service' export * from './preload-selected-modules-list' export * from './redirect.service' -export * from './menu-guard.service' +export * from './server-config-resolver.service' +export * from './unlogged-guard.service' +export * from './user-right-guard.service' diff --git a/client/src/app/core/routing/login-guard.service.ts b/client/src/app/core/routing/login-guard.service.ts index 7b1c37ee8..a949be14c 100644 --- a/client/src/app/core/routing/login-guard.service.ts +++ b/client/src/app/core/routing/login-guard.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@angular/core' import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, Router, RouterStateSnapshot } from '@angular/router' - import { AuthService } from '../auth/auth.service' @Injectable() diff --git a/client/src/app/core/routing/menu-guard.service.ts b/client/src/app/core/routing/menu-guard.service.ts index 907d145fd..9df285635 100644 --- a/client/src/app/core/routing/menu-guard.service.ts +++ b/client/src/app/core/routing/menu-guard.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core' import { CanActivate, CanDeactivate } from '@angular/router' -import { MenuService } from '@app/core/menu' -import { ScreenService } from '@app/shared/misc/screen.service' +import { MenuService } from '../menu' +import { ScreenService } from '../wrappers' abstract class MenuGuard implements CanActivate, CanDeactivate { display = true diff --git a/client/src/app/core/routing/preload-selected-modules-list.ts b/client/src/app/core/routing/preload-selected-modules-list.ts index 64af68225..b494a40bc 100644 --- a/client/src/app/core/routing/preload-selected-modules-list.ts +++ b/client/src/app/core/routing/preload-selected-modules-list.ts @@ -5,6 +5,7 @@ import { Injectable } from '@angular/core' @Injectable() export class PreloadSelectedModulesList implements PreloadingStrategy { + preload (route: Route, load: Function): Observable { if (!route.data || !route.data.preload) return ofObservable(null) diff --git a/client/src/app/core/routing/server-config-resolver.service.ts b/client/src/app/core/routing/server-config-resolver.service.ts index 3b7ed99bf..0ce2023a0 100644 --- a/client/src/app/core/routing/server-config-resolver.service.ts +++ b/client/src/app/core/routing/server-config-resolver.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core' import { Resolve } from '@angular/router' -import { ServerService } from '@app/core/server' +import { ServerService } from '../server' import { ServerConfig } from '@shared/models' @Injectable() diff --git a/client/src/app/core/routing/unlogged-guard.service.ts b/client/src/app/core/routing/unlogged-guard.service.ts index 3132a1a77..0be7911a0 100644 --- a/client/src/app/core/routing/unlogged-guard.service.ts +++ b/client/src/app/core/routing/unlogged-guard.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core' -import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, Router, RouterStateSnapshot } from '@angular/router' +import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, RouterStateSnapshot } from '@angular/router' import { AuthService } from '../auth/auth.service' import { RedirectService } from './redirect.service' @@ -7,7 +7,6 @@ import { RedirectService } from './redirect.service' export class UnloggedGuard implements CanActivate, CanActivateChild { constructor ( - private router: Router, private auth: AuthService, private redirectService: RedirectService ) {} diff --git a/client/src/app/core/routing/user-right-guard.service.ts b/client/src/app/core/routing/user-right-guard.service.ts index 50c3d8c19..a2ce772db 100644 --- a/client/src/app/core/routing/user-right-guard.service.ts +++ b/client/src/app/core/routing/user-right-guard.service.ts @@ -1,12 +1,5 @@ import { Injectable } from '@angular/core' -import { - ActivatedRouteSnapshot, - CanActivateChild, - RouterStateSnapshot, - CanActivate, - Router -} from '@angular/router' - +import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, Router, RouterStateSnapshot } from '@angular/router' import { AuthService } from '../auth/auth.service' @Injectable() diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index a804efd28..32a135203 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts @@ -2,14 +2,16 @@ import { Observable, of, Subject } from 'rxjs' import { first, map, share, shareReplay, switchMap, tap } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' import { Inject, Injectable, LOCALE_ID } from '@angular/core' -import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils' -import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' -import { sortBy } from '@app/shared/misc/utils' -import { SearchTargetType } from '@shared/models/search/search-target-query.model' -import { ServerStats } from '@shared/models/server' -import { getCompleteLocale, ServerConfig } from '../../../../../shared' -import { isDefaultLocale, peertubeTranslate } from '../../../../../shared/models/i18n' -import { VideoConstant } from '../../../../../shared/models/videos' +import { getDevLocale, isOnDevLocale, peertubeLocalStorage, sortBy } from '@app/helpers' +import { + getCompleteLocale, + isDefaultLocale, + peertubeTranslate, + SearchTargetType, + ServerConfig, + ServerStats, + VideoConstant +} from '@shared/models' import { environment } from '../../../environments/environment' @Injectable() diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.ts index c0189ad32..9dbf22e20 100644 --- a/client/src/app/core/theme/theme.service.ts +++ b/client/src/app/core/theme/theme.service.ts @@ -1,13 +1,13 @@ +import { first } from 'rxjs/operators' import { Injectable } from '@angular/core' -import { AuthService } from '@app/core/auth' -import { ServerService } from '@app/core/server' -import { environment } from '../../../environments/environment' -import { PluginService } from '@app/core/plugins/plugin.service' +import { AuthService } from '../auth' +import { PluginService } from '../plugins/plugin.service' +import { ServerService } from '../server' +import { LocalStorageService } from '../wrappers/storage.service' +import { User } from '../users/user.model' +import { UserService } from '../users/user.service' import { ServerConfig, ServerConfigTheme } from '@shared/models' -import { first } from 'rxjs/operators' -import { User } from '@app/shared/users/user.model' -import { UserService } from '@app/shared/users/user.service' -import { LocalStorageService } from '@app/shared/misc/storage.service' +import { environment } from '../../../environments/environment' @Injectable() export class ThemeService { diff --git a/client/src/app/shared/users/index.ts b/client/src/app/core/users/index.ts similarity index 56% rename from client/src/app/shared/users/index.ts rename to client/src/app/core/users/index.ts index ebd715fb1..7b5a67bc7 100644 --- a/client/src/app/shared/users/index.ts +++ b/client/src/app/core/users/index.ts @@ -1,3 +1,2 @@ export * from './user.model' export * from './user.service' -export * from './user-notifications.component' diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/core/users/user.model.ts similarity index 89% rename from client/src/app/shared/users/user.model.ts rename to client/src/app/core/users/user.model.ts index 3348fe75f..8ecdf9fcd 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/core/users/user.model.ts @@ -1,15 +1,15 @@ +import { Account } from '@app/shared/shared-main/account/account.model' import { + Avatar, hasUserRight, + NSFWPolicyType, User as UserServerModel, + UserAdminFlag, UserNotificationSetting, UserRight, - UserRole -} from '../../../../../shared/models/users' -import { VideoChannel } from '../../../../../shared/models/videos' -import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' -import { Account } from '@app/shared/account/account.model' -import { Avatar } from '../../../../../shared/models/avatars/avatar.model' -import { UserAdminFlag } from '@shared/models/users/user-flag.model' + UserRole, + VideoChannel +} from '@shared/models' export class User implements UserServerModel { static KEYS = { diff --git a/client/src/app/shared/users/user.service.ts b/client/src/app/core/users/user.service.ts similarity index 95% rename from client/src/app/shared/users/user.service.ts rename to client/src/app/core/users/user.service.ts index de1c8ec94..ab395b1f9 100644 --- a/client/src/app/shared/users/user.service.ts +++ b/client/src/app/core/users/user.service.ts @@ -2,18 +2,26 @@ import { has } from 'lodash-es' import { BytesPipe } from 'ngx-pipes' import { SortMeta } from 'primeng/api' import { from, Observable, of } from 'rxjs' -import { catchError, concatMap, first, map, shareReplay, toArray, throttleTime, filter } from 'rxjs/operators' +import { catchError, concatMap, filter, first, map, shareReplay, throttleTime, toArray } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { AuthService } from '@app/core/auth' import { I18n } from '@ngx-translate/i18n-polyfill' -import { UserRegister } from '@shared/models/users/user-register.model' -import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type' -import { ResultList, User as UserServerModel, UserCreate, UserRole, UserUpdate, UserUpdateMe, UserVideoQuota } from '../../../../../shared' -import { Avatar } from '../../../../../shared/models/avatars/avatar.model' +import { + Avatar, + NSFWPolicyType, + ResultList, + User as UserServerModel, + UserCreate, + UserRegister, + UserRole, + UserUpdate, + UserUpdateMe, + UserVideoQuota +} from '@shared/models' import { environment } from '../../../environments/environment' -import { LocalStorageService, SessionStorageService } from '../misc/storage.service' import { RestExtractor, RestPagination, RestService } from '../rest' +import { LocalStorageService, SessionStorageService } from '../wrappers/storage.service' import { User } from './user.model' @Injectable() diff --git a/client/src/app/core/wrappers/index.ts b/client/src/app/core/wrappers/index.ts new file mode 100644 index 000000000..d82b70070 --- /dev/null +++ b/client/src/app/core/wrappers/index.ts @@ -0,0 +1,2 @@ +export * from './screen.service' +export * from './storage.service' diff --git a/client/src/app/shared/misc/screen.service.ts b/client/src/app/core/wrappers/screen.service.ts similarity index 100% rename from client/src/app/shared/misc/screen.service.ts rename to client/src/app/core/wrappers/screen.service.ts diff --git a/client/src/app/shared/misc/storage.service.ts b/client/src/app/core/wrappers/storage.service.ts similarity index 92% rename from client/src/app/shared/misc/storage.service.ts rename to client/src/app/core/wrappers/storage.service.ts index 0d4a8ab53..9a60b9785 100644 --- a/client/src/app/shared/misc/storage.service.ts +++ b/client/src/app/core/wrappers/storage.service.ts @@ -1,10 +1,7 @@ -import { Injectable } from '@angular/core' import { Observable, Subject } from 'rxjs' -import { - peertubeLocalStorage, - peertubeSessionStorage -} from './peertube-web-storage' import { filter } from 'rxjs/operators' +import { Injectable } from '@angular/core' +import { peertubeLocalStorage, peertubeSessionStorage } from '@app/helpers' abstract class StorageService { protected instance: Storage diff --git a/client/src/app/header/search-typeahead.component.ts b/client/src/app/header/search-typeahead.component.ts index 7d04e0f6d..c546628ee 100644 --- a/client/src/app/header/search-typeahead.component.ts +++ b/client/src/app/header/search-typeahead.component.ts @@ -1,11 +1,10 @@ import { of } from 'rxjs' -import { first, tap, delay } from 'rxjs/operators' +import { first, tap } from 'rxjs/operators' import { ListKeyManager } from '@angular/cdk/a11y' -import { AfterViewInit, Component, ElementRef, OnDestroy, OnInit, QueryList, ViewChild, ViewChildren, AfterViewChecked } from '@angular/core' +import { AfterViewChecked, AfterViewInit, Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core' import { ActivatedRoute, Params, Router } from '@angular/router' import { AuthService, ServerService } from '@app/core' -import { ServerConfig } from '@shared/models' -import { SearchTargetType } from '@shared/models/search/search-target-query.model' +import { SearchTargetType, ServerConfig } from '@shared/models' import { SuggestionComponent, SuggestionPayload, SuggestionPayloadType } from './suggestion.component' @Component({ diff --git a/client/src/app/header/suggestion.component.ts b/client/src/app/header/suggestion.component.ts index 250a5411e..c874212a5 100644 --- a/client/src/app/header/suggestion.component.ts +++ b/client/src/app/header/suggestion.component.ts @@ -1,6 +1,6 @@ -import { Input, Component, Output, EventEmitter, OnInit, ChangeDetectionStrategy, OnChanges } from '@angular/core' -import { RouterLink } from '@angular/router' import { ListKeyManagerOption } from '@angular/cdk/a11y' +import { Component, Input, OnInit } from '@angular/core' +import { RouterLink } from '@angular/router' export type SuggestionPayload = { text: string diff --git a/client/src/app/shared/misc/constants.ts b/client/src/app/helpers/constants.ts similarity index 100% rename from client/src/app/shared/misc/constants.ts rename to client/src/app/helpers/constants.ts diff --git a/client/src/app/shared/i18n/i18n-utils.ts b/client/src/app/helpers/i18n-utils.ts similarity index 76% rename from client/src/app/shared/i18n/i18n-utils.ts rename to client/src/app/helpers/i18n-utils.ts index 30d65a2a2..bbfb12959 100644 --- a/client/src/app/shared/i18n/i18n-utils.ts +++ b/client/src/app/helpers/i18n-utils.ts @@ -1,4 +1,4 @@ -import { environment } from '../../../environments/environment' +import { environment } from '../../environments/environment' function isOnDevLocale () { return environment.production === false && window.location.search === '?lang=fr' diff --git a/client/src/app/helpers/index.ts b/client/src/app/helpers/index.ts new file mode 100644 index 000000000..06806402e --- /dev/null +++ b/client/src/app/helpers/index.ts @@ -0,0 +1,6 @@ +export * from './locales' +export * from './constants' +export * from './i18n-utils' +export * from './peertube-web-storage' +export * from './utils' +export * from './zone' diff --git a/client/src/app/helpers/locales/index.ts b/client/src/app/helpers/locales/index.ts new file mode 100644 index 000000000..b0e4d6148 --- /dev/null +++ b/client/src/app/helpers/locales/index.ts @@ -0,0 +1 @@ +export * from './oc' diff --git a/client/src/app/shared/locale/oc.ts b/client/src/app/helpers/locales/oc.ts similarity index 100% rename from client/src/app/shared/locale/oc.ts rename to client/src/app/helpers/locales/oc.ts diff --git a/client/src/app/shared/misc/peertube-web-storage.ts b/client/src/app/helpers/peertube-web-storage.ts similarity index 100% rename from client/src/app/shared/misc/peertube-web-storage.ts rename to client/src/app/helpers/peertube-web-storage.ts diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/helpers/utils.ts similarity index 98% rename from client/src/app/shared/misc/utils.ts rename to client/src/app/helpers/utils.ts index bc3ab85b3..879f697f4 100644 --- a/client/src/app/shared/misc/utils.ts +++ b/client/src/app/helpers/utils.ts @@ -1,6 +1,6 @@ import { DatePipe } from '@angular/common' -import { environment } from '../../../environments/environment' -import { AuthService } from '../../core/auth' +import { environment } from '../../environments/environment' +import { AuthService } from '../core/auth' // Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript function getParameterByName (name: string, url: string) { diff --git a/client/src/app/shared/rxjs/zone.ts b/client/src/app/helpers/zone.ts similarity index 100% rename from client/src/app/shared/rxjs/zone.ts rename to client/src/app/helpers/zone.ts diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts index fff4b43f6..cbc51ee21 100644 --- a/client/src/app/login/login.component.ts +++ b/client/src/app/login/login.component.ts @@ -1,16 +1,12 @@ -import { Component, ElementRef, OnInit, ViewChild, AfterViewInit } from '@angular/core' -import { Notifier, RedirectService } from '@app/core' -import { UserService } from '@app/shared' -import { AuthService } from '../core' -import { FormReactive } from '../shared' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { LoginValidatorsService } from '@app/shared/forms/form-validators/login-validators.service' -import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' -import { ActivatedRoute } from '@angular/router' -import { ServerConfig, RegisteredExternalAuthConfig } from '@shared/models/server/server-config.model' import { environment } from 'src/environments/environment' +import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core' +import { ActivatedRoute } from '@angular/router' +import { AuthService, Notifier, RedirectService, UserService } from '@app/core' import { HooksService } from '@app/core/plugins/hooks.service' +import { FormReactive, FormValidatorService, LoginValidatorsService } from '@app/shared/shared-forms' +import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { RegisteredExternalAuthConfig, ServerConfig } from '@shared/models' @Component({ selector: 'my-login', diff --git a/client/src/app/login/login.module.ts b/client/src/app/login/login.module.ts index 1de72dbaa..c41902426 100644 --- a/client/src/app/login/login.module.ts +++ b/client/src/app/login/login.module.ts @@ -1,13 +1,17 @@ import { NgModule } from '@angular/core' - +import { SharedFormModule } from '@app/shared/shared-forms' +import { SharedGlobalIconModule } from '@app/shared/shared-icons' +import { SharedMainModule } from '@app/shared/shared-main' import { LoginRoutingModule } from './login-routing.module' import { LoginComponent } from './login.component' -import { SharedModule } from '../shared' @NgModule({ imports: [ LoginRoutingModule, - SharedModule + + SharedMainModule, + SharedFormModule, + SharedGlobalIconModule ], declarations: [ diff --git a/client/src/app/menu/avatar-notification.component.ts b/client/src/app/menu/avatar-notification.component.ts index c447f031c..9a64faa6a 100644 --- a/client/src/app/menu/avatar-notification.component.ts +++ b/client/src/app/menu/avatar-notification.component.ts @@ -1,11 +1,10 @@ -import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core' -import { User } from '../shared/users/user.model' -import { UserNotificationService } from '@app/shared/users/user-notification.service' import { Subject, Subscription } from 'rxjs' -import { Notifier, UserNotificationSocket } from '@app/core' -import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' -import { NavigationEnd, Router } from '@angular/router' import { filter } from 'rxjs/operators' +import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core' +import { NavigationEnd, Router } from '@angular/router' +import { Notifier, User, UserNotificationSocket } from '@app/core' +import { UserNotificationService } from '@app/shared/shared-main' +import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' @Component({ selector: 'my-avatar-notification', diff --git a/client/src/app/menu/language-chooser.component.ts b/client/src/app/menu/language-chooser.component.ts index c9b775921..3e89f72b8 100644 --- a/client/src/app/menu/language-chooser.component.ts +++ b/client/src/app/menu/language-chooser.component.ts @@ -1,9 +1,7 @@ -import { Component, ElementRef, ViewChild, Inject, LOCALE_ID } from '@angular/core' -import { I18N_LOCALES, getShortLocale } from '../../../../shared' +import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core' +import { getDevLocale, isOnDevLocale, sortBy } from '@app/helpers' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { sortBy } from '@app/shared/misc/utils' -import { getCompleteLocale } from '@shared/models/i18n' -import { isOnDevLocale, getDevLocale } from '@app/shared/i18n/i18n-utils' +import { getCompleteLocale, getShortLocale, I18N_LOCALES } from '@shared/models' @Component({ selector: 'my-language-chooser', diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts index ba3342541..2dbe695c9 100644 --- a/client/src/app/menu/menu.component.ts +++ b/client/src/app/menu/menu.component.ts @@ -1,14 +1,10 @@ +import { HotkeysService } from 'angular2-hotkeys' import { Component, OnInit, ViewChild } from '@angular/core' -import { UserRight } from '../../../../shared/models/users/user-right.enum' -import { AuthService, AuthStatus, RedirectService, ServerService } from '../core' -import { User } from '@app/shared/users/user.model' -import { UserService } from '@app/shared/users/user.service' +import { AuthService, AuthStatus, RedirectService, ScreenService, ServerService, User, UserService } from '@app/core' import { LanguageChooserComponent } from '@app/menu/language-chooser.component' -import { HotkeysService } from 'angular2-hotkeys' -import { ServerConfig, VideoConstant } from '@shared/models' import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component' import { I18n } from '@ngx-translate/i18n-polyfill' -import { ScreenService } from '@app/shared/misc/screen.service' +import { ServerConfig, UserRight, VideoConstant } from '@shared/models' @Component({ selector: 'my-menu', diff --git a/client/src/app/shared/confirm/confirm.component.html b/client/src/app/modal/confirm.component.html similarity index 100% rename from client/src/app/shared/confirm/confirm.component.html rename to client/src/app/modal/confirm.component.html diff --git a/client/src/app/shared/confirm/confirm.component.scss b/client/src/app/modal/confirm.component.scss similarity index 100% rename from client/src/app/shared/confirm/confirm.component.scss rename to client/src/app/modal/confirm.component.scss diff --git a/client/src/app/shared/confirm/confirm.component.ts b/client/src/app/modal/confirm.component.ts similarity index 92% rename from client/src/app/shared/confirm/confirm.component.ts rename to client/src/app/modal/confirm.component.ts index c6e40fe72..2c7ef46c4 100644 --- a/client/src/app/shared/confirm/confirm.component.ts +++ b/client/src/app/modal/confirm.component.ts @@ -1,9 +1,9 @@ -import { Component, ElementRef, HostListener, OnInit, ViewChild } from '@angular/core' +import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' import { ConfirmService } from '@app/core/confirm/confirm.service' -import { I18n } from '@ngx-translate/i18n-polyfill' +import { POP_STATE_MODAL_DISMISS } from '@app/helpers' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { POP_STATE_MODAL_DISMISS } from '@app/shared/misc/constants' +import { I18n } from '@ngx-translate/i18n-polyfill' @Component({ selector: 'my-confirm', diff --git a/client/src/app/modal/instance-config-warning-modal.component.ts b/client/src/app/modal/instance-config-warning-modal.component.ts index 5e1433548..1c90f190a 100644 --- a/client/src/app/modal/instance-config-warning-modal.component.ts +++ b/client/src/app/modal/instance-config-warning-modal.component.ts @@ -1,8 +1,7 @@ import { Component, ElementRef, ViewChild } from '@angular/core' -import { Notifier } from '@app/core' +import { Notifier, UserService } from '@app/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { About } from '@shared/models/server' -import { UserService } from '@app/shared' @Component({ selector: 'my-instance-config-warning-modal', diff --git a/client/src/app/modal/quick-settings-modal.component.html b/client/src/app/modal/quick-settings-modal.component.html index 188a51173..b95c14309 100644 --- a/client/src/app/modal/quick-settings-modal.component.html +++ b/client/src/app/modal/quick-settings-modal.component.html @@ -7,7 +7,7 @@ diff --git a/client/src/app/modal/quick-settings-modal.component.ts b/client/src/app/modal/quick-settings-modal.component.ts index 155794d1b..95726ab63 100644 --- a/client/src/app/modal/quick-settings-modal.component.ts +++ b/client/src/app/modal/quick-settings-modal.component.ts @@ -1,11 +1,10 @@ -import { Component, ViewChild, OnInit } from '@angular/core' -import { AuthService, AuthStatus } from '@app/core' -import { FormReactive, FormValidatorService, UserService, User } from '@app/shared' -import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' import { ReplaySubject } from 'rxjs' -import { LocalStorageService } from '@app/shared/misc/storage.service' import { filter } from 'rxjs/operators' +import { Component, OnInit, ViewChild } from '@angular/core' +import { AuthService, AuthStatus, LocalStorageService, User, UserService } from '@app/core' +import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' +import { NgbModal } from '@ng-bootstrap/ng-bootstrap' +import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' @Component({ selector: 'my-quick-settings', diff --git a/client/src/app/modal/welcome-modal.component.ts b/client/src/app/modal/welcome-modal.component.ts index e022776e3..c2f289600 100644 --- a/client/src/app/modal/welcome-modal.component.ts +++ b/client/src/app/modal/welcome-modal.component.ts @@ -1,7 +1,6 @@ import { Component, ElementRef, ViewChild } from '@angular/core' -import { Notifier } from '@app/core' +import { Notifier, UserService } from '@app/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { UserService } from '@app/shared' @Component({ selector: 'my-welcome-modal', diff --git a/client/src/app/reset-password/reset-password-routing.module.ts b/client/src/app/reset-password/reset-password-routing.module.ts index b41069568..d443b51d6 100644 --- a/client/src/app/reset-password/reset-password-routing.module.ts +++ b/client/src/app/reset-password/reset-password-routing.module.ts @@ -1,8 +1,6 @@ import { NgModule } from '@angular/core' import { RouterModule, Routes } from '@angular/router' - import { MetaGuard } from '@ngx-meta/core' - import { ResetPasswordComponent } from './reset-password.component' const resetPasswordRoutes: Routes = [ diff --git a/client/src/app/reset-password/reset-password.component.ts b/client/src/app/reset-password/reset-password.component.ts index 07b93ee73..8d50e9839 100644 --- a/client/src/app/reset-password/reset-password.component.ts +++ b/client/src/app/reset-password/reset-password.component.ts @@ -1,10 +1,8 @@ import { Component, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { UserService, UserValidatorsService, FormReactive } from '@app/shared' -import { Notifier } from '@app/core' +import { Notifier, UserService } from '@app/core' +import { FormReactive, FormValidatorService, ResetPasswordValidatorsService, UserValidatorsService } from '@app/shared/shared-forms' import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { ResetPasswordValidatorsService } from '@app/shared/forms/form-validators/reset-password-validators.service' @Component({ selector: 'my-login', diff --git a/client/src/app/reset-password/reset-password.module.ts b/client/src/app/reset-password/reset-password.module.ts index c2711981a..c77f1c4b0 100644 --- a/client/src/app/reset-password/reset-password.module.ts +++ b/client/src/app/reset-password/reset-password.module.ts @@ -1,13 +1,15 @@ import { NgModule } from '@angular/core' - +import { SharedFormModule } from '@app/shared/shared-forms' +import { SharedMainModule } from '@app/shared/shared-main' import { ResetPasswordRoutingModule } from './reset-password-routing.module' import { ResetPasswordComponent } from './reset-password.component' -import { SharedModule } from '../shared' @NgModule({ imports: [ ResetPasswordRoutingModule, - SharedModule + + SharedMainModule, + SharedFormModule ], declarations: [ diff --git a/client/src/app/search/advanced-search.model.ts b/client/src/app/search/advanced-search.model.ts index 643cc9a29..516854a8c 100644 --- a/client/src/app/search/advanced-search.model.ts +++ b/client/src/app/search/advanced-search.model.ts @@ -1,5 +1,4 @@ -import { SearchTargetType } from '@shared/models/search/search-target-query.model' -import { NSFWQuery } from '../../../../shared/models/search' +import { NSFWQuery, SearchTargetType } from '@shared/models' export class AdvancedSearch { startDate: string // ISO 8601 diff --git a/client/src/app/shared/angular/highlight.pipe.ts b/client/src/app/search/highlight.pipe.ts similarity index 100% rename from client/src/app/shared/angular/highlight.pipe.ts rename to client/src/app/search/highlight.pipe.ts diff --git a/client/src/app/search/search-filters.component.ts b/client/src/app/search/search-filters.component.ts index af76260a7..14a5d0484 100644 --- a/client/src/app/search/search-filters.component.ts +++ b/client/src/app/search/search-filters.component.ts @@ -1,10 +1,10 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' import { ValidatorFn } from '@angular/forms' -import { VideoValidatorsService } from '@app/shared' import { ServerService } from '@app/core' -import { I18n } from '@ngx-translate/i18n-polyfill' import { AdvancedSearch } from '@app/search/advanced-search.model' -import { ServerConfig, VideoConstant } from '../../../../shared' +import { VideoValidatorsService } from '@app/shared/shared-forms' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { ServerConfig, VideoConstant } from '@shared/models' @Component({ selector: 'my-search-filters', diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts index 6486085be..83b06e0ce 100644 --- a/client/src/app/search/search.component.ts +++ b/client/src/app/search/search.component.ts @@ -1,20 +1,15 @@ import { forkJoin, of, Subscription } from 'rxjs' import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { AuthService, Notifier, ServerService } from '@app/core' -import { HooksService } from '@app/core/plugins/hooks.service' -import { AdvancedSearch } from '@app/search/advanced-search.model' -import { SearchService } from '@app/search/search.service' -import { User, UserService } from '@app/shared' -import { immutableAssign } from '@app/shared/misc/utils' -import { ComponentPagination } from '@app/shared/rest/component-pagination.model' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' -import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.component' -import { Video } from '@app/shared/video/video.model' +import { AuthService, ComponentPagination, HooksService, Notifier, ServerService, User, UserService } from '@app/core' +import { immutableAssign } from '@app/helpers' +import { Video, VideoChannel } from '@app/shared/shared-main' +import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature' import { MetaService } from '@ngx-meta/core' import { I18n } from '@ngx-translate/i18n-polyfill' -import { ServerConfig } from '@shared/models' -import { SearchTargetType } from '@shared/models/search/search-target-query.model' +import { SearchTargetType, ServerConfig } from '@shared/models' +import { AdvancedSearch } from './advanced-search.model' +import { SearchService } from './search.service' @Component({ selector: 'my-search', diff --git a/client/src/app/search/search.module.ts b/client/src/app/search/search.module.ts index df5459802..65c954de8 100644 --- a/client/src/app/search/search.module.ts +++ b/client/src/app/search/search.module.ts @@ -1,11 +1,15 @@ import { TagInputModule } from 'ngx-chips' import { NgModule } from '@angular/core' -import { SearchFiltersComponent } from '@app/search/search-filters.component' -import { SearchRoutingModule } from '@app/search/search-routing.module' -import { SearchComponent } from '@app/search/search.component' -import { SearchService } from '@app/search/search.service' -import { SharedModule } from '../shared' +import { SharedFormModule } from '@app/shared/shared-forms' +import { SharedMainModule } from '@app/shared/shared-main' +import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription' +import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' import { ChannelLazyLoadResolver } from './channel-lazy-load.resolver' +import { HighlightPipe } from './highlight.pipe' +import { SearchFiltersComponent } from './search-filters.component' +import { SearchRoutingModule } from './search-routing.module' +import { SearchComponent } from './search.component' +import { SearchService } from './search.service' import { VideoLazyLoadResolver } from './video-lazy-load.resolver' @NgModule({ @@ -13,7 +17,10 @@ import { VideoLazyLoadResolver } from './video-lazy-load.resolver' TagInputModule, SearchRoutingModule, - SharedModule + SharedMainModule, + SharedFormModule, + SharedUserSubscriptionModule, + SharedVideoMiniatureModule ], declarations: [ @@ -29,7 +36,8 @@ import { VideoLazyLoadResolver } from './video-lazy-load.resolver' providers: [ SearchService, VideoLazyLoadResolver, - ChannelLazyLoadResolver + ChannelLazyLoadResolver, + HighlightPipe ] }) export class SearchModule { } diff --git a/client/src/app/search/search.service.ts b/client/src/app/search/search.service.ts index fdb12ea2c..36342034f 100644 --- a/client/src/app/search/search.service.ts +++ b/client/src/app/search/search.service.ts @@ -2,17 +2,13 @@ import { Observable } from 'rxjs' import { catchError, map, switchMap } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' +import { ComponentPaginationLight, RestExtractor, RestPagination, RestService } from '@app/core' +import { peertubeLocalStorage } from '@app/helpers' import { AdvancedSearch } from '@app/search/advanced-search.model' -import { RestExtractor, RestPagination, RestService } from '@app/shared' -import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' -import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { Video } from '@app/shared/video/video.model' -import { VideoService } from '@app/shared/video/video.service' -import { ResultList, Video as VideoServerModel, VideoChannel as VideoChannelServerModel } from '../../../../shared' -import { environment } from '../../environments/environment' +import { Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' +import { ResultList, Video as VideoServerModel, VideoChannel as VideoChannelServerModel } from '@shared/models' import { SearchTargetType } from '@shared/models/search/search-target-query.model' +import { environment } from '../../environments/environment' @Injectable() export class SearchService { diff --git a/client/src/app/shared/angular/object-length.pipe.ts b/client/src/app/shared/angular/object-length.pipe.ts deleted file mode 100644 index 84d182052..000000000 --- a/client/src/app/shared/angular/object-length.pipe.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core' - -@Pipe({ name: 'myObjectLength' }) -export class ObjectLengthPipe implements PipeTransform { - transform (value: Object) { - return Object.keys(value).length - } -} diff --git a/client/src/app/shared/blocklist/index.ts b/client/src/app/shared/blocklist/index.ts deleted file mode 100644 index 188057b19..000000000 --- a/client/src/app/shared/blocklist/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './blocklist.service' -export * from './account-block.model' -export * from './server-blocklist.component' -export * from './account-blocklist.component' diff --git a/client/src/app/shared/forms/index.ts b/client/src/app/shared/forms/index.ts deleted file mode 100644 index 8febbfee9..000000000 --- a/client/src/app/shared/forms/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './form-validators' -export * from './form-reactive' -export * from './reactive-file.component' -export * from './textarea-autoresize.directive' diff --git a/client/src/app/shared/index.ts b/client/src/app/shared/index.ts deleted file mode 100644 index 8be578d9f..000000000 --- a/client/src/app/shared/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './auth' -export * from './forms' -export * from './rest' -export * from './users' -export * from './video-abuse' -export * from './video-block' -export * from './shared.module' diff --git a/client/src/app/shared/moderation/index.ts b/client/src/app/shared/moderation/index.ts deleted file mode 100644 index 9a77c64c0..000000000 --- a/client/src/app/shared/moderation/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './user-ban-modal.component' -export * from './user-moderation-dropdown.component' diff --git a/client/src/app/shared/overview/index.ts b/client/src/app/shared/overview/index.ts deleted file mode 100644 index 2f7e41298..000000000 --- a/client/src/app/shared/overview/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './overview.service' diff --git a/client/src/app/shared/forms/form-reactive.ts b/client/src/app/shared/shared-forms/form-reactive.ts similarity index 96% rename from client/src/app/shared/forms/form-reactive.ts rename to client/src/app/shared/shared-forms/form-reactive.ts index 6aec2937d..caa31d831 100644 --- a/client/src/app/shared/forms/form-reactive.ts +++ b/client/src/app/shared/shared-forms/form-reactive.ts @@ -1,5 +1,5 @@ import { FormGroup } from '@angular/forms' -import { BuildFormArgument, BuildFormDefaultValues, FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' +import { BuildFormArgument, BuildFormDefaultValues, FormValidatorService } from './form-validators' export type FormReactiveErrors = { [ id: string ]: string | FormReactiveErrors } export type FormReactiveValidationMessages = { diff --git a/client/src/app/+admin/config/shared/batch-domains-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/batch-domains-validators.service.ts similarity index 91% rename from client/src/app/+admin/config/shared/batch-domains-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/batch-domains-validators.service.ts index 46fa6514d..f270b602b 100644 --- a/client/src/app/+admin/config/shared/batch-domains-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/batch-domains-validators.service.ts @@ -1,7 +1,8 @@ -import { I18n } from '@ngx-translate/i18n-polyfill' -import { Validators, ValidatorFn } from '@angular/forms' import { Injectable } from '@angular/core' -import { BuildFormValidator, validateHost } from '@app/shared/forms/form-validators' +import { ValidatorFn, Validators } from '@angular/forms' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { BuildFormValidator } from './form-validator.service' +import { validateHost } from './host' @Injectable() export class BatchDomainsValidatorsService { diff --git a/client/src/app/shared/forms/form-validators/custom-config-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/custom-config-validators.service.ts similarity index 98% rename from client/src/app/shared/forms/form-validators/custom-config-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/custom-config-validators.service.ts index fdb19e06a..c77aba6a1 100644 --- a/client/src/app/shared/forms/form-validators/custom-config-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/custom-config-validators.service.ts @@ -1,6 +1,6 @@ import { Validators } from '@angular/forms' import { I18n } from '@ngx-translate/i18n-polyfill' -import { BuildFormValidator } from '@app/shared' +import { BuildFormValidator } from './form-validator.service' import { Injectable } from '@angular/core' @Injectable() diff --git a/client/src/app/shared/forms/form-validators/form-validator.service.ts b/client/src/app/shared/shared-forms/form-validators/form-validator.service.ts similarity index 98% rename from client/src/app/shared/forms/form-validators/form-validator.service.ts rename to client/src/app/shared/shared-forms/form-validators/form-validator.service.ts index 249fdf119..dec7d8d9a 100644 --- a/client/src/app/shared/forms/form-validators/form-validator.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/form-validator.service.ts @@ -1,6 +1,6 @@ import { FormBuilder, FormControl, FormGroup, ValidatorFn } from '@angular/forms' import { Injectable } from '@angular/core' -import { FormReactiveErrors, FormReactiveValidationMessages } from '@app/shared/forms/form-reactive' +import { FormReactiveErrors, FormReactiveValidationMessages } from '../form-reactive' export type BuildFormValidator = { VALIDATORS: ValidatorFn[], diff --git a/client/src/app/shared/forms/form-validators/host.ts b/client/src/app/shared/shared-forms/form-validators/host.ts similarity index 100% rename from client/src/app/shared/forms/form-validators/host.ts rename to client/src/app/shared/shared-forms/form-validators/host.ts diff --git a/client/src/app/shared/forms/form-validators/index.ts b/client/src/app/shared/shared-forms/form-validators/index.ts similarity index 93% rename from client/src/app/shared/forms/form-validators/index.ts rename to client/src/app/shared/shared-forms/form-validators/index.ts index 4a01b1622..8b71841a9 100644 --- a/client/src/app/shared/forms/form-validators/index.ts +++ b/client/src/app/shared/shared-forms/form-validators/index.ts @@ -1,3 +1,4 @@ +export * from './batch-domains-validators.service' export * from './custom-config-validators.service' export * from './form-validator.service' export * from './host' @@ -6,11 +7,11 @@ export * from './login-validators.service' export * from './reset-password-validators.service' export * from './user-validators.service' export * from './video-abuse-validators.service' +export * from './video-accept-ownership-validators.service' export * from './video-block-validators.service' +export * from './video-captions-validators.service' +export * from './video-change-ownership-validators.service' export * from './video-channel-validators.service' export * from './video-comment-validators.service' -export * from './video-validators.service' export * from './video-playlist-validators.service' -export * from './video-captions-validators.service' -export * from './video-change-ownership-validators.service' -export * from './video-accept-ownership-validators.service' +export * from './video-validators.service' diff --git a/client/src/app/shared/forms/form-validators/instance-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/instance-validators.service.ts similarity index 96% rename from client/src/app/shared/forms/form-validators/instance-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/instance-validators.service.ts index cc5f3c5a1..96a35a48f 100644 --- a/client/src/app/shared/forms/form-validators/instance-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/instance-validators.service.ts @@ -1,6 +1,6 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { Validators } from '@angular/forms' -import { BuildFormValidator } from '@app/shared' +import { BuildFormValidator } from './form-validator.service' import { Injectable } from '@angular/core' @Injectable() diff --git a/client/src/app/shared/forms/form-validators/login-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/login-validators.service.ts similarity index 91% rename from client/src/app/shared/forms/form-validators/login-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/login-validators.service.ts index 9d68f830c..a5837357e 100644 --- a/client/src/app/shared/forms/form-validators/login-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/login-validators.service.ts @@ -1,7 +1,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { Validators } from '@angular/forms' import { Injectable } from '@angular/core' -import { BuildFormValidator } from '@app/shared' +import { BuildFormValidator } from './form-validator.service' @Injectable() export class LoginValidatorsService { diff --git a/client/src/app/shared/forms/form-validators/reset-password-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/reset-password-validators.service.ts similarity index 88% rename from client/src/app/shared/forms/form-validators/reset-password-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/reset-password-validators.service.ts index df206254d..d2085a309 100644 --- a/client/src/app/shared/forms/form-validators/reset-password-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/reset-password-validators.service.ts @@ -1,7 +1,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { Validators } from '@angular/forms' import { Injectable } from '@angular/core' -import { BuildFormValidator } from '@app/shared' +import { BuildFormValidator } from './form-validator.service' @Injectable() export class ResetPasswordValidatorsService { diff --git a/client/src/app/shared/forms/form-validators/user-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/user-validators.service.ts similarity index 98% rename from client/src/app/shared/forms/form-validators/user-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/user-validators.service.ts index 13b9228d4..bd3030a54 100644 --- a/client/src/app/shared/forms/form-validators/user-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/user-validators.service.ts @@ -1,6 +1,6 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { Validators } from '@angular/forms' -import { BuildFormValidator } from '@app/shared' +import { BuildFormValidator } from './form-validator.service' import { Injectable } from '@angular/core' @Injectable() diff --git a/client/src/app/shared/forms/form-validators/video-abuse-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/video-abuse-validators.service.ts similarity index 94% rename from client/src/app/shared/forms/form-validators/video-abuse-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/video-abuse-validators.service.ts index fcc966b84..aae56d607 100644 --- a/client/src/app/shared/forms/form-validators/video-abuse-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/video-abuse-validators.service.ts @@ -1,7 +1,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { Validators } from '@angular/forms' import { Injectable } from '@angular/core' -import { BuildFormValidator } from '@app/shared' +import { BuildFormValidator } from './form-validator.service' @Injectable() export class VideoAbuseValidatorsService { diff --git a/client/src/app/shared/forms/form-validators/video-accept-ownership-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/video-accept-ownership-validators.service.ts similarity index 87% rename from client/src/app/shared/forms/form-validators/video-accept-ownership-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/video-accept-ownership-validators.service.ts index 48c7054a4..998d616ec 100644 --- a/client/src/app/shared/forms/form-validators/video-accept-ownership-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/video-accept-ownership-validators.service.ts @@ -1,7 +1,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { Validators } from '@angular/forms' import { Injectable } from '@angular/core' -import { BuildFormValidator } from '@app/shared' +import { BuildFormValidator } from './form-validator.service' @Injectable() export class VideoAcceptOwnershipValidatorsService { diff --git a/client/src/app/shared/forms/form-validators/video-block-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/video-block-validators.service.ts similarity index 90% rename from client/src/app/shared/forms/form-validators/video-block-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/video-block-validators.service.ts index dc8257761..ddf0ab5eb 100644 --- a/client/src/app/shared/forms/form-validators/video-block-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/video-block-validators.service.ts @@ -1,7 +1,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { Validators } from '@angular/forms' import { Injectable } from '@angular/core' -import { BuildFormValidator } from '@app/shared' +import { BuildFormValidator } from './form-validator.service' @Injectable() export class VideoBlockValidatorsService { diff --git a/client/src/app/shared/forms/form-validators/video-captions-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/video-captions-validators.service.ts similarity index 91% rename from client/src/app/shared/forms/form-validators/video-captions-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/video-captions-validators.service.ts index d1b4667bb..280d28414 100644 --- a/client/src/app/shared/forms/form-validators/video-captions-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/video-captions-validators.service.ts @@ -1,7 +1,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { Validators } from '@angular/forms' import { Injectable } from '@angular/core' -import { BuildFormValidator } from '@app/shared' +import { BuildFormValidator } from './form-validator.service' @Injectable() export class VideoCaptionsValidatorsService { diff --git a/client/src/app/shared/forms/form-validators/video-change-ownership-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/video-change-ownership-validators.service.ts similarity index 92% rename from client/src/app/shared/forms/form-validators/video-change-ownership-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/video-change-ownership-validators.service.ts index c6fbb7538..59659defd 100644 --- a/client/src/app/shared/forms/form-validators/video-change-ownership-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/video-change-ownership-validators.service.ts @@ -1,7 +1,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { AbstractControl, ValidationErrors, Validators } from '@angular/forms' import { Injectable } from '@angular/core' -import { BuildFormValidator } from '@app/shared' +import { BuildFormValidator } from './form-validator.service' @Injectable() export class VideoChangeOwnershipValidatorsService { diff --git a/client/src/app/shared/forms/form-validators/video-channel-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/video-channel-validators.service.ts similarity index 97% rename from client/src/app/shared/forms/form-validators/video-channel-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/video-channel-validators.service.ts index 1c519c10a..bb650b149 100644 --- a/client/src/app/shared/forms/form-validators/video-channel-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/video-channel-validators.service.ts @@ -1,7 +1,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { Validators } from '@angular/forms' import { Injectable } from '@angular/core' -import { BuildFormValidator } from '@app/shared' +import { BuildFormValidator } from './form-validator.service' @Injectable() export class VideoChannelValidatorsService { diff --git a/client/src/app/shared/forms/form-validators/video-comment-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/video-comment-validators.service.ts similarity index 91% rename from client/src/app/shared/forms/form-validators/video-comment-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/video-comment-validators.service.ts index 45c7081ef..97c8e967e 100644 --- a/client/src/app/shared/forms/form-validators/video-comment-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/video-comment-validators.service.ts @@ -1,7 +1,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { Validators } from '@angular/forms' import { Injectable } from '@angular/core' -import { BuildFormValidator } from '@app/shared' +import { BuildFormValidator } from './form-validator.service' @Injectable() export class VideoCommentValidatorsService { diff --git a/client/src/app/shared/forms/form-validators/video-playlist-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/video-playlist-validators.service.ts similarity index 97% rename from client/src/app/shared/forms/form-validators/video-playlist-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/video-playlist-validators.service.ts index a2c9a5368..ab9c43625 100644 --- a/client/src/app/shared/forms/form-validators/video-playlist-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/video-playlist-validators.service.ts @@ -1,7 +1,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { AbstractControl, FormControl, Validators } from '@angular/forms' import { Injectable } from '@angular/core' -import { BuildFormValidator } from '@app/shared' +import { BuildFormValidator } from './form-validator.service' import { VideoPlaylistPrivacy } from '@shared/models' @Injectable() diff --git a/client/src/app/shared/forms/form-validators/video-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/video-validators.service.ts similarity index 97% rename from client/src/app/shared/forms/form-validators/video-validators.service.ts rename to client/src/app/shared/shared-forms/form-validators/video-validators.service.ts index e3f7a0969..9b24e4f62 100644 --- a/client/src/app/shared/forms/form-validators/video-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/video-validators.service.ts @@ -1,7 +1,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { Validators } from '@angular/forms' import { Injectable } from '@angular/core' -import { BuildFormValidator } from '@app/shared' +import { BuildFormValidator } from './form-validator.service' @Injectable() export class VideoValidatorsService { diff --git a/client/src/app/shared/shared-forms/index.ts b/client/src/app/shared/shared-forms/index.ts new file mode 100644 index 000000000..aa0ee015a --- /dev/null +++ b/client/src/app/shared/shared-forms/index.ts @@ -0,0 +1,10 @@ +export * from './form-validators' +export * from './form-reactive' +export * from './input-readonly-copy.component' +export * from './markdown-textarea.component' +export * from './peertube-checkbox.component' +export * from './preview-upload.component' +export * from './reactive-file.component' +export * from './textarea-autoresize.directive' +export * from './timestamp-input.component' +export * from './shared-form.module' diff --git a/client/src/app/shared/forms/input-readonly-copy.component.html b/client/src/app/shared/shared-forms/input-readonly-copy.component.html similarity index 100% rename from client/src/app/shared/forms/input-readonly-copy.component.html rename to client/src/app/shared/shared-forms/input-readonly-copy.component.html diff --git a/client/src/app/shared/forms/input-readonly-copy.component.scss b/client/src/app/shared/shared-forms/input-readonly-copy.component.scss similarity index 100% rename from client/src/app/shared/forms/input-readonly-copy.component.scss rename to client/src/app/shared/shared-forms/input-readonly-copy.component.scss diff --git a/client/src/app/shared/forms/input-readonly-copy.component.ts b/client/src/app/shared/shared-forms/input-readonly-copy.component.ts similarity index 100% rename from client/src/app/shared/forms/input-readonly-copy.component.ts rename to client/src/app/shared/shared-forms/input-readonly-copy.component.ts diff --git a/client/src/app/shared/forms/markdown-textarea.component.html b/client/src/app/shared/shared-forms/markdown-textarea.component.html similarity index 100% rename from client/src/app/shared/forms/markdown-textarea.component.html rename to client/src/app/shared/shared-forms/markdown-textarea.component.html diff --git a/client/src/app/shared/forms/markdown-textarea.component.scss b/client/src/app/shared/shared-forms/markdown-textarea.component.scss similarity index 100% rename from client/src/app/shared/forms/markdown-textarea.component.scss rename to client/src/app/shared/shared-forms/markdown-textarea.component.scss diff --git a/client/src/app/shared/forms/markdown-textarea.component.ts b/client/src/app/shared/shared-forms/markdown-textarea.component.ts similarity index 89% rename from client/src/app/shared/forms/markdown-textarea.component.ts rename to client/src/app/shared/shared-forms/markdown-textarea.component.ts index dde7b4d98..8dad5314c 100644 --- a/client/src/app/shared/forms/markdown-textarea.component.ts +++ b/client/src/app/shared/shared-forms/markdown-textarea.component.ts @@ -1,10 +1,9 @@ +import truncate from 'lodash-es/truncate' +import { Subject } from 'rxjs' import { debounceTime, distinctUntilChanged } from 'rxjs/operators' -import { Component, forwardRef, Input, OnInit, ViewChild, ElementRef } from '@angular/core' +import { Component, ElementRef, forwardRef, Input, OnInit, ViewChild } from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' -import { Subject } from 'rxjs' -import truncate from 'lodash-es/truncate' -import { ScreenService } from '@app/shared/misc/screen.service' -import { MarkdownService } from '@app/shared/renderer' +import { MarkdownService } from '@app/core' @Component({ selector: 'my-markdown-textarea', @@ -37,10 +36,7 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit { private contentChanged = new Subject() - constructor ( - private screenService: ScreenService, - private markdownService: MarkdownService -) {} + constructor (private markdownService: MarkdownService) {} ngOnInit () { this.contentChanged diff --git a/client/src/app/shared/forms/peertube-checkbox.component.html b/client/src/app/shared/shared-forms/peertube-checkbox.component.html similarity index 100% rename from client/src/app/shared/forms/peertube-checkbox.component.html rename to client/src/app/shared/shared-forms/peertube-checkbox.component.html diff --git a/client/src/app/shared/forms/peertube-checkbox.component.scss b/client/src/app/shared/shared-forms/peertube-checkbox.component.scss similarity index 100% rename from client/src/app/shared/forms/peertube-checkbox.component.scss rename to client/src/app/shared/shared-forms/peertube-checkbox.component.scss diff --git a/client/src/app/shared/forms/peertube-checkbox.component.ts b/client/src/app/shared/shared-forms/peertube-checkbox.component.ts similarity index 95% rename from client/src/app/shared/forms/peertube-checkbox.component.ts rename to client/src/app/shared/shared-forms/peertube-checkbox.component.ts index 89e79fecd..76ef77e5a 100644 --- a/client/src/app/shared/forms/peertube-checkbox.component.ts +++ b/client/src/app/shared/shared-forms/peertube-checkbox.component.ts @@ -1,6 +1,6 @@ import { AfterContentInit, ChangeDetectorRef, Component, ContentChildren, forwardRef, Input, QueryList, TemplateRef } from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' -import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template.directive' +import { PeerTubeTemplateDirective } from '@app/shared/shared-main' @Component({ selector: 'my-peertube-checkbox', diff --git a/client/src/app/shared/images/preview-upload.component.html b/client/src/app/shared/shared-forms/preview-upload.component.html similarity index 100% rename from client/src/app/shared/images/preview-upload.component.html rename to client/src/app/shared/shared-forms/preview-upload.component.html diff --git a/client/src/app/shared/images/preview-upload.component.scss b/client/src/app/shared/shared-forms/preview-upload.component.scss similarity index 100% rename from client/src/app/shared/images/preview-upload.component.scss rename to client/src/app/shared/shared-forms/preview-upload.component.scss diff --git a/client/src/app/shared/images/preview-upload.component.ts b/client/src/app/shared/shared-forms/preview-upload.component.ts similarity index 100% rename from client/src/app/shared/images/preview-upload.component.ts rename to client/src/app/shared/shared-forms/preview-upload.component.ts diff --git a/client/src/app/shared/forms/reactive-file.component.html b/client/src/app/shared/shared-forms/reactive-file.component.html similarity index 100% rename from client/src/app/shared/forms/reactive-file.component.html rename to client/src/app/shared/shared-forms/reactive-file.component.html diff --git a/client/src/app/shared/forms/reactive-file.component.scss b/client/src/app/shared/shared-forms/reactive-file.component.scss similarity index 100% rename from client/src/app/shared/forms/reactive-file.component.scss rename to client/src/app/shared/shared-forms/reactive-file.component.scss diff --git a/client/src/app/shared/forms/reactive-file.component.ts b/client/src/app/shared/shared-forms/reactive-file.component.ts similarity index 96% rename from client/src/app/shared/forms/reactive-file.component.ts rename to client/src/app/shared/shared-forms/reactive-file.component.ts index b7a821d4f..9ebf487ce 100644 --- a/client/src/app/shared/forms/reactive-file.component.ts +++ b/client/src/app/shared/shared-forms/reactive-file.component.ts @@ -1,8 +1,8 @@ import { Component, EventEmitter, forwardRef, Input, OnInit, Output } from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' import { Notifier } from '@app/core' +import { GlobalIconName } from '@app/shared/shared-icons' import { I18n } from '@ngx-translate/i18n-polyfill' -import { GlobalIconName } from '@app/shared/images/global-icon.component' @Component({ selector: 'my-reactive-file', diff --git a/client/src/app/shared/shared-forms/shared-form.module.ts b/client/src/app/shared/shared-forms/shared-form.module.ts new file mode 100644 index 000000000..e82fa97d4 --- /dev/null +++ b/client/src/app/shared/shared-forms/shared-form.module.ts @@ -0,0 +1,84 @@ + +import { NgModule } from '@angular/core' +import { FormsModule, ReactiveFormsModule } from '@angular/forms' +import { BatchDomainsValidatorsService } from '@app/shared/shared-forms/form-validators/batch-domains-validators.service' +import { SharedGlobalIconModule } from '../shared-icons' +import { SharedMainModule } from '../shared-main/shared-main.module' +import { + CustomConfigValidatorsService, + FormValidatorService, + InstanceValidatorsService, + LoginValidatorsService, + ResetPasswordValidatorsService, + UserValidatorsService, + VideoAbuseValidatorsService, + VideoAcceptOwnershipValidatorsService, + VideoBlockValidatorsService, + VideoCaptionsValidatorsService, + VideoChangeOwnershipValidatorsService, + VideoChannelValidatorsService, + VideoCommentValidatorsService, + VideoPlaylistValidatorsService, + VideoValidatorsService +} from './form-validators' +import { InputReadonlyCopyComponent } from './input-readonly-copy.component' +import { MarkdownTextareaComponent } from './markdown-textarea.component' +import { PeertubeCheckboxComponent } from './peertube-checkbox.component' +import { PreviewUploadComponent } from './preview-upload.component' +import { ReactiveFileComponent } from './reactive-file.component' +import { TextareaAutoResizeDirective } from './textarea-autoresize.directive' +import { TimestampInputComponent } from './timestamp-input.component' + +@NgModule({ + imports: [ + FormsModule, + ReactiveFormsModule, + + SharedMainModule, + SharedGlobalIconModule + ], + + declarations: [ + InputReadonlyCopyComponent, + MarkdownTextareaComponent, + PeertubeCheckboxComponent, + PreviewUploadComponent, + ReactiveFileComponent, + TextareaAutoResizeDirective, + TimestampInputComponent + ], + + exports: [ + FormsModule, + ReactiveFormsModule, + + InputReadonlyCopyComponent, + MarkdownTextareaComponent, + PeertubeCheckboxComponent, + PreviewUploadComponent, + ReactiveFileComponent, + TextareaAutoResizeDirective, + TimestampInputComponent + ], + + providers: [ + CustomConfigValidatorsService, + FormValidatorService, + LoginValidatorsService, + InstanceValidatorsService, + LoginValidatorsService, + ResetPasswordValidatorsService, + UserValidatorsService, + VideoAbuseValidatorsService, + VideoAcceptOwnershipValidatorsService, + VideoBlockValidatorsService, + VideoCaptionsValidatorsService, + VideoChangeOwnershipValidatorsService, + VideoChannelValidatorsService, + VideoCommentValidatorsService, + VideoPlaylistValidatorsService, + VideoValidatorsService, + BatchDomainsValidatorsService + ] +}) +export class SharedFormModule { } diff --git a/client/src/app/shared/forms/textarea-autoresize.directive.ts b/client/src/app/shared/shared-forms/textarea-autoresize.directive.ts similarity index 100% rename from client/src/app/shared/forms/textarea-autoresize.directive.ts rename to client/src/app/shared/shared-forms/textarea-autoresize.directive.ts diff --git a/client/src/app/shared/forms/timestamp-input.component.html b/client/src/app/shared/shared-forms/timestamp-input.component.html similarity index 100% rename from client/src/app/shared/forms/timestamp-input.component.html rename to client/src/app/shared/shared-forms/timestamp-input.component.html diff --git a/client/src/app/shared/forms/timestamp-input.component.scss b/client/src/app/shared/shared-forms/timestamp-input.component.scss similarity index 100% rename from client/src/app/shared/forms/timestamp-input.component.scss rename to client/src/app/shared/shared-forms/timestamp-input.component.scss diff --git a/client/src/app/shared/forms/timestamp-input.component.ts b/client/src/app/shared/shared-forms/timestamp-input.component.ts similarity index 100% rename from client/src/app/shared/forms/timestamp-input.component.ts rename to client/src/app/shared/shared-forms/timestamp-input.component.ts diff --git a/client/src/app/shared/images/global-icon.component.scss b/client/src/app/shared/shared-icons/global-icon.component.scss similarity index 100% rename from client/src/app/shared/images/global-icon.component.scss rename to client/src/app/shared/shared-icons/global-icon.component.scss diff --git a/client/src/app/shared/images/global-icon.component.ts b/client/src/app/shared/shared-icons/global-icon.component.ts similarity index 100% rename from client/src/app/shared/images/global-icon.component.ts rename to client/src/app/shared/shared-icons/global-icon.component.ts diff --git a/client/src/app/shared/shared-icons/index.ts b/client/src/app/shared/shared-icons/index.ts new file mode 100644 index 000000000..478e5c97d --- /dev/null +++ b/client/src/app/shared/shared-icons/index.ts @@ -0,0 +1,3 @@ +export * from './global-icon.component' + +export * from './shared-global-icon.module' diff --git a/client/src/app/shared/shared-icons/shared-global-icon.module.ts b/client/src/app/shared/shared-icons/shared-global-icon.module.ts new file mode 100644 index 000000000..b3020c78d --- /dev/null +++ b/client/src/app/shared/shared-icons/shared-global-icon.module.ts @@ -0,0 +1,21 @@ + +import { CommonModule } from '@angular/common' +import { NgModule } from '@angular/core' +import { GlobalIconComponent } from './global-icon.component' + +@NgModule({ + imports: [ + CommonModule + ], + + declarations: [ + GlobalIconComponent + ], + + exports: [ + GlobalIconComponent + ], + + providers: [ ] +}) +export class SharedGlobalIconModule { } diff --git a/client/src/app/shared/instance/feature-boolean.component.html b/client/src/app/shared/shared-instance/feature-boolean.component.html similarity index 100% rename from client/src/app/shared/instance/feature-boolean.component.html rename to client/src/app/shared/shared-instance/feature-boolean.component.html diff --git a/client/src/app/shared/instance/feature-boolean.component.scss b/client/src/app/shared/shared-instance/feature-boolean.component.scss similarity index 100% rename from client/src/app/shared/instance/feature-boolean.component.scss rename to client/src/app/shared/shared-instance/feature-boolean.component.scss diff --git a/client/src/app/shared/instance/feature-boolean.component.ts b/client/src/app/shared/shared-instance/feature-boolean.component.ts similarity index 100% rename from client/src/app/shared/instance/feature-boolean.component.ts rename to client/src/app/shared/shared-instance/feature-boolean.component.ts diff --git a/client/src/app/shared/shared-instance/index.ts b/client/src/app/shared/shared-instance/index.ts new file mode 100644 index 000000000..1aeed357e --- /dev/null +++ b/client/src/app/shared/shared-instance/index.ts @@ -0,0 +1,6 @@ +export * from './feature-boolean.component' +export * from './instance-features-table.component' +export * from './instance-follow.service' +export * from './instance-statistics.component' +export * from './instance.service' +export * from './shared-instance.module' diff --git a/client/src/app/shared/instance/instance-features-table.component.html b/client/src/app/shared/shared-instance/instance-features-table.component.html similarity index 100% rename from client/src/app/shared/instance/instance-features-table.component.html rename to client/src/app/shared/shared-instance/instance-features-table.component.html diff --git a/client/src/app/shared/instance/instance-features-table.component.scss b/client/src/app/shared/shared-instance/instance-features-table.component.scss similarity index 100% rename from client/src/app/shared/instance/instance-features-table.component.scss rename to client/src/app/shared/shared-instance/instance-features-table.component.scss diff --git a/client/src/app/shared/instance/instance-features-table.component.ts b/client/src/app/shared/shared-instance/instance-features-table.component.ts similarity index 100% rename from client/src/app/shared/instance/instance-features-table.component.ts rename to client/src/app/shared/shared-instance/instance-features-table.component.ts diff --git a/client/src/app/shared/instance/follow.service.ts b/client/src/app/shared/shared-instance/instance-follow.service.ts similarity index 79% rename from client/src/app/shared/instance/follow.service.ts rename to client/src/app/shared/shared-instance/instance-follow.service.ts index ef4c09583..3c9ccc40f 100644 --- a/client/src/app/shared/instance/follow.service.ts +++ b/client/src/app/shared/shared-instance/instance-follow.service.ts @@ -1,14 +1,14 @@ +import { SortMeta } from 'primeng/api' +import { Observable } from 'rxjs' import { catchError, map } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' -import { Observable } from 'rxjs' +import { RestExtractor, RestPagination, RestService } from '@app/core' import { ActivityPubActorType, ActorFollow, FollowState, ResultList } from '@shared/index' import { environment } from '../../../environments/environment' -import { RestExtractor, RestPagination, RestService } from '../rest' -import { SortMeta } from 'primeng/api' @Injectable() -export class FollowService { +export class InstanceFollowService { private static BASE_APPLICATION_URL = environment.apiUrl + '/api/v1/server' constructor ( @@ -34,7 +34,7 @@ export class FollowService { if (state) params = params.append('state', state) if (actorType) params = params.append('actorType', actorType) - return this.authHttp.get>(FollowService.BASE_APPLICATION_URL + '/following', { params }) + return this.authHttp.get>(InstanceFollowService.BASE_APPLICATION_URL + '/following', { params }) .pipe( map(res => this.restExtractor.convertResultListDateToHuman(res)), catchError(res => this.restExtractor.handleError(res)) @@ -57,7 +57,7 @@ export class FollowService { if (state) params = params.append('state', state) if (actorType) params = params.append('actorType', actorType) - return this.authHttp.get>(FollowService.BASE_APPLICATION_URL + '/followers', { params }) + return this.authHttp.get>(InstanceFollowService.BASE_APPLICATION_URL + '/followers', { params }) .pipe( map(res => this.restExtractor.convertResultListDateToHuman(res)), catchError(res => this.restExtractor.handleError(res)) @@ -69,7 +69,7 @@ export class FollowService { hosts: notEmptyHosts } - return this.authHttp.post(FollowService.BASE_APPLICATION_URL + '/following', body) + return this.authHttp.post(InstanceFollowService.BASE_APPLICATION_URL + '/following', body) .pipe( map(this.restExtractor.extractDataBool), catchError(res => this.restExtractor.handleError(res)) @@ -77,7 +77,7 @@ export class FollowService { } unfollow (follow: ActorFollow) { - return this.authHttp.delete(FollowService.BASE_APPLICATION_URL + '/following/' + follow.following.host) + return this.authHttp.delete(InstanceFollowService.BASE_APPLICATION_URL + '/following/' + follow.following.host) .pipe( map(this.restExtractor.extractDataBool), catchError(res => this.restExtractor.handleError(res)) @@ -87,7 +87,7 @@ export class FollowService { acceptFollower (follow: ActorFollow) { const handle = follow.follower.name + '@' + follow.follower.host - return this.authHttp.post(`${FollowService.BASE_APPLICATION_URL}/followers/${handle}/accept`, {}) + return this.authHttp.post(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}/accept`, {}) .pipe( map(this.restExtractor.extractDataBool), catchError(res => this.restExtractor.handleError(res)) @@ -97,7 +97,7 @@ export class FollowService { rejectFollower (follow: ActorFollow) { const handle = follow.follower.name + '@' + follow.follower.host - return this.authHttp.post(`${FollowService.BASE_APPLICATION_URL}/followers/${handle}/reject`, {}) + return this.authHttp.post(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}/reject`, {}) .pipe( map(this.restExtractor.extractDataBool), catchError(res => this.restExtractor.handleError(res)) @@ -107,7 +107,7 @@ export class FollowService { removeFollower (follow: ActorFollow) { const handle = follow.follower.name + '@' + follow.follower.host - return this.authHttp.delete(`${FollowService.BASE_APPLICATION_URL}/followers/${handle}`) + return this.authHttp.delete(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}`) .pipe( map(this.restExtractor.extractDataBool), catchError(res => this.restExtractor.handleError(res)) diff --git a/client/src/app/shared/instance/instance-statistics.component.html b/client/src/app/shared/shared-instance/instance-statistics.component.html similarity index 100% rename from client/src/app/shared/instance/instance-statistics.component.html rename to client/src/app/shared/shared-instance/instance-statistics.component.html diff --git a/client/src/app/shared/instance/instance-statistics.component.scss b/client/src/app/shared/shared-instance/instance-statistics.component.scss similarity index 100% rename from client/src/app/shared/instance/instance-statistics.component.scss rename to client/src/app/shared/shared-instance/instance-statistics.component.scss diff --git a/client/src/app/shared/instance/instance-statistics.component.ts b/client/src/app/shared/shared-instance/instance-statistics.component.ts similarity index 100% rename from client/src/app/shared/instance/instance-statistics.component.ts rename to client/src/app/shared/shared-instance/instance-statistics.component.ts diff --git a/client/src/app/shared/instance/instance.service.ts b/client/src/app/shared/shared-instance/instance.service.ts similarity index 89% rename from client/src/app/shared/instance/instance.service.ts rename to client/src/app/shared/shared-instance/instance.service.ts index 8b26063fb..ba9797bb5 100644 --- a/client/src/app/shared/instance/instance.service.ts +++ b/client/src/app/shared/shared-instance/instance.service.ts @@ -1,13 +1,10 @@ +import { forkJoin } from 'rxjs' import { catchError, map } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' +import { MarkdownService, RestExtractor, ServerService } from '@app/core' +import { About, peertubeTranslate } from '@shared/models' import { environment } from '../../../environments/environment' -import { RestExtractor, RestService } from '../rest' -import { About } from '../../../../../shared/models/server' -import { MarkdownService } from '@app/shared/renderer' -import { peertubeTranslate } from '@shared/models' -import { ServerService } from '@app/core' -import { forkJoin } from 'rxjs' @Injectable() export class InstanceService { @@ -16,7 +13,6 @@ export class InstanceService { constructor ( private authHttp: HttpClient, - private restService: RestService, private restExtractor: RestExtractor, private markdownService: MarkdownService, private serverService: ServerService diff --git a/client/src/app/shared/shared-instance/shared-instance.module.ts b/client/src/app/shared/shared-instance/shared-instance.module.ts new file mode 100644 index 000000000..b75ad1a12 --- /dev/null +++ b/client/src/app/shared/shared-instance/shared-instance.module.ts @@ -0,0 +1,32 @@ + +import { NgModule } from '@angular/core' +import { SharedMainModule } from '../shared-main/shared-main.module' +import { FeatureBooleanComponent } from './feature-boolean.component' +import { InstanceFeaturesTableComponent } from './instance-features-table.component' +import { InstanceFollowService } from './instance-follow.service' +import { InstanceStatisticsComponent } from './instance-statistics.component' +import { InstanceService } from './instance.service' + +@NgModule({ + imports: [ + SharedMainModule + ], + + declarations: [ + FeatureBooleanComponent, + InstanceFeaturesTableComponent, + InstanceStatisticsComponent + ], + + exports: [ + FeatureBooleanComponent, + InstanceFeaturesTableComponent, + InstanceStatisticsComponent + ], + + providers: [ + InstanceFollowService, + InstanceService + ] +}) +export class SharedInstanceModule { } diff --git a/client/src/app/shared/account/account.model.ts b/client/src/app/shared/shared-main/account/account.model.ts similarity index 84% rename from client/src/app/shared/account/account.model.ts rename to client/src/app/shared/shared-main/account/account.model.ts index 61f09fc06..6df2e9d10 100644 --- a/client/src/app/shared/account/account.model.ts +++ b/client/src/app/shared/shared-main/account/account.model.ts @@ -1,5 +1,5 @@ -import { Account as ServerAccount } from '../../../../../shared/models/actors/account.model' -import { Actor } from '../actor/actor.model' +import { Account as ServerAccount } from '@shared/models/actors/account.model' +import { Actor } from './actor.model' export class Account extends Actor implements ServerAccount { displayName: string diff --git a/client/src/app/shared/account/account.service.ts b/client/src/app/shared/shared-main/account/account.service.ts similarity index 69% rename from client/src/app/shared/account/account.service.ts rename to client/src/app/shared/shared-main/account/account.service.ts index 6b261cf53..8f4abf070 100644 --- a/client/src/app/shared/account/account.service.ts +++ b/client/src/app/shared/shared-main/account/account.service.ts @@ -1,11 +1,11 @@ -import { map, tap, catchError } from 'rxjs/operators' -import { Injectable } from '@angular/core' -import { environment } from '../../../environments/environment' import { Observable, ReplaySubject } from 'rxjs' -import { Account } from '@app/shared/account/account.model' -import { RestExtractor } from '@app/shared/rest/rest-extractor.service' +import { catchError, map, tap } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' -import { Account as ServerAccount } from '../../../../../shared/models/actors/account.model' +import { Injectable } from '@angular/core' +import { RestExtractor } from '@app/core' +import { Account as ServerAccount } from '@shared/models' +import { environment } from '../../../../environments/environment' +import { Account } from './account.model' @Injectable() export class AccountService { diff --git a/client/src/app/+my-account/shared/actor-avatar-info.component.html b/client/src/app/shared/shared-main/account/actor-avatar-info.component.html similarity index 100% rename from client/src/app/+my-account/shared/actor-avatar-info.component.html rename to client/src/app/shared/shared-main/account/actor-avatar-info.component.html diff --git a/client/src/app/+my-account/shared/actor-avatar-info.component.scss b/client/src/app/shared/shared-main/account/actor-avatar-info.component.scss similarity index 100% rename from client/src/app/+my-account/shared/actor-avatar-info.component.scss rename to client/src/app/shared/shared-main/account/actor-avatar-info.component.scss diff --git a/client/src/app/+my-account/shared/actor-avatar-info.component.ts b/client/src/app/shared/shared-main/account/actor-avatar-info.component.ts similarity index 88% rename from client/src/app/+my-account/shared/actor-avatar-info.component.ts rename to client/src/app/shared/shared-main/account/actor-avatar-info.component.ts index 8e4a7a602..0c04ae4a6 100644 --- a/client/src/app/+my-account/shared/actor-avatar-info.component.ts +++ b/client/src/app/shared/shared-main/account/actor-avatar-info.component.ts @@ -1,11 +1,9 @@ -import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' -import { ServerService } from '../../core/server' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' -import { Account } from '@app/shared/account/account.model' -import { Notifier } from '@app/core' -import { ServerConfig } from '@shared/models' import { BytesPipe } from 'ngx-pipes' +import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' +import { Notifier, ServerService } from '@app/core' +import { Account, VideoChannel } from '@app/shared/shared-main' import { I18n } from '@ngx-translate/i18n-polyfill' +import { ServerConfig } from '@shared/models' @Component({ selector: 'my-actor-avatar-info', diff --git a/client/src/app/shared/actor/actor.model.ts b/client/src/app/shared/shared-main/account/actor.model.ts similarity index 87% rename from client/src/app/shared/actor/actor.model.ts rename to client/src/app/shared/shared-main/account/actor.model.ts index a78303a2f..5fc7989dd 100644 --- a/client/src/app/shared/actor/actor.model.ts +++ b/client/src/app/shared/shared-main/account/actor.model.ts @@ -1,6 +1,5 @@ -import { Actor as ActorServer } from '../../../../../shared/models/actors/actor.model' -import { Avatar } from '../../../../../shared/models/avatars/avatar.model' -import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' +import { Actor as ActorServer, Avatar } from '@shared/models' +import { getAbsoluteAPIUrl } from '@app/helpers' export abstract class Actor implements ActorServer { id: number diff --git a/client/src/app/shared/channel/avatar.component.html b/client/src/app/shared/shared-main/account/avatar.component.html similarity index 100% rename from client/src/app/shared/channel/avatar.component.html rename to client/src/app/shared/shared-main/account/avatar.component.html diff --git a/client/src/app/shared/channel/avatar.component.scss b/client/src/app/shared/shared-main/account/avatar.component.scss similarity index 100% rename from client/src/app/shared/channel/avatar.component.scss rename to client/src/app/shared/shared-main/account/avatar.component.scss diff --git a/client/src/app/shared/channel/avatar.component.ts b/client/src/app/shared/shared-main/account/avatar.component.ts similarity index 100% rename from client/src/app/shared/channel/avatar.component.ts rename to client/src/app/shared/shared-main/account/avatar.component.ts diff --git a/client/src/app/shared/shared-main/account/index.ts b/client/src/app/shared/shared-main/account/index.ts new file mode 100644 index 000000000..f5b9f3634 --- /dev/null +++ b/client/src/app/shared/shared-main/account/index.ts @@ -0,0 +1,5 @@ +export * from './account.model' +export * from './account.service' +export * from './actor-avatar-info.component' +export * from './actor.model' +export * from './avatar.component' diff --git a/client/src/app/shared/angular/from-now.pipe.ts b/client/src/app/shared/shared-main/angular/from-now.pipe.ts similarity index 100% rename from client/src/app/shared/angular/from-now.pipe.ts rename to client/src/app/shared/shared-main/angular/from-now.pipe.ts diff --git a/client/src/app/shared/shared-main/angular/index.ts b/client/src/app/shared/shared-main/angular/index.ts new file mode 100644 index 000000000..3b072fb84 --- /dev/null +++ b/client/src/app/shared/shared-main/angular/index.ts @@ -0,0 +1,4 @@ +export * from './from-now.pipe' +export * from './infinite-scroller.directive' +export * from './number-formatter.pipe' +export * from './peertube-template.directive' diff --git a/client/src/app/shared/video/infinite-scroller.directive.ts b/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts similarity index 100% rename from client/src/app/shared/video/infinite-scroller.directive.ts rename to client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts diff --git a/client/src/app/shared/angular/number-formatter.pipe.ts b/client/src/app/shared/shared-main/angular/number-formatter.pipe.ts similarity index 100% rename from client/src/app/shared/angular/number-formatter.pipe.ts rename to client/src/app/shared/shared-main/angular/number-formatter.pipe.ts diff --git a/client/src/app/shared/angular/peertube-template.directive.ts b/client/src/app/shared/shared-main/angular/peertube-template.directive.ts similarity index 100% rename from client/src/app/shared/angular/peertube-template.directive.ts rename to client/src/app/shared/shared-main/angular/peertube-template.directive.ts diff --git a/client/src/app/shared/auth/auth-interceptor.service.ts b/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts similarity index 97% rename from client/src/app/shared/auth/auth-interceptor.service.ts rename to client/src/app/shared/shared-main/auth/auth-interceptor.service.ts index bb236bf8c..68a4acdb5 100644 --- a/client/src/app/shared/auth/auth-interceptor.service.ts +++ b/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts @@ -1,8 +1,8 @@ import { Observable, throwError as observableThrowError } from 'rxjs' import { catchError, switchMap } from 'rxjs/operators' -import { Injectable, Injector } from '@angular/core' import { HTTP_INTERCEPTORS, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http' -import { AuthService } from '../../core' +import { Injectable, Injector } from '@angular/core' +import { AuthService } from '@app/core/auth/auth.service' @Injectable() export class AuthInterceptor implements HttpInterceptor { diff --git a/client/src/app/shared/auth/index.ts b/client/src/app/shared/shared-main/auth/index.ts similarity index 100% rename from client/src/app/shared/auth/index.ts rename to client/src/app/shared/shared-main/auth/index.ts diff --git a/client/src/app/shared/buttons/action-dropdown.component.html b/client/src/app/shared/shared-main/buttons/action-dropdown.component.html similarity index 100% rename from client/src/app/shared/buttons/action-dropdown.component.html rename to client/src/app/shared/shared-main/buttons/action-dropdown.component.html diff --git a/client/src/app/shared/buttons/action-dropdown.component.scss b/client/src/app/shared/shared-main/buttons/action-dropdown.component.scss similarity index 100% rename from client/src/app/shared/buttons/action-dropdown.component.scss rename to client/src/app/shared/shared-main/buttons/action-dropdown.component.scss diff --git a/client/src/app/shared/buttons/action-dropdown.component.ts b/client/src/app/shared/shared-main/buttons/action-dropdown.component.ts similarity index 95% rename from client/src/app/shared/buttons/action-dropdown.component.ts rename to client/src/app/shared/shared-main/buttons/action-dropdown.component.ts index 15f9556dc..36d7d6229 100644 --- a/client/src/app/shared/buttons/action-dropdown.component.ts +++ b/client/src/app/shared/shared-main/buttons/action-dropdown.component.ts @@ -1,5 +1,5 @@ import { Component, Input } from '@angular/core' -import { GlobalIconName } from '@app/shared/images/global-icon.component' +import { GlobalIconName } from '@app/shared/shared-icons' export type DropdownAction = { label?: string diff --git a/client/src/app/shared/buttons/button.component.html b/client/src/app/shared/shared-main/buttons/button.component.html similarity index 100% rename from client/src/app/shared/buttons/button.component.html rename to client/src/app/shared/shared-main/buttons/button.component.html diff --git a/client/src/app/shared/buttons/button.component.scss b/client/src/app/shared/shared-main/buttons/button.component.scss similarity index 100% rename from client/src/app/shared/buttons/button.component.scss rename to client/src/app/shared/shared-main/buttons/button.component.scss diff --git a/client/src/app/shared/buttons/button.component.ts b/client/src/app/shared/shared-main/buttons/button.component.ts similarity index 85% rename from client/src/app/shared/buttons/button.component.ts rename to client/src/app/shared/shared-main/buttons/button.component.ts index cac5ad210..e23b90945 100644 --- a/client/src/app/shared/buttons/button.component.ts +++ b/client/src/app/shared/shared-main/buttons/button.component.ts @@ -1,5 +1,5 @@ import { Component, Input } from '@angular/core' -import { GlobalIconName } from '@app/shared/images/global-icon.component' +import { GlobalIconName } from '@app/shared/shared-icons' @Component({ selector: 'my-button', diff --git a/client/src/app/shared/buttons/delete-button.component.html b/client/src/app/shared/shared-main/buttons/delete-button.component.html similarity index 100% rename from client/src/app/shared/buttons/delete-button.component.html rename to client/src/app/shared/shared-main/buttons/delete-button.component.html diff --git a/client/src/app/shared/buttons/delete-button.component.ts b/client/src/app/shared/shared-main/buttons/delete-button.component.ts similarity index 100% rename from client/src/app/shared/buttons/delete-button.component.ts rename to client/src/app/shared/shared-main/buttons/delete-button.component.ts diff --git a/client/src/app/shared/buttons/edit-button.component.html b/client/src/app/shared/shared-main/buttons/edit-button.component.html similarity index 100% rename from client/src/app/shared/buttons/edit-button.component.html rename to client/src/app/shared/shared-main/buttons/edit-button.component.html diff --git a/client/src/app/shared/buttons/edit-button.component.ts b/client/src/app/shared/shared-main/buttons/edit-button.component.ts similarity index 100% rename from client/src/app/shared/buttons/edit-button.component.ts rename to client/src/app/shared/shared-main/buttons/edit-button.component.ts diff --git a/client/src/app/shared/shared-main/buttons/index.ts b/client/src/app/shared/shared-main/buttons/index.ts new file mode 100644 index 000000000..775a47a39 --- /dev/null +++ b/client/src/app/shared/shared-main/buttons/index.ts @@ -0,0 +1,4 @@ +export * from './action-dropdown.component' +export * from './button.component' +export * from './delete-button.component' +export * from './edit-button.component' diff --git a/client/src/app/shared/date/date-toggle.component.html b/client/src/app/shared/shared-main/date/date-toggle.component.html similarity index 100% rename from client/src/app/shared/date/date-toggle.component.html rename to client/src/app/shared/shared-main/date/date-toggle.component.html diff --git a/client/src/app/shared/date/date-toggle.component.scss b/client/src/app/shared/shared-main/date/date-toggle.component.scss similarity index 100% rename from client/src/app/shared/date/date-toggle.component.scss rename to client/src/app/shared/shared-main/date/date-toggle.component.scss diff --git a/client/src/app/shared/date/date-toggle.component.ts b/client/src/app/shared/shared-main/date/date-toggle.component.ts similarity index 85% rename from client/src/app/shared/date/date-toggle.component.ts rename to client/src/app/shared/shared-main/date/date-toggle.component.ts index fa48da8e8..bedf0ba4e 100644 --- a/client/src/app/shared/date/date-toggle.component.ts +++ b/client/src/app/shared/shared-main/date/date-toggle.component.ts @@ -1,12 +1,11 @@ -import { Component, Input, OnInit, OnChanges } from '@angular/core' import { DatePipe } from '@angular/common' +import { Component, Input, OnChanges, OnInit } from '@angular/core' import { FromNowPipe } from '../angular/from-now.pipe' @Component({ selector: 'my-date-toggle', templateUrl: './date-toggle.component.html', - styleUrls: [ './date-toggle.component.scss' ], - providers: [ DatePipe, FromNowPipe ] + styleUrls: [ './date-toggle.component.scss' ] }) export class DateToggleComponent implements OnInit, OnChanges { @Input() date: Date diff --git a/client/src/app/shared/shared-main/date/index.ts b/client/src/app/shared/shared-main/date/index.ts new file mode 100644 index 000000000..db00aef52 --- /dev/null +++ b/client/src/app/shared/shared-main/date/index.ts @@ -0,0 +1 @@ +export * from './date-toggle.component' diff --git a/client/src/app/shared/video/feed.component.html b/client/src/app/shared/shared-main/feeds/feed.component.html similarity index 100% rename from client/src/app/shared/video/feed.component.html rename to client/src/app/shared/shared-main/feeds/feed.component.html diff --git a/client/src/app/shared/video/feed.component.scss b/client/src/app/shared/shared-main/feeds/feed.component.scss similarity index 100% rename from client/src/app/shared/video/feed.component.scss rename to client/src/app/shared/shared-main/feeds/feed.component.scss diff --git a/client/src/app/shared/video/feed.component.ts b/client/src/app/shared/shared-main/feeds/feed.component.ts similarity index 78% rename from client/src/app/shared/video/feed.component.ts rename to client/src/app/shared/shared-main/feeds/feed.component.ts index 12507458f..ee3731c1d 100644 --- a/client/src/app/shared/video/feed.component.ts +++ b/client/src/app/shared/shared-main/feeds/feed.component.ts @@ -1,5 +1,5 @@ import { Component, Input } from '@angular/core' -import { Syndication } from '@app/shared/video/syndication.model' +import { Syndication } from './syndication.model' @Component({ selector: 'my-feed', diff --git a/client/src/app/shared/shared-main/feeds/index.ts b/client/src/app/shared/shared-main/feeds/index.ts new file mode 100644 index 000000000..6bc396699 --- /dev/null +++ b/client/src/app/shared/shared-main/feeds/index.ts @@ -0,0 +1,2 @@ +export * from './feed.component' +export * from './syndication.model' diff --git a/client/src/app/shared/video/syndication.model.ts b/client/src/app/shared/shared-main/feeds/syndication.model.ts similarity index 51% rename from client/src/app/shared/video/syndication.model.ts rename to client/src/app/shared/shared-main/feeds/syndication.model.ts index c59ab01e8..2466ae7c6 100644 --- a/client/src/app/shared/video/syndication.model.ts +++ b/client/src/app/shared/shared-main/feeds/syndication.model.ts @@ -1,4 +1,4 @@ -import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' +import { FeedFormat } from '@shared/models' export interface Syndication { format: FeedFormat, diff --git a/client/src/app/shared/shared-main/index.ts b/client/src/app/shared/shared-main/index.ts new file mode 100644 index 000000000..a4d813c06 --- /dev/null +++ b/client/src/app/shared/shared-main/index.ts @@ -0,0 +1,12 @@ +export * from './account' +export * from './angular' +export * from './buttons' +export * from './date' +export * from './feeds' +export * from './loaders' +export * from './misc' +export * from './users' +export * from './video' +export * from './video-caption' +export * from './video-channel' +export * from './shared-main.module' diff --git a/client/src/app/shared/shared-main/loaders/index.ts b/client/src/app/shared/shared-main/loaders/index.ts new file mode 100644 index 000000000..a061914d5 --- /dev/null +++ b/client/src/app/shared/shared-main/loaders/index.ts @@ -0,0 +1,2 @@ +export * from './loader.component' +export * from './small-loader.component' diff --git a/client/src/app/shared/misc/loader.component.html b/client/src/app/shared/shared-main/loaders/loader.component.html similarity index 100% rename from client/src/app/shared/misc/loader.component.html rename to client/src/app/shared/shared-main/loaders/loader.component.html diff --git a/client/src/app/shared/misc/loader.component.scss b/client/src/app/shared/shared-main/loaders/loader.component.scss similarity index 100% rename from client/src/app/shared/misc/loader.component.scss rename to client/src/app/shared/shared-main/loaders/loader.component.scss diff --git a/client/src/app/shared/misc/loader.component.ts b/client/src/app/shared/shared-main/loaders/loader.component.ts similarity index 100% rename from client/src/app/shared/misc/loader.component.ts rename to client/src/app/shared/shared-main/loaders/loader.component.ts diff --git a/client/src/app/shared/misc/small-loader.component.html b/client/src/app/shared/shared-main/loaders/small-loader.component.html similarity index 100% rename from client/src/app/shared/misc/small-loader.component.html rename to client/src/app/shared/shared-main/loaders/small-loader.component.html diff --git a/client/src/app/shared/misc/small-loader.component.ts b/client/src/app/shared/shared-main/loaders/small-loader.component.ts similarity index 100% rename from client/src/app/shared/misc/small-loader.component.ts rename to client/src/app/shared/shared-main/loaders/small-loader.component.ts diff --git a/client/src/app/shared/misc/help.component.html b/client/src/app/shared/shared-main/misc/help.component.html similarity index 100% rename from client/src/app/shared/misc/help.component.html rename to client/src/app/shared/shared-main/misc/help.component.html diff --git a/client/src/app/shared/misc/help.component.scss b/client/src/app/shared/shared-main/misc/help.component.scss similarity index 100% rename from client/src/app/shared/misc/help.component.scss rename to client/src/app/shared/shared-main/misc/help.component.scss diff --git a/client/src/app/shared/misc/help.component.ts b/client/src/app/shared/shared-main/misc/help.component.ts similarity index 94% rename from client/src/app/shared/misc/help.component.ts rename to client/src/app/shared/shared-main/misc/help.component.ts index e8c199e7d..0825b96de 100644 --- a/client/src/app/shared/misc/help.component.ts +++ b/client/src/app/shared/shared-main/misc/help.component.ts @@ -1,7 +1,7 @@ import { AfterContentInit, Component, ContentChildren, Input, OnChanges, OnInit, QueryList, TemplateRef } from '@angular/core' +import { MarkdownService } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' -import { MarkdownService } from '@app/shared/renderer' -import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template.directive' +import { PeerTubeTemplateDirective } from '../angular' @Component({ selector: 'my-help', diff --git a/client/src/app/shared/shared-main/misc/index.ts b/client/src/app/shared/shared-main/misc/index.ts new file mode 100644 index 000000000..d3e7e4be7 --- /dev/null +++ b/client/src/app/shared/shared-main/misc/index.ts @@ -0,0 +1,2 @@ +export * from './help.component' +export * from './list-overflow.component' diff --git a/client/src/app/shared/misc/list-overflow.component.html b/client/src/app/shared/shared-main/misc/list-overflow.component.html similarity index 100% rename from client/src/app/shared/misc/list-overflow.component.html rename to client/src/app/shared/shared-main/misc/list-overflow.component.html diff --git a/client/src/app/shared/misc/list-overflow.component.scss b/client/src/app/shared/shared-main/misc/list-overflow.component.scss similarity index 100% rename from client/src/app/shared/misc/list-overflow.component.scss rename to client/src/app/shared/shared-main/misc/list-overflow.component.scss diff --git a/client/src/app/shared/misc/list-overflow.component.ts b/client/src/app/shared/shared-main/misc/list-overflow.component.ts similarity index 98% rename from client/src/app/shared/misc/list-overflow.component.ts rename to client/src/app/shared/shared-main/misc/list-overflow.component.ts index 30f43ba43..144e0f156 100644 --- a/client/src/app/shared/misc/list-overflow.component.ts +++ b/client/src/app/shared/shared-main/misc/list-overflow.component.ts @@ -1,3 +1,5 @@ +import { lowerFirst, uniqueId } from 'lodash-es' +import { take } from 'rxjs/operators' import { AfterViewInit, ChangeDetectionStrategy, @@ -11,10 +13,8 @@ import { ViewChild, ViewChildren } from '@angular/core' +import { ScreenService } from '@app/core' import { NgbDropdown, NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { lowerFirst, uniqueId } from 'lodash-es' -import { ScreenService } from './screen.service' -import { take } from 'rxjs/operators' export interface ListOverflowItem { label: string diff --git a/client/src/app/shared/shared-main/shared-main.module.ts b/client/src/app/shared/shared-main/shared-main.module.ts new file mode 100644 index 000000000..fd96a42a0 --- /dev/null +++ b/client/src/app/shared/shared-main/shared-main.module.ts @@ -0,0 +1,164 @@ +import { BytesPipe, KeysPipe, NgPipesModule } from 'ngx-pipes' +import { SharedModule as PrimeSharedModule } from 'primeng/api' +import { InputMaskModule } from 'primeng/inputmask' +import { InputSwitchModule } from 'primeng/inputswitch' +import { MultiSelectModule } from 'primeng/multiselect' +import { ClipboardModule } from '@angular/cdk/clipboard' +import { CommonModule, DatePipe } from '@angular/common' +import { HttpClientModule } from '@angular/common/http' +import { NgModule } from '@angular/core' +import { FormsModule, ReactiveFormsModule } from '@angular/forms' +import { RouterModule } from '@angular/router' +import { + NgbCollapseModule, + NgbDropdownModule, + NgbModalModule, + NgbNavModule, + NgbPopoverModule, + NgbTooltipModule +} from '@ng-bootstrap/ng-bootstrap' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { SharedGlobalIconModule } from '../shared-icons' +import { AccountService, ActorAvatarInfoComponent, AvatarComponent } from './account' +import { FromNowPipe, InfiniteScrollerDirective, NumberFormatterPipe, PeerTubeTemplateDirective } from './angular' +import { ActionDropdownComponent, ButtonComponent, DeleteButtonComponent, EditButtonComponent } from './buttons' +import { DateToggleComponent } from './date' +import { FeedComponent } from './feeds' +import { LoaderComponent, SmallLoaderComponent } from './loaders' +import { HelpComponent, ListOverflowComponent } from './misc' +import { UserHistoryService, UserNotificationsComponent, UserNotificationService } from './users' +import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video' +import { VideoCaptionService } from './video-caption' +import { VideoChannelService } from './video-channel' +import { AUTH_INTERCEPTOR_PROVIDER } from './auth' + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + ReactiveFormsModule, + RouterModule, + HttpClientModule, + + NgbDropdownModule, + NgbModalModule, + NgbPopoverModule, + NgbNavModule, + NgbTooltipModule, + NgbCollapseModule, + + ClipboardModule, + + PrimeSharedModule, + InputMaskModule, + NgPipesModule, + MultiSelectModule, + InputSwitchModule, + + SharedGlobalIconModule + ], + + declarations: [ + AvatarComponent, + ActorAvatarInfoComponent, + + FromNowPipe, + InfiniteScrollerDirective, + NumberFormatterPipe, + PeerTubeTemplateDirective, + + ActionDropdownComponent, + ButtonComponent, + DeleteButtonComponent, + EditButtonComponent, + + DateToggleComponent, + + FeedComponent, + + LoaderComponent, + SmallLoaderComponent, + + HelpComponent, + ListOverflowComponent, + + UserNotificationsComponent, + + FeedComponent + ], + + exports: [ + CommonModule, + FormsModule, + ReactiveFormsModule, + RouterModule, + HttpClientModule, + + NgbDropdownModule, + NgbModalModule, + NgbPopoverModule, + NgbNavModule, + NgbTooltipModule, + NgbCollapseModule, + + ClipboardModule, + + PrimeSharedModule, + InputMaskModule, + BytesPipe, + KeysPipe, + MultiSelectModule, + + AvatarComponent, + ActorAvatarInfoComponent, + + FromNowPipe, + InfiniteScrollerDirective, + NumberFormatterPipe, + PeerTubeTemplateDirective, + + ActionDropdownComponent, + ButtonComponent, + DeleteButtonComponent, + EditButtonComponent, + + DateToggleComponent, + + FeedComponent, + + LoaderComponent, + SmallLoaderComponent, + + HelpComponent, + ListOverflowComponent, + + UserNotificationsComponent, + + FeedComponent + ], + + providers: [ + I18n, + + DatePipe, + + FromNowPipe, + + AUTH_INTERCEPTOR_PROVIDER, + + AccountService, + + UserHistoryService, + UserNotificationService, + + RedundancyService, + VideoImportService, + VideoOwnershipService, + VideoService, + + VideoCaptionService, + + VideoChannelService + ] +}) +export class SharedMainModule { } diff --git a/client/src/app/shared/shared-main/users/index.ts b/client/src/app/shared/shared-main/users/index.ts new file mode 100644 index 000000000..83401ab52 --- /dev/null +++ b/client/src/app/shared/shared-main/users/index.ts @@ -0,0 +1,4 @@ +export * from './user-history.service' +export * from './user-notification.model' +export * from './user-notification.service' +export * from './user-notifications.component' diff --git a/client/src/app/shared/users/user-history.service.ts b/client/src/app/shared/shared-main/users/user-history.service.ts similarity index 79% rename from client/src/app/shared/users/user-history.service.ts rename to client/src/app/shared/shared-main/users/user-history.service.ts index b358cdf20..43970dc5b 100644 --- a/client/src/app/shared/users/user-history.service.ts +++ b/client/src/app/shared/shared-main/users/user-history.service.ts @@ -1,13 +1,11 @@ +import { catchError, map, switchMap } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' -import { environment } from '../../../environments/environment' -import { RestExtractor } from '../rest/rest-extractor.service' -import { RestService } from '../rest/rest.service' +import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' +import { ResultList } from '@shared/models' +import { environment } from '../../../../environments/environment' import { Video } from '../video/video.model' -import { catchError, map, switchMap } from 'rxjs/operators' -import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model' -import { VideoService } from '@app/shared/video/video.service' -import { ResultList } from '../../../../../shared' +import { VideoService } from '../video/video.service' @Injectable() export class UserHistoryService { diff --git a/client/src/app/shared/users/user-notification.model.ts b/client/src/app/shared/shared-main/users/user-notification.model.ts similarity index 96% rename from client/src/app/shared/users/user-notification.model.ts rename to client/src/app/shared/shared-main/users/user-notification.model.ts index 7b8368d87..de25d3ab9 100644 --- a/client/src/app/shared/users/user-notification.model.ts +++ b/client/src/app/shared/shared-main/users/user-notification.model.ts @@ -1,5 +1,5 @@ -import { ActorInfo, FollowState, UserNotification as UserNotificationServer, UserNotificationType, VideoInfo, Avatar } from '../../../../../shared' -import { Actor } from '@app/shared/actor/actor.model' +import { Actor } from '../account/actor.model' +import { ActorInfo, Avatar, FollowState, UserNotification as UserNotificationServer, UserNotificationType, VideoInfo } from '@shared/models' export class UserNotification implements UserNotificationServer { id: number diff --git a/client/src/app/shared/users/user-notification.service.ts b/client/src/app/shared/shared-main/users/user-notification.service.ts similarity index 87% rename from client/src/app/shared/users/user-notification.service.ts rename to client/src/app/shared/shared-main/users/user-notification.service.ts index e525a1d58..8dd9472fe 100644 --- a/client/src/app/shared/users/user-notification.service.ts +++ b/client/src/app/shared/shared-main/users/user-notification.service.ts @@ -1,14 +1,10 @@ -import { Injectable } from '@angular/core' -import { HttpClient, HttpParams } from '@angular/common/http' -import { RestExtractor, RestService } from '../rest' import { catchError, map, tap } from 'rxjs/operators' -import { environment } from '../../../environments/environment' -import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '../../../../../shared' +import { HttpClient, HttpParams } from '@angular/common/http' +import { Injectable } from '@angular/core' +import { ComponentPaginationLight, RestExtractor, RestService, User, UserNotificationSocket } from '@app/core' +import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '@shared/models' +import { environment } from '../../../../environments/environment' import { UserNotification } from './user-notification.model' -import { AuthService } from '../../core' -import { ComponentPaginationLight } from '../rest/component-pagination.model' -import { User } from '../users/user.model' -import { UserNotificationSocket } from '@app/core/notification/user-notification-socket.service' @Injectable() export class UserNotificationService { @@ -16,7 +12,6 @@ export class UserNotificationService { static BASE_NOTIFICATION_SETTINGS = environment.apiUrl + '/api/v1/users/me/notification-settings' constructor ( - private auth: AuthService, private authHttp: HttpClient, private restExtractor: RestExtractor, private restService: RestService, diff --git a/client/src/app/shared/users/user-notifications.component.html b/client/src/app/shared/shared-main/users/user-notifications.component.html similarity index 100% rename from client/src/app/shared/users/user-notifications.component.html rename to client/src/app/shared/shared-main/users/user-notifications.component.html diff --git a/client/src/app/shared/users/user-notifications.component.scss b/client/src/app/shared/shared-main/users/user-notifications.component.scss similarity index 100% rename from client/src/app/shared/users/user-notifications.component.scss rename to client/src/app/shared/shared-main/users/user-notifications.component.scss diff --git a/client/src/app/shared/users/user-notifications.component.ts b/client/src/app/shared/shared-main/users/user-notifications.component.ts similarity index 87% rename from client/src/app/shared/users/user-notifications.component.ts rename to client/src/app/shared/shared-main/users/user-notifications.component.ts index 977dd8925..6abd8b7d8 100644 --- a/client/src/app/shared/users/user-notifications.component.ts +++ b/client/src/app/shared/shared-main/users/user-notifications.component.ts @@ -1,10 +1,9 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' -import { UserNotificationService } from '@app/shared/users/user-notification.service' -import { UserNotificationType } from '../../../../../shared' -import { ComponentPagination, hasMoreItems } from '@app/shared/rest/component-pagination.model' -import { Notifier } from '@app/core' -import { UserNotification } from '@app/shared/users/user-notification.model' import { Subject } from 'rxjs' +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' +import { ComponentPagination, hasMoreItems, Notifier } from '@app/core' +import { UserNotificationType } from '@shared/models' +import { UserNotification } from './user-notification.model' +import { UserNotificationService } from './user-notification.service' @Component({ selector: 'my-user-notifications', diff --git a/client/src/app/shared/shared-main/video-caption/index.ts b/client/src/app/shared/shared-main/video-caption/index.ts new file mode 100644 index 000000000..308200f27 --- /dev/null +++ b/client/src/app/shared/shared-main/video-caption/index.ts @@ -0,0 +1,2 @@ +export * from './video-caption-edit.model' +export * from './video-caption.service' diff --git a/client/src/app/shared/video-caption/video-caption-edit.model.ts b/client/src/app/shared/shared-main/video-caption/video-caption-edit.model.ts similarity index 100% rename from client/src/app/shared/video-caption/video-caption-edit.model.ts rename to client/src/app/shared/shared-main/video-caption/video-caption-edit.model.ts diff --git a/client/src/app/shared/video-caption/video-caption.service.ts b/client/src/app/shared/shared-main/video-caption/video-caption.service.ts similarity index 85% rename from client/src/app/shared/video-caption/video-caption.service.ts rename to client/src/app/shared/shared-main/video-caption/video-caption.service.ts index 6bfe67435..d45fb837a 100644 --- a/client/src/app/shared/video-caption/video-caption.service.ts +++ b/client/src/app/shared/shared-main/video-caption/video-caption.service.ts @@ -1,14 +1,12 @@ +import { Observable, of } from 'rxjs' import { catchError, map, switchMap } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' -import { Observable, of } from 'rxjs' -import { peertubeTranslate, ResultList } from '../../../../../shared' -import { RestExtractor } from '../rest' -import { VideoService } from '@app/shared/video/video.service' -import { objectToFormData, sortBy } from '@app/shared/misc/utils' -import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' -import { VideoCaption } from '../../../../../shared/models/videos/caption/video-caption.model' -import { ServerService } from '@app/core' +import { RestExtractor, ServerService } from '@app/core' +import { objectToFormData, sortBy } from '@app/helpers' +import { VideoService } from '@app/shared/shared-main/video' +import { peertubeTranslate, ResultList, VideoCaption } from '@shared/models' +import { VideoCaptionEdit } from './video-caption-edit.model' @Injectable() export class VideoCaptionService { diff --git a/client/src/app/shared/shared-main/video-channel/index.ts b/client/src/app/shared/shared-main/video-channel/index.ts new file mode 100644 index 000000000..1fcf6d3be --- /dev/null +++ b/client/src/app/shared/shared-main/video-channel/index.ts @@ -0,0 +1,2 @@ +export * from './video-channel.model' +export * from './video-channel.service' diff --git a/client/src/app/shared/video-channel/video-channel.model.ts b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts similarity index 84% rename from client/src/app/shared/video-channel/video-channel.model.ts rename to client/src/app/shared/shared-main/video-channel/video-channel.model.ts index 2f4597343..123389afb 100644 --- a/client/src/app/shared/video-channel/video-channel.model.ts +++ b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts @@ -1,6 +1,5 @@ -import { VideoChannel as ServerVideoChannel, ViewsPerDate } from '../../../../../shared/models/videos' -import { Actor } from '../actor/actor.model' -import { Account } from '../../../../../shared/models/actors' +import { VideoChannel as ServerVideoChannel, ViewsPerDate, Account } from '@shared/models' +import { Actor } from '../account/actor.model' export class VideoChannel extends Actor implements ServerVideoChannel { displayName: string diff --git a/client/src/app/shared/video-channel/video-channel.service.ts b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts similarity index 86% rename from client/src/app/shared/video-channel/video-channel.service.ts rename to client/src/app/shared/shared-main/video-channel/video-channel.service.ts index 0e036bda7..5483e305f 100644 --- a/client/src/app/shared/video-channel/video-channel.service.ts +++ b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts @@ -1,17 +1,13 @@ -import { catchError, map, tap } from 'rxjs/operators' -import { Injectable } from '@angular/core' import { Observable, ReplaySubject } from 'rxjs' -import { RestExtractor } from '../rest/rest-extractor.service' +import { catchError, map, tap } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' -import { VideoChannel as VideoChannelServer, VideoChannelCreate, VideoChannelUpdate } from '../../../../../shared/models/videos' +import { Injectable } from '@angular/core' +import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' +import { Avatar, ResultList, VideoChannel as VideoChannelServer, VideoChannelCreate, VideoChannelUpdate } from '@shared/models' +import { environment } from '../../../../environments/environment' +import { Account } from '../account' import { AccountService } from '../account/account.service' -import { ResultList } from '../../../../../shared' import { VideoChannel } from './video-channel.model' -import { environment } from '../../../environments/environment' -import { Account } from '@app/shared/account/account.model' -import { Avatar } from '../../../../../shared/models/avatars/avatar.model' -import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model' -import { RestService } from '@app/shared/rest' @Injectable() export class VideoChannelService { diff --git a/client/src/app/shared/shared-main/video/index.ts b/client/src/app/shared/shared-main/video/index.ts new file mode 100644 index 000000000..3053df4ef --- /dev/null +++ b/client/src/app/shared/shared-main/video/index.ts @@ -0,0 +1,7 @@ +export * from './redundancy.service' +export * from './video-details.model' +export * from './video-edit.model' +export * from './video-import.service' +export * from './video-ownership.service' +export * from './video.model' +export * from './video.service' diff --git a/client/src/app/shared/video/redundancy.service.ts b/client/src/app/shared/shared-main/video/redundancy.service.ts similarity index 97% rename from client/src/app/shared/video/redundancy.service.ts rename to client/src/app/shared/shared-main/video/redundancy.service.ts index fb918d73b..6e839e655 100644 --- a/client/src/app/shared/video/redundancy.service.ts +++ b/client/src/app/shared/shared-main/video/redundancy.service.ts @@ -1,11 +1,11 @@ +import { SortMeta } from 'primeng/api' +import { concat, Observable } from 'rxjs' import { catchError, map, toArray } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' -import { RestExtractor, RestPagination, RestService } from '@app/shared/rest' -import { SortMeta } from 'primeng/api' +import { RestExtractor, RestPagination, RestService } from '@app/core' import { ResultList, Video, VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' -import { concat, Observable } from 'rxjs' -import { environment } from '../../../environments/environment' +import { environment } from '../../../../environments/environment' @Injectable() export class RedundancyService { diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/shared-main/video/video-details.model.ts similarity index 73% rename from client/src/app/shared/video/video-details.model.ts rename to client/src/app/shared/shared-main/video/video-details.model.ts index 14347a109..a1cb051e9 100644 --- a/client/src/app/shared/video/video-details.model.ts +++ b/client/src/app/shared/shared-main/video/video-details.model.ts @@ -1,9 +1,14 @@ -import { VideoConstant, VideoDetails as VideoDetailsServerModel, VideoFile, VideoState } from '../../../../../shared' -import { Video } from '../../shared/video/video.model' -import { Account } from '@app/shared/account/account.model' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' -import { VideoStreamingPlaylist } from '../../../../../shared/models/videos/video-streaming-playlist.model' -import { VideoStreamingPlaylistType } from '../../../../../shared/models/videos/video-streaming-playlist.type' +import { Account } from '@app/shared/shared-main/account/account.model' +import { VideoChannel } from '@app/shared/shared-main/video-channel/video-channel.model' +import { + VideoConstant, + VideoDetails as VideoDetailsServerModel, + VideoFile, + VideoState, + VideoStreamingPlaylist, + VideoStreamingPlaylistType +} from '@shared/models' +import { Video } from './video.model' export class VideoDetails extends Video implements VideoDetailsServerModel { descriptionPath: string diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/shared-main/video/video-edit.model.ts similarity index 91% rename from client/src/app/shared/video/video-edit.model.ts rename to client/src/app/shared/shared-main/video/video-edit.model.ts index 67d8e7711..6a529e052 100644 --- a/client/src/app/shared/video/video-edit.model.ts +++ b/client/src/app/shared/shared-main/video/video-edit.model.ts @@ -1,7 +1,4 @@ -import { VideoPrivacy } from '../../../../../shared/models/videos/video-privacy.enum' -import { VideoUpdate } from '../../../../../shared/models/videos' -import { VideoScheduleUpdate } from '../../../../../shared/models/videos/video-schedule-update.model' -import { Video } from '../../../../../shared/models/videos/video.model' +import { Video, VideoPrivacy, VideoScheduleUpdate, VideoUpdate } from '@shared/models' export class VideoEdit implements VideoUpdate { static readonly SPECIAL_SCHEDULED_PRIVACY = -1 diff --git a/client/src/app/shared/video-import/video-import.service.ts b/client/src/app/shared/shared-main/video/video-import.service.ts similarity index 85% rename from client/src/app/shared/video-import/video-import.service.ts rename to client/src/app/shared/shared-main/video/video-import.service.ts index afd9e3fb5..a700abacb 100644 --- a/client/src/app/shared/video-import/video-import.service.ts +++ b/client/src/app/shared/shared-main/video/video-import.service.ts @@ -1,17 +1,12 @@ +import { SortMeta } from 'primeng/api' +import { Observable } from 'rxjs' import { catchError, map, switchMap } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' -import { Observable } from 'rxjs' -import { peertubeTranslate, VideoImport } from '../../../../../shared' -import { environment } from '../../../environments/environment' -import { RestExtractor, RestService } from '../rest' -import { VideoImportCreate, VideoUpdate } from '../../../../../shared/models/videos' -import { objectToFormData } from '@app/shared/misc/utils' -import { ResultList } from '../../../../../shared/models/result-list.model' -import { UserService } from '@app/shared/users/user.service' -import { SortMeta } from 'primeng/api' -import { RestPagination } from '@app/shared/rest' -import { ServerService } from '@app/core' +import { RestExtractor, RestPagination, RestService, ServerService, UserService } from '@app/core' +import { objectToFormData } from '@app/helpers' +import { peertubeTranslate, ResultList, VideoImport, VideoImportCreate, VideoUpdate } from '@shared/models' +import { environment } from '../../../../environments/environment' @Injectable() export class VideoImportService { diff --git a/client/src/app/shared/video-ownership/video-ownership.service.ts b/client/src/app/shared/shared-main/video/video-ownership.service.ts similarity index 81% rename from client/src/app/shared/video-ownership/video-ownership.service.ts rename to client/src/app/shared/shared-main/video/video-ownership.service.ts index b95d5b792..273930a6c 100644 --- a/client/src/app/shared/video-ownership/video-ownership.service.ts +++ b/client/src/app/shared/shared-main/video/video-ownership.service.ts @@ -1,14 +1,11 @@ +import { SortMeta } from 'primeng/api' +import { Observable } from 'rxjs' import { catchError, map } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' -import { environment } from '../../../environments/environment' -import { RestExtractor, RestService } from '../rest' -import { VideoChangeOwnershipCreate } from '../../../../../shared/models/videos' -import { Observable } from 'rxjs/index' -import { SortMeta } from 'primeng/api' -import { ResultList, VideoChangeOwnership } from '../../../../../shared' -import { RestPagination } from '@app/shared/rest' -import { VideoChangeOwnershipAccept } from '../../../../../shared/models/videos/video-change-ownership-accept.model' +import { RestExtractor, RestPagination, RestService } from '@app/core' +import { ResultList, VideoChangeOwnership, VideoChangeOwnershipAccept, VideoChangeOwnershipCreate } from '@shared/models' +import { environment } from '../../../../environments/environment' @Injectable() export class VideoOwnershipService { diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts similarity index 88% rename from client/src/app/shared/video/video.model.ts rename to client/src/app/shared/shared-main/video/video.model.ts index dc5f45626..3e6d6a38d 100644 --- a/client/src/app/shared/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts @@ -1,13 +1,19 @@ -import { User } from '../' -import { UserRight, Video as VideoServerModel, VideoPrivacy, VideoState } from '../../../../../shared' -import { Avatar } from '../../../../../shared/models/avatars/avatar.model' -import { VideoConstant } from '../../../../../shared/models/videos/video-constant.model' -import { durationToString, getAbsoluteAPIUrl } from '../misc/utils' -import { peertubeTranslate, ServerConfig } from '../../../../../shared/models' -import { Actor } from '@app/shared/actor/actor.model' -import { VideoScheduleUpdate } from '../../../../../shared/models/videos/video-schedule-update.model' import { AuthUser } from '@app/core' -import { environment } from '../../../environments/environment' +import { User } from '@app/core/users/user.model' +import { durationToString, getAbsoluteAPIUrl } from '@app/helpers' +import { + Avatar, + peertubeTranslate, + ServerConfig, + UserRight, + Video as VideoServerModel, + VideoConstant, + VideoPrivacy, + VideoScheduleUpdate, + VideoState +} from '@shared/models' +import { environment } from '../../../../environments/environment' +import { Actor } from '../account/actor.model' export class Video implements VideoServerModel { byVideoChannel: string diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts similarity index 84% rename from client/src/app/shared/video/video.service.ts rename to client/src/app/shared/shared-main/video/video.service.ts index d66a1f809..20d13fa10 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts @@ -1,38 +1,32 @@ +import { FfprobeData } from 'fluent-ffmpeg' +import { Observable } from 'rxjs' import { catchError, map, switchMap } from 'rxjs/operators' import { HttpClient, HttpParams, HttpRequest } from '@angular/common/http' import { Injectable } from '@angular/core' -import { Observable } from 'rxjs' -import { Video as VideoServerModel, VideoDetails as VideoDetailsServerModel } from '../../../../../shared' -import { ResultList } from '../../../../../shared/models/result-list.model' +import { ComponentPaginationLight, RestExtractor, RestService, ServerService, UserService } from '@app/core' +import { objectToFormData } from '@app/helpers' +import { I18n } from '@ngx-translate/i18n-polyfill' import { + FeedFormat, + NSFWPolicyType, + ResultList, UserVideoRate, UserVideoRateType, UserVideoRateUpdate, + Video as VideoServerModel, VideoConstant, + VideoDetails as VideoDetailsServerModel, VideoFilter, VideoPrivacy, + VideoSortField, VideoUpdate -} from '../../../../../shared/models/videos' -import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' -import { environment } from '../../../environments/environment' -import { ComponentPaginationLight } from '../rest/component-pagination.model' -import { RestExtractor } from '../rest/rest-extractor.service' -import { RestService } from '../rest/rest.service' -import { UserService } from '../users/user.service' -import { VideoSortField } from './sort-field.type' +} from '@shared/models' +import { environment } from '../../../../environments/environment' +import { Account, AccountService } from '../account' +import { VideoChannel, VideoChannelService } from '../video-channel' import { VideoDetails } from './video-details.model' import { VideoEdit } from './video-edit.model' import { Video } from './video.model' -import { objectToFormData } from '@app/shared/misc/utils' -import { Account } from '@app/shared/account/account.model' -import { AccountService } from '@app/shared/account/account.service' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { ServerService, AuthService } from '@app/core' -import { UserSubscriptionService } from '@app/shared/user-subscription/user-subscription.service' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type' -import { FfprobeData } from 'fluent-ffmpeg' export interface VideosProvider { getVideos (parameters: { @@ -52,8 +46,6 @@ export class VideoService implements VideosProvider { constructor ( private authHttp: HttpClient, - private authService: AuthService, - private userService: UserService, private restExtractor: RestExtractor, private restService: RestService, private serverService: ServerService, @@ -182,27 +174,6 @@ export class VideoService implements VideosProvider { ) } - getUserSubscriptionVideos (parameters: { - videoPagination: ComponentPaginationLight, - sort: VideoSortField, - skipCount?: boolean - }): Observable> { - const { videoPagination, sort, skipCount } = parameters - const pagination = this.restService.componentPaginationToRestPagination(videoPagination) - - let params = new HttpParams() - params = this.restService.addRestGetParams(params, pagination, sort) - - if (skipCount) params = params.set('skipCount', skipCount + '') - - return this.authHttp - .get>(UserSubscriptionService.BASE_USER_SUBSCRIPTIONS_URL + '/videos', { params }) - .pipe( - switchMap(res => this.extractVideos(res)), - catchError(err => this.restExtractor.handleError(err)) - ) - } - getVideos (parameters: { videoPagination: ComponentPaginationLight, sort: VideoSortField, diff --git a/client/src/app/shared/blocklist/account-block.model.ts b/client/src/app/shared/shared-moderation/account-block.model.ts similarity index 72% rename from client/src/app/shared/blocklist/account-block.model.ts rename to client/src/app/shared/shared-moderation/account-block.model.ts index e7b433d88..8f76c69dc 100644 --- a/client/src/app/shared/blocklist/account-block.model.ts +++ b/client/src/app/shared/shared-moderation/account-block.model.ts @@ -1,5 +1,5 @@ -import { AccountBlock as AccountBlockServer } from '../../../../../shared' -import { Account } from '../account/account.model' +import { AccountBlock as AccountBlockServer } from '@shared/models' +import { Account } from '@app/shared/shared-main' export class AccountBlock implements AccountBlockServer { byAccount: Account diff --git a/client/src/app/shared/blocklist/account-blocklist.component.html b/client/src/app/shared/shared-moderation/account-blocklist.component.html similarity index 100% rename from client/src/app/shared/blocklist/account-blocklist.component.html rename to client/src/app/shared/shared-moderation/account-blocklist.component.html diff --git a/client/src/app/shared/blocklist/account-blocklist.component.scss b/client/src/app/shared/shared-moderation/account-blocklist.component.scss similarity index 100% rename from client/src/app/shared/blocklist/account-blocklist.component.scss rename to client/src/app/shared/shared-moderation/account-blocklist.component.scss diff --git a/client/src/app/shared/blocklist/account-blocklist.component.ts b/client/src/app/shared/shared-moderation/account-blocklist.component.ts similarity index 91% rename from client/src/app/shared/blocklist/account-blocklist.component.ts rename to client/src/app/shared/shared-moderation/account-blocklist.component.ts index dc5ac4044..38e0d0424 100644 --- a/client/src/app/shared/blocklist/account-blocklist.component.ts +++ b/client/src/app/shared/shared-moderation/account-blocklist.component.ts @@ -1,11 +1,10 @@ +import { SortMeta } from 'primeng/api' import { OnInit } from '@angular/core' -import { Notifier } from '@app/core' +import { Notifier, RestPagination, RestTable } from '@app/core' +import { Actor } from '@app/shared/shared-main' import { I18n } from '@ngx-translate/i18n-polyfill' -import { RestPagination, RestTable } from '@app/shared/rest' -import { SortMeta } from 'primeng/api' import { AccountBlock } from './account-block.model' -import { BlocklistService, BlocklistComponentType } from './blocklist.service' -import { Actor } from '@app/shared/actor/actor.model' +import { BlocklistComponentType, BlocklistService } from './blocklist.service' export class GenericAccountBlocklistComponent extends RestTable implements OnInit { // @ts-ignore: "Abstract methods can only appear within an abstract class" diff --git a/client/src/app/+admin/config/shared/batch-domains-modal.component.html b/client/src/app/shared/shared-moderation/batch-domains-modal.component.html similarity index 100% rename from client/src/app/+admin/config/shared/batch-domains-modal.component.html rename to client/src/app/shared/shared-moderation/batch-domains-modal.component.html diff --git a/client/src/app/+admin/config/shared/batch-domains-modal.component.scss b/client/src/app/shared/shared-moderation/batch-domains-modal.component.scss similarity index 100% rename from client/src/app/+admin/config/shared/batch-domains-modal.component.scss rename to client/src/app/shared/shared-moderation/batch-domains-modal.component.scss diff --git a/client/src/app/+admin/config/shared/batch-domains-modal.component.ts b/client/src/app/shared/shared-moderation/batch-domains-modal.component.ts similarity index 81% rename from client/src/app/+admin/config/shared/batch-domains-modal.component.ts rename to client/src/app/shared/shared-moderation/batch-domains-modal.component.ts index 620f2726b..fdd4a79a9 100644 --- a/client/src/app/+admin/config/shared/batch-domains-modal.component.ts +++ b/client/src/app/shared/shared-moderation/batch-domains-modal.component.ts @@ -1,10 +1,8 @@ -import { Component, OnInit, ViewChild, Input, Output, EventEmitter } from '@angular/core' -import { I18n } from '@ngx-translate/i18n-polyfill' +import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' +import { BatchDomainsValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { FormReactive } from '@app/shared/forms' -import { BatchDomainsValidatorsService } from './batch-domains-validators.service' +import { I18n } from '@ngx-translate/i18n-polyfill' @Component({ selector: 'my-batch-domains-modal', diff --git a/client/src/app/shared/blocklist/blocklist.service.ts b/client/src/app/shared/shared-moderation/blocklist.service.ts similarity index 96% rename from client/src/app/shared/blocklist/blocklist.service.ts rename to client/src/app/shared/shared-moderation/blocklist.service.ts index c70a8173a..0caa92782 100644 --- a/client/src/app/shared/blocklist/blocklist.service.ts +++ b/client/src/app/shared/shared-moderation/blocklist.service.ts @@ -1,12 +1,12 @@ -import { Injectable } from '@angular/core' -import { environment } from '../../../environments/environment' -import { HttpClient, HttpParams } from '@angular/common/http' -import { RestExtractor, RestPagination, RestService } from '../rest' import { SortMeta } from 'primeng/api' import { catchError, map } from 'rxjs/operators' -import { AccountBlock as AccountBlockServer, ResultList, ServerBlock } from '../../../../../shared' -import { Account } from '@app/shared/account/account.model' -import { AccountBlock } from '@app/shared/blocklist/account-block.model' +import { HttpClient, HttpParams } from '@angular/common/http' +import { Injectable } from '@angular/core' +import { RestExtractor, RestPagination, RestService } from '@app/core' +import { AccountBlock as AccountBlockServer, ResultList, ServerBlock } from '@shared/models' +import { environment } from '../../../environments/environment' +import { Account } from '../shared-main' +import { AccountBlock } from './account-block.model' export enum BlocklistComponentType { Account, Instance } diff --git a/client/src/app/shared/bulk/bulk.service.ts b/client/src/app/shared/shared-moderation/bulk.service.ts similarity index 75% rename from client/src/app/shared/bulk/bulk.service.ts rename to client/src/app/shared/shared-moderation/bulk.service.ts index b00db31ec..f0b869421 100644 --- a/client/src/app/shared/bulk/bulk.service.ts +++ b/client/src/app/shared/shared-moderation/bulk.service.ts @@ -1,9 +1,9 @@ +import { catchError } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' +import { RestExtractor } from '@app/core' +import { BulkRemoveCommentsOfBody } from '@shared/models' import { environment } from '../../../environments/environment' -import { RestExtractor, RestService } from '../rest' -import { BulkRemoveCommentsOfBody } from '../../../../../shared' -import { catchError } from 'rxjs/operators' @Injectable() export class BulkService { @@ -11,8 +11,7 @@ export class BulkService { constructor ( private authHttp: HttpClient, - private restExtractor: RestExtractor, - private restService: RestService + private restExtractor: RestExtractor ) { } removeCommentsOf (body: BulkRemoveCommentsOfBody) { diff --git a/client/src/app/shared/shared-moderation/index.ts b/client/src/app/shared/shared-moderation/index.ts new file mode 100644 index 000000000..8e74254f6 --- /dev/null +++ b/client/src/app/shared/shared-moderation/index.ts @@ -0,0 +1,13 @@ +export * from './account-block.model' +export * from './account-blocklist.component' +export * from './batch-domains-modal.component' +export * from './blocklist.service' +export * from './bulk.service' +export * from './server-blocklist.component' +export * from './user-ban-modal.component' +export * from './user-moderation-dropdown.component' +export * from './video-abuse.service' +export * from './video-block.component' +export * from './video-block.service' +export * from './video-report.component' +export * from './shared-moderation.module' diff --git a/client/src/app/shared/blocklist/server-blocklist.component.html b/client/src/app/shared/shared-moderation/server-blocklist.component.html similarity index 100% rename from client/src/app/shared/blocklist/server-blocklist.component.html rename to client/src/app/shared/shared-moderation/server-blocklist.component.html diff --git a/client/src/app/shared/blocklist/server-blocklist.component.scss b/client/src/app/shared/shared-moderation/server-blocklist.component.scss similarity index 100% rename from client/src/app/shared/blocklist/server-blocklist.component.scss rename to client/src/app/shared/shared-moderation/server-blocklist.component.scss diff --git a/client/src/app/shared/blocklist/server-blocklist.component.ts b/client/src/app/shared/shared-moderation/server-blocklist.component.ts similarity index 89% rename from client/src/app/shared/blocklist/server-blocklist.component.ts rename to client/src/app/shared/shared-moderation/server-blocklist.component.ts index f2b36badc..d904d0605 100644 --- a/client/src/app/shared/blocklist/server-blocklist.component.ts +++ b/client/src/app/shared/shared-moderation/server-blocklist.component.ts @@ -1,11 +1,10 @@ +import { SortMeta } from 'primeng/api' import { OnInit, ViewChild } from '@angular/core' -import { Notifier } from '@app/core' +import { BatchDomainsModalComponent } from '@app/shared/shared-moderation/batch-domains-modal.component' +import { Notifier, RestPagination, RestTable } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' -import { RestPagination, RestTable } from '@app/shared/rest' -import { SortMeta } from 'primeng/api' -import { BlocklistService, BlocklistComponentType } from './blocklist.service' -import { ServerBlock } from '../../../../../shared/models/blocklist/server-block.model' -import { BatchDomainsModalComponent } from '@app/+admin/config/shared/batch-domains-modal.component' +import { ServerBlock } from '@shared/models' +import { BlocklistComponentType, BlocklistService } from './blocklist.service' export class GenericServerBlocklistComponent extends RestTable implements OnInit { @ViewChild('batchDomainsModal') batchDomainsModal: BatchDomainsModalComponent @@ -26,13 +25,13 @@ export class GenericServerBlocklistComponent extends RestTable implements OnInit super() } + // @ts-ignore: "Abstract methods can only appear within an abstract class" + public abstract getIdentifier (): string + ngOnInit () { this.initialize() } - // @ts-ignore: "Abstract methods can only appear within an abstract class" - public abstract getIdentifier (): string - unblockServer (serverBlock: ServerBlock) { const operation = (host: string) => this.mode === BlocklistComponentType.Account ? this.blocklistService.unblockServerByUser(host) diff --git a/client/src/app/shared/shared-moderation/shared-moderation.module.ts b/client/src/app/shared/shared-moderation/shared-moderation.module.ts new file mode 100644 index 000000000..f7e64dfa3 --- /dev/null +++ b/client/src/app/shared/shared-moderation/shared-moderation.module.ts @@ -0,0 +1,46 @@ + +import { NgModule } from '@angular/core' +import { SharedFormModule } from '../shared-forms/shared-form.module' +import { SharedGlobalIconModule } from '../shared-icons' +import { SharedMainModule } from '../shared-main/shared-main.module' +import { BatchDomainsModalComponent } from './batch-domains-modal.component' +import { BlocklistService } from './blocklist.service' +import { BulkService } from './bulk.service' +import { UserBanModalComponent } from './user-ban-modal.component' +import { UserModerationDropdownComponent } from './user-moderation-dropdown.component' +import { VideoAbuseService } from './video-abuse.service' +import { VideoBlockComponent } from './video-block.component' +import { VideoBlockService } from './video-block.service' +import { VideoReportComponent } from './video-report.component' + +@NgModule({ + imports: [ + SharedMainModule, + SharedFormModule, + SharedGlobalIconModule + ], + + declarations: [ + UserBanModalComponent, + UserModerationDropdownComponent, + VideoBlockComponent, + VideoReportComponent, + BatchDomainsModalComponent + ], + + exports: [ + UserBanModalComponent, + UserModerationDropdownComponent, + VideoBlockComponent, + VideoReportComponent, + BatchDomainsModalComponent + ], + + providers: [ + BlocklistService, + BulkService, + VideoAbuseService, + VideoBlockService + ] +}) +export class SharedModerationModule { } diff --git a/client/src/app/shared/moderation/user-ban-modal.component.html b/client/src/app/shared/shared-moderation/user-ban-modal.component.html similarity index 100% rename from client/src/app/shared/moderation/user-ban-modal.component.html rename to client/src/app/shared/shared-moderation/user-ban-modal.component.html diff --git a/client/src/app/shared/moderation/user-ban-modal.component.scss b/client/src/app/shared/shared-moderation/user-ban-modal.component.scss similarity index 100% rename from client/src/app/shared/moderation/user-ban-modal.component.scss rename to client/src/app/shared/shared-moderation/user-ban-modal.component.scss diff --git a/client/src/app/shared/moderation/user-ban-modal.component.ts b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts similarity index 86% rename from client/src/app/shared/moderation/user-ban-modal.component.ts rename to client/src/app/shared/shared-moderation/user-ban-modal.component.ts index 1647e3691..124e58669 100644 --- a/client/src/app/shared/moderation/user-ban-modal.component.ts +++ b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts @@ -1,12 +1,10 @@ import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' -import { Notifier } from '@app/core' -import { I18n } from '@ngx-translate/i18n-polyfill' +import { Notifier, UserService } from '@app/core' +import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { FormReactive, UserValidatorsService } from '@app/shared/forms' -import { UserService } from '@app/shared/users' -import { User } from '../../../../../shared' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { User } from '@shared/models' @Component({ selector: 'my-user-ban-modal', diff --git a/client/src/app/shared/moderation/user-moderation-dropdown.component.html b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.html similarity index 100% rename from client/src/app/shared/moderation/user-moderation-dropdown.component.html rename to client/src/app/shared/shared-moderation/user-moderation-dropdown.component.html diff --git a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts similarity index 95% rename from client/src/app/shared/moderation/user-moderation-dropdown.component.ts rename to client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts index 82f39050e..d3c37f082 100644 --- a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts +++ b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts @@ -1,14 +1,11 @@ import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core' +import { AuthService, ConfirmService, Notifier, ServerService, UserService } from '@app/core' +import { Account, DropdownAction } from '@app/shared/shared-main' import { I18n } from '@ngx-translate/i18n-polyfill' -import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' -import { UserBanModalComponent } from '@app/shared/moderation/user-ban-modal.component' -import { UserService } from '@app/shared/users' -import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core' -import { User, UserRight } from '../../../../../shared/models/users' -import { Account } from '@app/shared/account/account.model' -import { BlocklistService } from '@app/shared/blocklist' -import { ServerConfig, BulkRemoveCommentsOfBody } from '@shared/models' -import { BulkService } from '../bulk/bulk.service' +import { BulkRemoveCommentsOfBody, ServerConfig, User, UserRight } from '@shared/models' +import { BlocklistService } from './blocklist.service' +import { BulkService } from './bulk.service' +import { UserBanModalComponent } from './user-ban-modal.component' @Component({ selector: 'my-user-moderation-dropdown', diff --git a/client/src/app/shared/video-abuse/video-abuse.service.ts b/client/src/app/shared/shared-moderation/video-abuse.service.ts similarity index 96% rename from client/src/app/shared/video-abuse/video-abuse.service.ts rename to client/src/app/shared/shared-moderation/video-abuse.service.ts index 43f4674b1..44dea44a5 100644 --- a/client/src/app/shared/video-abuse/video-abuse.service.ts +++ b/client/src/app/shared/shared-moderation/video-abuse.service.ts @@ -1,12 +1,12 @@ +import { omit } from 'lodash-es' +import { SortMeta } from 'primeng/api' +import { Observable } from 'rxjs' import { catchError, map } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' -import { SortMeta } from 'primeng/api' -import { Observable } from 'rxjs' -import { ResultList, VideoAbuse, VideoAbuseCreate, VideoAbuseState, VideoAbuseUpdate } from '../../../../../shared' +import { RestExtractor, RestPagination, RestService } from '@app/core' +import { ResultList, VideoAbuse, VideoAbuseCreate, VideoAbuseState, VideoAbuseUpdate } from '@shared/models' import { environment } from '../../../environments/environment' -import { RestExtractor, RestPagination, RestService } from '../rest' -import { omit } from 'lodash-es' @Injectable() export class VideoAbuseService { diff --git a/client/src/app/shared/video/modals/video-block.component.html b/client/src/app/shared/shared-moderation/video-block.component.html similarity index 100% rename from client/src/app/shared/video/modals/video-block.component.html rename to client/src/app/shared/shared-moderation/video-block.component.html diff --git a/client/src/app/shared/video/modals/video-block.component.scss b/client/src/app/shared/shared-moderation/video-block.component.scss similarity index 100% rename from client/src/app/shared/video/modals/video-block.component.scss rename to client/src/app/shared/shared-moderation/video-block.component.scss diff --git a/client/src/app/shared/video/modals/video-block.component.ts b/client/src/app/shared/shared-moderation/video-block.component.ts similarity index 85% rename from client/src/app/shared/video/modals/video-block.component.ts rename to client/src/app/shared/shared-moderation/video-block.component.ts index 1a25e0578..054651e71 100644 --- a/client/src/app/shared/video/modals/video-block.component.ts +++ b/client/src/app/shared/shared-moderation/video-block.component.ts @@ -1,12 +1,11 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' -import { Notifier, RedirectService } from '@app/core' -import { VideoBlockService } from '../../video-block' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' +import { Notifier } from '@app/core' +import { FormReactive, FormValidatorService, VideoBlockValidatorsService } from '@app/shared/shared-forms' +import { Video } from '@app/shared/shared-main' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { FormReactive, VideoBlockValidatorsService } from '@app/shared/forms' -import { Video } from '@app/shared/video/video.model' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoBlockService } from './video-block.service' @Component({ selector: 'my-video-block', diff --git a/client/src/app/shared/video-block/video-block.service.ts b/client/src/app/shared/shared-moderation/video-block.service.ts similarity index 91% rename from client/src/app/shared/video-block/video-block.service.ts rename to client/src/app/shared/shared-moderation/video-block.service.ts index d0673ddba..c22ceefcc 100644 --- a/client/src/app/shared/video-block/video-block.service.ts +++ b/client/src/app/shared/shared-moderation/video-block.service.ts @@ -1,11 +1,11 @@ -import { catchError, map, concatMap, toArray } from 'rxjs/operators' -import { HttpClient, HttpParams } from '@angular/common/http' -import { Injectable } from '@angular/core' import { SortMeta } from 'primeng/api' import { from as observableFrom, Observable } from 'rxjs' -import { VideoBlacklist, VideoBlacklistType, ResultList } from '../../../../../shared' +import { catchError, concatMap, map, toArray } from 'rxjs/operators' +import { HttpClient, HttpParams } from '@angular/common/http' +import { Injectable } from '@angular/core' +import { RestExtractor, RestPagination, RestService } from '@app/core' +import { ResultList, VideoBlacklist, VideoBlacklistType } from '@shared/models' import { environment } from '../../../environments/environment' -import { RestExtractor, RestPagination, RestService } from '../rest' @Injectable() export class VideoBlockService { diff --git a/client/src/app/shared/video/modals/video-report.component.html b/client/src/app/shared/shared-moderation/video-report.component.html similarity index 100% rename from client/src/app/shared/video/modals/video-report.component.html rename to client/src/app/shared/shared-moderation/video-report.component.html diff --git a/client/src/app/shared/video/modals/video-report.component.scss b/client/src/app/shared/shared-moderation/video-report.component.scss similarity index 100% rename from client/src/app/shared/video/modals/video-report.component.scss rename to client/src/app/shared/shared-moderation/video-report.component.scss diff --git a/client/src/app/shared/video/modals/video-report.component.ts b/client/src/app/shared/shared-moderation/video-report.component.ts similarity index 90% rename from client/src/app/shared/video/modals/video-report.component.ts rename to client/src/app/shared/shared-moderation/video-report.component.ts index c2d441bba..11c805636 100644 --- a/client/src/app/shared/video/modals/video-report.component.ts +++ b/client/src/app/shared/shared-moderation/video-report.component.ts @@ -1,17 +1,15 @@ +import { mapValues, pickBy } from 'lodash-es' +import { buildVideoEmbed, buildVideoLink } from 'src/assets/player/utils' import { Component, Input, OnInit, ViewChild } from '@angular/core' +import { DomSanitizer, SafeHtml } from '@angular/platform-browser' import { Notifier } from '@app/core' -import { FormReactive } from '../../../shared/forms' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { VideoAbuseValidatorsService } from '@app/shared/forms/form-validators/video-abuse-validators.service' +import { FormReactive, FormValidatorService, VideoAbuseValidatorsService } from '@app/shared/shared-forms' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { VideoAbuseService } from '@app/shared/video-abuse' -import { Video } from '@app/shared/video/video.model' -import { buildVideoEmbed, buildVideoLink } from 'src/assets/player/utils' -import { DomSanitizer, SafeHtml } from '@angular/platform-browser' -import { VideoAbusePredefinedReasonsString, videoAbusePredefinedReasonsMap } from '@shared/models/videos/abuse/video-abuse-reason.model' -import { mapValues, pickBy } from 'lodash-es' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { videoAbusePredefinedReasonsMap, VideoAbusePredefinedReasonsString } from '@shared/models/videos/abuse/video-abuse-reason.model' +import { Video } from '../shared-main' +import { VideoAbuseService } from './video-abuse.service' @Component({ selector: 'my-video-report', diff --git a/client/src/app/shared/shared-thumbnail/index.ts b/client/src/app/shared/shared-thumbnail/index.ts new file mode 100644 index 000000000..e09692867 --- /dev/null +++ b/client/src/app/shared/shared-thumbnail/index.ts @@ -0,0 +1,2 @@ +export * from './video-thumbnail.component' +export * from './shared-thumbnail.module' diff --git a/client/src/app/shared/shared-thumbnail/shared-thumbnail.module.ts b/client/src/app/shared/shared-thumbnail/shared-thumbnail.module.ts new file mode 100644 index 000000000..8ac557c14 --- /dev/null +++ b/client/src/app/shared/shared-thumbnail/shared-thumbnail.module.ts @@ -0,0 +1,23 @@ + +import { NgModule } from '@angular/core' +import { SharedGlobalIconModule } from '../shared-icons' +import { SharedMainModule } from '../shared-main/shared-main.module' +import { VideoThumbnailComponent } from './video-thumbnail.component' + +@NgModule({ + imports: [ + SharedMainModule, + SharedGlobalIconModule + ], + + declarations: [ + VideoThumbnailComponent + ], + + exports: [ + VideoThumbnailComponent + ], + + providers: [ ] +}) +export class SharedThumbnailModule { } diff --git a/client/src/app/shared/video/video-thumbnail.component.html b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.html similarity index 100% rename from client/src/app/shared/video/video-thumbnail.component.html rename to client/src/app/shared/shared-thumbnail/video-thumbnail.component.html diff --git a/client/src/app/shared/video/video-thumbnail.component.scss b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.scss similarity index 100% rename from client/src/app/shared/video/video-thumbnail.component.scss rename to client/src/app/shared/shared-thumbnail/video-thumbnail.component.scss diff --git a/client/src/app/shared/video/video-thumbnail.component.ts b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts similarity index 93% rename from client/src/app/shared/video/video-thumbnail.component.ts rename to client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts index 111b4c8bb..3ff45d9b7 100644 --- a/client/src/app/shared/video/video-thumbnail.component.ts +++ b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts @@ -1,7 +1,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core' -import { Video } from './video.model' -import { ScreenService } from '@app/shared/misc/screen.service' +import { ScreenService } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' +import { Video } from '../shared-main' @Component({ selector: 'my-video-thumbnail', diff --git a/client/src/app/shared/shared-user-settings/index.ts b/client/src/app/shared/shared-user-settings/index.ts new file mode 100644 index 000000000..dcc08bdce --- /dev/null +++ b/client/src/app/shared/shared-user-settings/index.ts @@ -0,0 +1,4 @@ +export * from './user-interface-settings.component' +export * from './user-video-settings.component' + +export * from './shared-user-settings.module' diff --git a/client/src/app/shared/shared-user-settings/shared-user-settings.module.ts b/client/src/app/shared/shared-user-settings/shared-user-settings.module.ts new file mode 100644 index 000000000..395f2e3d0 --- /dev/null +++ b/client/src/app/shared/shared-user-settings/shared-user-settings.module.ts @@ -0,0 +1,26 @@ + +import { NgModule } from '@angular/core' +import { SharedFormModule } from '../shared-forms' +import { SharedMainModule } from '../shared-main/shared-main.module' +import { UserInterfaceSettingsComponent } from './user-interface-settings.component' +import { UserVideoSettingsComponent } from './user-video-settings.component' + +@NgModule({ + imports: [ + SharedMainModule, + SharedFormModule + ], + + declarations: [ + UserInterfaceSettingsComponent, + UserVideoSettingsComponent + ], + + exports: [ + UserInterfaceSettingsComponent, + UserVideoSettingsComponent + ], + + providers: [ ] +}) +export class SharedUserInterfaceSettingsModule { } diff --git a/client/src/app/+my-account/my-account-settings/my-account-interface/my-account-interface-settings.component.html b/client/src/app/shared/shared-user-settings/user-interface-settings.component.html similarity index 100% rename from client/src/app/+my-account/my-account-settings/my-account-interface/my-account-interface-settings.component.html rename to client/src/app/shared/shared-user-settings/user-interface-settings.component.html diff --git a/client/src/app/+my-account/my-account-settings/my-account-interface/my-account-interface-settings.component.scss b/client/src/app/shared/shared-user-settings/user-interface-settings.component.scss similarity index 100% rename from client/src/app/+my-account/my-account-settings/my-account-interface/my-account-interface-settings.component.scss rename to client/src/app/shared/shared-user-settings/user-interface-settings.component.scss diff --git a/client/src/app/+my-account/my-account-settings/my-account-interface/my-account-interface-settings.component.ts b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts similarity index 72% rename from client/src/app/+my-account/my-account-settings/my-account-interface/my-account-interface-settings.component.ts rename to client/src/app/shared/shared-user-settings/user-interface-settings.component.ts index b6c17c0e3..875ffa3f1 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-interface/my-account-interface-settings.component.ts +++ b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts @@ -1,19 +1,16 @@ -import { Component, Input, OnInit, OnDestroy } from '@angular/core' -import { Notifier, ServerService } from '@app/core' -import { ServerConfig, UserUpdateMe } from '../../../../../../shared' -import { AuthService } from '../../../core' -import { FormReactive } from '../../../shared/forms/form-reactive' -import { User, UserService } from '../../../shared/users' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' import { Subject, Subscription } from 'rxjs' +import { Component, Input, OnDestroy, OnInit } from '@angular/core' +import { AuthService, Notifier, ServerService, UserService } from '@app/core' +import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { ServerConfig, User, UserUpdateMe } from '@shared/models' @Component({ - selector: 'my-account-interface-settings', - templateUrl: './my-account-interface-settings.component.html', - styleUrls: [ './my-account-interface-settings.component.scss' ] + selector: 'my-user-interface-settings', + templateUrl: './user-interface-settings.component.html', + styleUrls: [ './user-interface-settings.component.scss' ] }) -export class MyAccountInterfaceSettingsComponent extends FormReactive implements OnInit, OnDestroy { +export class UserInterfaceSettingsComponent extends FormReactive implements OnInit, OnDestroy { @Input() user: User = null @Input() reactiveUpdate = false @Input() notifyOnUpdate = true diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html b/client/src/app/shared/shared-user-settings/user-video-settings.component.html similarity index 100% rename from client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html rename to client/src/app/shared/shared-user-settings/user-video-settings.component.html diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.scss b/client/src/app/shared/shared-user-settings/user-video-settings.component.scss similarity index 100% rename from client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.scss rename to client/src/app/shared/shared-user-settings/user-video-settings.component.scss diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts b/client/src/app/shared/shared-user-settings/user-video-settings.component.ts similarity index 85% rename from client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts rename to client/src/app/shared/shared-user-settings/user-video-settings.component.ts index 0aaa54cd7..4e4539936 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts +++ b/client/src/app/shared/shared-user-settings/user-video-settings.component.ts @@ -1,23 +1,20 @@ -import { Component, Input, OnInit, OnDestroy } from '@angular/core' -import { Notifier, ServerService } from '@app/core' -import { UserUpdateMe } from '../../../../../../shared/models/users' -import { User, UserService } from '@app/shared/users' -import { AuthService } from '../../../core' -import { FormReactive } from '@app/shared/forms/form-reactive' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { forkJoin, Subject, Subscription } from 'rxjs' +import { pick } from 'lodash-es' import { SelectItem } from 'primeng/api' +import { forkJoin, Subject, Subscription } from 'rxjs' import { first } from 'rxjs/operators' +import { Component, Input, OnDestroy, OnInit } from '@angular/core' +import { AuthService, Notifier, ServerService, User, UserService } from '@app/core' +import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { UserUpdateMe } from '@shared/models' import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type' -import { pick } from 'lodash-es' @Component({ - selector: 'my-account-video-settings', - templateUrl: './my-account-video-settings.component.html', - styleUrls: [ './my-account-video-settings.component.scss' ] + selector: 'my-user-video-settings', + templateUrl: './user-video-settings.component.html', + styleUrls: [ './user-video-settings.component.scss' ] }) -export class MyAccountVideoSettingsComponent extends FormReactive implements OnInit, OnDestroy { +export class UserVideoSettingsComponent extends FormReactive implements OnInit, OnDestroy { @Input() user: User = null @Input() reactiveUpdate = false @Input() notifyOnUpdate = true diff --git a/client/src/app/shared/user-subscription/index.ts b/client/src/app/shared/shared-user-subscription/index.ts similarity index 72% rename from client/src/app/shared/user-subscription/index.ts rename to client/src/app/shared/shared-user-subscription/index.ts index e76940f7b..fd53d14b5 100644 --- a/client/src/app/shared/user-subscription/index.ts +++ b/client/src/app/shared/shared-user-subscription/index.ts @@ -1,3 +1,5 @@ export * from './user-subscription.service' export * from './subscribe-button.component' export * from './remote-subscribe.component' + +export * from './shared-user-subscription.module' diff --git a/client/src/app/shared/user-subscription/remote-subscribe.component.html b/client/src/app/shared/shared-user-subscription/remote-subscribe.component.html similarity index 100% rename from client/src/app/shared/user-subscription/remote-subscribe.component.html rename to client/src/app/shared/shared-user-subscription/remote-subscribe.component.html diff --git a/client/src/app/shared/user-subscription/remote-subscribe.component.scss b/client/src/app/shared/shared-user-subscription/remote-subscribe.component.scss similarity index 100% rename from client/src/app/shared/user-subscription/remote-subscribe.component.scss rename to client/src/app/shared/shared-user-subscription/remote-subscribe.component.scss diff --git a/client/src/app/shared/user-subscription/remote-subscribe.component.ts b/client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts similarity index 91% rename from client/src/app/shared/user-subscription/remote-subscribe.component.ts rename to client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts index befdb7157..09164a5d3 100644 --- a/client/src/app/shared/user-subscription/remote-subscribe.component.ts +++ b/client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts @@ -1,9 +1,5 @@ import { Component, Input, OnInit } from '@angular/core' -import { FormReactive } from '@app/shared/forms/form-reactive' -import { - FormValidatorService, - UserValidatorsService -} from '@app/shared/forms/form-validators' +import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' @Component({ selector: 'my-remote-subscribe', diff --git a/client/src/app/shared/shared-user-subscription/shared-user-subscription.module.ts b/client/src/app/shared/shared-user-subscription/shared-user-subscription.module.ts new file mode 100644 index 000000000..cddea80bf --- /dev/null +++ b/client/src/app/shared/shared-user-subscription/shared-user-subscription.module.ts @@ -0,0 +1,29 @@ + +import { NgModule } from '@angular/core' +import { SharedFormModule } from '../shared-forms' +import { SharedMainModule } from '../shared-main/shared-main.module' +import { RemoteSubscribeComponent } from './remote-subscribe.component' +import { SubscribeButtonComponent } from './subscribe-button.component' +import { UserSubscriptionService } from './user-subscription.service' + +@NgModule({ + imports: [ + SharedMainModule, + SharedFormModule + ], + + declarations: [ + RemoteSubscribeComponent, + SubscribeButtonComponent + ], + + exports: [ + RemoteSubscribeComponent, + SubscribeButtonComponent + ], + + providers: [ + UserSubscriptionService + ] +}) +export class SharedUserSubscriptionModule { } diff --git a/client/src/app/shared/user-subscription/subscribe-button.component.html b/client/src/app/shared/shared-user-subscription/subscribe-button.component.html similarity index 100% rename from client/src/app/shared/user-subscription/subscribe-button.component.html rename to client/src/app/shared/shared-user-subscription/subscribe-button.component.html diff --git a/client/src/app/shared/user-subscription/subscribe-button.component.scss b/client/src/app/shared/shared-user-subscription/subscribe-button.component.scss similarity index 100% rename from client/src/app/shared/user-subscription/subscribe-button.component.scss rename to client/src/app/shared/shared-user-subscription/subscribe-button.component.scss diff --git a/client/src/app/shared/user-subscription/subscribe-button.component.ts b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts similarity index 92% rename from client/src/app/shared/user-subscription/subscribe-button.component.ts rename to client/src/app/shared/shared-user-subscription/subscribe-button.component.ts index 947f34c85..72fa3f4fd 100644 --- a/client/src/app/shared/user-subscription/subscribe-button.component.ts +++ b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts @@ -1,13 +1,11 @@ -import { Component, Input, OnInit, OnChanges } from '@angular/core' +import { concat, forkJoin, merge } from 'rxjs' +import { Component, Input, OnChanges, OnInit } from '@angular/core' import { Router } from '@angular/router' import { AuthService, Notifier } from '@app/core' -import { UserSubscriptionService } from '@app/shared/user-subscription/user-subscription.service' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' +import { Account, VideoChannel, VideoService } from '@app/shared/shared-main' import { I18n } from '@ngx-translate/i18n-polyfill' -import { VideoService } from '@app/shared/video/video.service' -import { FeedFormat } from '../../../../../shared/models/feeds' -import { Account } from '@app/shared/account/account.model' -import { concat, forkJoin, merge } from 'rxjs' +import { FeedFormat } from '@shared/models' +import { UserSubscriptionService } from './user-subscription.service' @Component({ selector: 'my-subscribe-button', diff --git a/client/src/app/shared/user-subscription/user-subscription.service.ts b/client/src/app/shared/shared-user-subscription/user-subscription.service.ts similarity index 82% rename from client/src/app/shared/user-subscription/user-subscription.service.ts rename to client/src/app/shared/shared-user-subscription/user-subscription.service.ts index 9af9ba23e..732ed6bcb 100644 --- a/client/src/app/shared/user-subscription/user-subscription.service.ts +++ b/client/src/app/shared/shared-user-subscription/user-subscription.service.ts @@ -1,17 +1,14 @@ -import { bufferTime, catchError, filter, map, observeOn, share, switchMap, tap } from 'rxjs/operators' +import * as debug from 'debug' +import { uniq } from 'lodash-es' import { asyncScheduler, merge, Observable, of, ReplaySubject, Subject } from 'rxjs' +import { bufferTime, catchError, filter, map, observeOn, share, switchMap, tap } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable, NgZone } from '@angular/core' -import { ResultList } from '../../../../../shared' +import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' +import { enterZone, leaveZone } from '@app/helpers' +import { Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' +import { ResultList, VideoChannel as VideoChannelServer, VideoSortField } from '@shared/models' import { environment } from '../../../environments/environment' -import { RestExtractor, RestService } from '../rest' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { VideoChannel as VideoChannelServer } from '../../../../../shared/models/videos' -import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model' -import { uniq } from 'lodash-es' -import * as debug from 'debug' -import { enterZone, leaveZone } from '@app/shared/rxjs/zone' const logger = debug('peertube:subscriptions:UserSubscriptionService') @@ -33,6 +30,7 @@ export class UserSubscriptionService { constructor ( private authHttp: HttpClient, private restExtractor: RestExtractor, + private videoService: VideoService, private restService: RestService, private ngZone: NgZone ) { @@ -51,6 +49,27 @@ export class UserSubscriptionService { ) } + getUserSubscriptionVideos (parameters: { + videoPagination: ComponentPaginationLight, + sort: VideoSortField, + skipCount?: boolean + }): Observable> { + const { videoPagination, sort, skipCount } = parameters + const pagination = this.restService.componentPaginationToRestPagination(videoPagination) + + let params = new HttpParams() + params = this.restService.addRestGetParams(params, pagination, sort) + + if (skipCount) params = params.set('skipCount', skipCount + '') + + return this.authHttp + .get>(UserSubscriptionService.BASE_USER_SUBSCRIPTIONS_URL + '/videos', { params }) + .pipe( + switchMap(res => this.videoService.extractVideos(res)), + catchError(err => this.restExtractor.handleError(err)) + ) + } + /** * Subscription part */ diff --git a/client/src/app/shared/video/abstract-video-list.html b/client/src/app/shared/shared-video-miniature/abstract-video-list.html similarity index 100% rename from client/src/app/shared/video/abstract-video-list.html rename to client/src/app/shared/shared-video-miniature/abstract-video-list.html diff --git a/client/src/app/shared/video/abstract-video-list.scss b/client/src/app/shared/shared-video-miniature/abstract-video-list.scss similarity index 100% rename from client/src/app/shared/video/abstract-video-list.scss rename to client/src/app/shared/shared-video-miniature/abstract-video-list.scss diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts similarity index 90% rename from client/src/app/shared/video/abstract-video-list.ts rename to client/src/app/shared/shared-video-miniature/abstract-video-list.ts index 0bc339ff6..0ef842652 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts @@ -1,23 +1,25 @@ -import { fromEvent, Observable, of, Subject, Subscription } from 'rxjs' -import { debounceTime, tap, throttleTime, switchMap } from 'rxjs/operators' +import { fromEvent, Observable, Subject, Subscription } from 'rxjs' +import { debounceTime, switchMap, tap } from 'rxjs/operators' import { OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { Notifier, ServerService } from '@app/core' +import { + AuthService, + ComponentPaginationLight, + LocalStorageService, + Notifier, + ScreenService, + ServerService, + User, + UserService +} from '@app/core' import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' -import { GlobalIconName } from '@app/shared/images/global-icon.component' -import { ScreenService } from '@app/shared/misc/screen.service' -import { Syndication } from '@app/shared/video/syndication.model' -import { MiniatureDisplayOptions, OwnerDisplayType } from '@app/shared/video/video-miniature.component' +import { GlobalIconName } from '@app/shared/shared-icons' import { I18n } from '@ngx-translate/i18n-polyfill' import { isLastMonth, isLastWeek, isToday, isYesterday } from '@shared/core-utils/miscs/date' -import { ServerConfig } from '@shared/models' +import { ServerConfig, VideoSortField } from '@shared/models' import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type' -import { AuthService } from '../../core/auth' -import { LocalStorageService } from '../misc/storage.service' -import { ComponentPaginationLight } from '../rest/component-pagination.model' -import { User, UserService } from '../users' -import { VideoSortField } from './sort-field.type' -import { Video } from './video.model' +import { Syndication, Video } from '../shared-main' +import { MiniatureDisplayOptions, OwnerDisplayType } from './video-miniature.component' enum GroupDate { UNKNOWN = 0, diff --git a/client/src/app/shared/shared-video-miniature/index.ts b/client/src/app/shared/shared-video-miniature/index.ts new file mode 100644 index 000000000..47ca6f51b --- /dev/null +++ b/client/src/app/shared/shared-video-miniature/index.ts @@ -0,0 +1,7 @@ +export * from './abstract-video-list' +export * from './video-actions-dropdown.component' +export * from './video-download.component' +export * from './video-miniature.component' +export * from './videos-selection.component' + +export * from './shared-video-miniature.module' diff --git a/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts b/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts new file mode 100644 index 000000000..666144864 --- /dev/null +++ b/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts @@ -0,0 +1,40 @@ + +import { NgModule } from '@angular/core' +import { SharedFormModule } from '../shared-forms' +import { SharedGlobalIconModule } from '../shared-icons' +import { SharedMainModule } from '../shared-main/shared-main.module' +import { SharedModerationModule } from '../shared-moderation' +import { SharedThumbnailModule } from '../shared-thumbnail' +import { SharedVideoPlaylistModule } from '../shared-video-playlist/shared-video-playlist.module' +import { VideoActionsDropdownComponent } from './video-actions-dropdown.component' +import { VideoDownloadComponent } from './video-download.component' +import { VideoMiniatureComponent } from './video-miniature.component' +import { VideosSelectionComponent } from './videos-selection.component' + +@NgModule({ + imports: [ + SharedMainModule, + SharedFormModule, + SharedModerationModule, + SharedVideoPlaylistModule, + SharedThumbnailModule, + SharedGlobalIconModule + ], + + declarations: [ + VideoActionsDropdownComponent, + VideoDownloadComponent, + VideoMiniatureComponent, + VideosSelectionComponent + ], + + exports: [ + VideoActionsDropdownComponent, + VideoDownloadComponent, + VideoMiniatureComponent, + VideosSelectionComponent + ], + + providers: [ ] +}) +export class SharedVideoMiniatureModule { } diff --git a/client/src/app/shared/video/video-actions-dropdown.component.html b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html similarity index 100% rename from client/src/app/shared/video/video-actions-dropdown.component.html rename to client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html diff --git a/client/src/app/shared/video/video-actions-dropdown.component.scss b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.scss similarity index 100% rename from client/src/app/shared/video/video-actions-dropdown.component.scss rename to client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.scss diff --git a/client/src/app/shared/video/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts similarity index 88% rename from client/src/app/shared/video/video-actions-dropdown.component.ts rename to client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts index 1f5763610..db8d1c309 100644 --- a/client/src/app/shared/video/video-actions-dropdown.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts @@ -1,19 +1,12 @@ import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { DropdownAction, DropdownButtonSize, DropdownDirection } from '@app/shared/buttons/action-dropdown.component' -import { AuthService, ConfirmService, Notifier } from '@app/core' -import { Video } from '@app/shared/video/video.model' -import { VideoService } from '@app/shared/video/video.service' -import { VideoDetails } from '@app/shared/video/video-details.model' +import { AuthService, ConfirmService, Notifier, ScreenService } from '@app/core' +import { VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation' import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' -import { VideoAddToPlaylistComponent } from '@app/shared/video-playlist/video-add-to-playlist.component' -import { VideoDownloadComponent } from '@app/shared/video/modals/video-download.component' -import { VideoReportComponent } from '@app/shared/video/modals/video-report.component' -import { VideoBlockComponent } from '@app/shared/video/modals/video-block.component' -import { VideoBlockService } from '@app/shared/video-block' -import { ScreenService } from '@app/shared/misc/screen.service' +import { I18n } from '@ngx-translate/i18n-polyfill' import { VideoCaption } from '@shared/models' -import { RedundancyService } from '@app/shared/video/redundancy.service' +import { DropdownAction, DropdownButtonSize, DropdownDirection, RedundancyService, Video, VideoDetails, VideoService } from '../shared-main' +import { VideoAddToPlaylistComponent } from '../shared-video-playlist' +import { VideoDownloadComponent } from './video-download.component' export type VideoActionsDisplayType = { playlist?: boolean diff --git a/client/src/app/shared/video/modals/video-download.component.html b/client/src/app/shared/shared-video-miniature/video-download.component.html similarity index 100% rename from client/src/app/shared/video/modals/video-download.component.html rename to client/src/app/shared/shared-video-miniature/video-download.component.html diff --git a/client/src/app/shared/video/modals/video-download.component.scss b/client/src/app/shared/shared-video-miniature/video-download.component.scss similarity index 100% rename from client/src/app/shared/video/modals/video-download.component.scss rename to client/src/app/shared/shared-video-miniature/video-download.component.scss diff --git a/client/src/app/shared/video/modals/video-download.component.ts b/client/src/app/shared/shared-video-miniature/video-download.component.ts similarity index 96% rename from client/src/app/shared/video/modals/video-download.component.ts rename to client/src/app/shared/shared-video-miniature/video-download.component.ts index d77187821..21df8b674 100644 --- a/client/src/app/shared/video/modals/video-download.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-download.component.ts @@ -1,14 +1,12 @@ -import { Component, ElementRef, ViewChild } from '@angular/core' -import { VideoDetails } from '../../../shared/video/video-details.model' -import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { AuthService, Notifier } from '@app/core' -import { VideoPrivacy, VideoCaption, VideoFile } from '@shared/models' import { FfprobeFormat, FfprobeStream } from 'fluent-ffmpeg' import { mapValues, pick } from 'lodash-es' -import { NumberFormatterPipe } from '@app/shared/angular/number-formatter.pipe' import { BytesPipe } from 'ngx-pipes' -import { VideoService } from '../video.service' +import { Component, ElementRef, ViewChild } from '@angular/core' +import { AuthService, Notifier } from '@app/core' +import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoCaption, VideoFile, VideoPrivacy } from '@shared/models' +import { NumberFormatterPipe, VideoDetails, VideoService } from '../shared-main' type DownloadType = 'video' | 'subtitles' type FileMetadata = { [key: string]: { label: string, value: string }} diff --git a/client/src/app/shared/video/video-miniature.component.html b/client/src/app/shared/shared-video-miniature/video-miniature.component.html similarity index 100% rename from client/src/app/shared/video/video-miniature.component.html rename to client/src/app/shared/shared-video-miniature/video-miniature.component.html diff --git a/client/src/app/shared/video/video-miniature.component.scss b/client/src/app/shared/shared-video-miniature/video-miniature.component.scss similarity index 100% rename from client/src/app/shared/video/video-miniature.component.scss rename to client/src/app/shared/shared-video-miniature/video-miniature.component.scss diff --git a/client/src/app/shared/video/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts similarity index 95% rename from client/src/app/shared/video/video-miniature.component.ts rename to client/src/app/shared/shared-video-miniature/video-miniature.component.ts index a08c3fc8d..6f32977b3 100644 --- a/client/src/app/shared/video/video-miniature.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts @@ -10,14 +10,12 @@ import { OnInit, Output } from '@angular/core' -import { AuthService, ServerService } from '@app/core' -import { ScreenService } from '@app/shared/misc/screen.service' -import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' -import { VideoActionsDisplayType } from '@app/shared/video/video-actions-dropdown.component' +import { AuthService, ScreenService, ServerService, User } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' import { ServerConfig, VideoPlaylistType, VideoPrivacy, VideoState } from '../../../../../shared' -import { User } from '../users' -import { Video } from './video.model' +import { Video } from '../shared-main' +import { VideoPlaylistService } from '../shared-video-playlist' +import { VideoActionsDisplayType } from './video-actions-dropdown.component' export type OwnerDisplayType = 'account' | 'videoChannel' | 'auto' export type MiniatureDisplayOptions = { diff --git a/client/src/app/shared/video/videos-selection.component.html b/client/src/app/shared/shared-video-miniature/videos-selection.component.html similarity index 100% rename from client/src/app/shared/video/videos-selection.component.html rename to client/src/app/shared/shared-video-miniature/videos-selection.component.html diff --git a/client/src/app/shared/video/videos-selection.component.scss b/client/src/app/shared/shared-video-miniature/videos-selection.component.scss similarity index 100% rename from client/src/app/shared/video/videos-selection.component.scss rename to client/src/app/shared/shared-video-miniature/videos-selection.component.scss diff --git a/client/src/app/shared/video/videos-selection.component.ts b/client/src/app/shared/shared-video-miniature/videos-selection.component.ts similarity index 79% rename from client/src/app/shared/video/videos-selection.component.ts rename to client/src/app/shared/shared-video-miniature/videos-selection.component.ts index 9453664dd..3e0e3b983 100644 --- a/client/src/app/shared/video/videos-selection.component.ts +++ b/client/src/app/shared/shared-video-miniature/videos-selection.component.ts @@ -1,3 +1,4 @@ +import { Observable } from 'rxjs' import { AfterContentInit, Component, @@ -11,19 +12,12 @@ import { TemplateRef } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { AbstractVideoList } from '@app/shared/video/abstract-video-list' -import { AuthService, Notifier, ServerService } from '@app/core' -import { ScreenService } from '@app/shared/misc/screen.service' -import { MiniatureDisplayOptions, OwnerDisplayType } from '@app/shared/video/video-miniature.component' -import { Observable } from 'rxjs' -import { Video } from '@app/shared/video/video.model' -import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template.directive' -import { VideoSortField } from '@app/shared/video/sort-field.type' -import { ComponentPagination } from '@app/shared/rest/component-pagination.model' +import { AuthService, ComponentPagination, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' -import { ResultList } from '@shared/models' -import { UserService } from '../users' -import { LocalStorageService } from '../misc/storage.service' +import { ResultList, VideoSortField } from '@shared/models' +import { PeerTubeTemplateDirective, Video } from '../shared-main' +import { AbstractVideoList } from './abstract-video-list' +import { MiniatureDisplayOptions, OwnerDisplayType } from './video-miniature.component' export type SelectionType = { [ id: number ]: boolean } diff --git a/client/src/app/shared/shared-video-playlist/index.ts b/client/src/app/shared/shared-video-playlist/index.ts new file mode 100644 index 000000000..63bb046c6 --- /dev/null +++ b/client/src/app/shared/shared-video-playlist/index.ts @@ -0,0 +1,8 @@ +export * from './video-add-to-playlist.component' +export * from './video-playlist-element-miniature.component' +export * from './video-playlist-element.model' +export * from './video-playlist-miniature.component' +export * from './video-playlist.model' +export * from './video-playlist.service' + +export * from './shared-video-playlist.module' diff --git a/client/src/app/shared/shared-video-playlist/shared-video-playlist.module.ts b/client/src/app/shared/shared-video-playlist/shared-video-playlist.module.ts new file mode 100644 index 000000000..0566b1592 --- /dev/null +++ b/client/src/app/shared/shared-video-playlist/shared-video-playlist.module.ts @@ -0,0 +1,36 @@ + +import { NgModule } from '@angular/core' +import { SharedFormModule } from '../shared-forms' +import { SharedGlobalIconModule } from '../shared-icons' +import { SharedMainModule } from '../shared-main/shared-main.module' +import { SharedThumbnailModule } from '../shared-thumbnail' +import { VideoAddToPlaylistComponent } from './video-add-to-playlist.component' +import { VideoPlaylistElementMiniatureComponent } from './video-playlist-element-miniature.component' +import { VideoPlaylistMiniatureComponent } from './video-playlist-miniature.component' +import { VideoPlaylistService } from './video-playlist.service' + +@NgModule({ + imports: [ + SharedMainModule, + SharedFormModule, + SharedThumbnailModule, + SharedGlobalIconModule + ], + + declarations: [ + VideoAddToPlaylistComponent, + VideoPlaylistElementMiniatureComponent, + VideoPlaylistMiniatureComponent + ], + + exports: [ + VideoAddToPlaylistComponent, + VideoPlaylistElementMiniatureComponent, + VideoPlaylistMiniatureComponent + ], + + providers: [ + VideoPlaylistService + ] +}) +export class SharedVideoPlaylistModule { } diff --git a/client/src/app/shared/video-playlist/video-add-to-playlist.component.html b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.html similarity index 100% rename from client/src/app/shared/video-playlist/video-add-to-playlist.component.html rename to client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.html diff --git a/client/src/app/shared/video-playlist/video-add-to-playlist.component.scss b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.scss similarity index 100% rename from client/src/app/shared/video-playlist/video-add-to-playlist.component.scss rename to client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.scss diff --git a/client/src/app/shared/video-playlist/video-add-to-playlist.component.ts b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts similarity index 94% rename from client/src/app/shared/video-playlist/video-add-to-playlist.component.ts rename to client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts index 0c593a79a..f611fc46b 100644 --- a/client/src/app/shared/video-playlist/video-add-to-playlist.component.ts +++ b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts @@ -1,15 +1,13 @@ -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core' -import { CachedPlaylist, VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' -import { AuthService, Notifier } from '@app/core' +import * as debug from 'debug' import { Subject, Subscription } from 'rxjs' import { debounceTime, filter } from 'rxjs/operators' -import { Video, VideoPlaylistCreate, VideoPlaylistElementCreate, VideoPlaylistPrivacy } from '@shared/models' -import { FormReactive, FormValidatorService, VideoPlaylistValidatorsService } from '@app/shared/forms' +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core' +import { AuthService, DisableForReuseHook, Notifier } from '@app/core' +import { FormReactive, FormValidatorService, VideoPlaylistValidatorsService } from '@app/shared/shared-forms' import { I18n } from '@ngx-translate/i18n-polyfill' +import { Video, VideoExistInPlaylist, VideoPlaylistCreate, VideoPlaylistElementCreate, VideoPlaylistPrivacy } from '@shared/models' import { secondsToTime } from '../../../assets/player/utils' -import * as debug from 'debug' -import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' -import { VideoExistInPlaylist } from '@shared/models/videos/playlist/video-exist-in-playlist.model' +import { CachedPlaylist, VideoPlaylistService } from './video-playlist.service' const logger = debug('peertube:playlists:VideoAddToPlaylistComponent') diff --git a/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.html b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.html similarity index 100% rename from client/src/app/shared/video-playlist/video-playlist-element-miniature.component.html rename to client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.html diff --git a/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.scss b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.scss similarity index 100% rename from client/src/app/shared/video-playlist/video-playlist-element-miniature.component.scss rename to client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.scss diff --git a/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts similarity index 90% rename from client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts rename to client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts index fad03e045..57a5fbe61 100644 --- a/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts @@ -1,15 +1,13 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' -import { Video } from '@app/shared/video/video.model' -import { ServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate } from '@shared/models' -import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core' -import { ActivatedRoute } from '@angular/router' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { VideoService } from '@app/shared/video/video.service' -import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' +import { AuthService, Notifier, ServerService } from '@app/core' +import { Video } from '@app/shared/shared-main' import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' -import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { ServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate } from '@shared/models' import { secondsToTime } from '../../../assets/player/utils' -import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model' +import { VideoPlaylistElement } from './video-playlist-element.model' +import { VideoPlaylist } from './video-playlist.model' +import { VideoPlaylistService } from './video-playlist.service' @Component({ selector: 'my-video-playlist-element-miniature', @@ -46,10 +44,7 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit { private authService: AuthService, private serverService: ServerService, private notifier: Notifier, - private confirmService: ConfirmService, - private route: ActivatedRoute, private i18n: I18n, - private videoService: VideoService, private videoPlaylistService: VideoPlaylistService, private cdr: ChangeDetectorRef ) {} diff --git a/client/src/app/shared/video-playlist/video-playlist-element.model.ts b/client/src/app/shared/shared-video-playlist/video-playlist-element.model.ts similarity index 92% rename from client/src/app/shared/video-playlist/video-playlist-element.model.ts rename to client/src/app/shared/shared-video-playlist/video-playlist-element.model.ts index f1c46d1eb..27a79d1fd 100644 --- a/client/src/app/shared/video-playlist/video-playlist-element.model.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist-element.model.ts @@ -1,5 +1,5 @@ import { VideoPlaylistElement as ServerVideoPlaylistElement, VideoPlaylistElementType } from '../../../../../shared/models/videos' -import { Video } from '@app/shared/video/video.model' +import { Video } from '@app/shared/shared-main' export class VideoPlaylistElement implements ServerVideoPlaylistElement { id: number diff --git a/client/src/app/shared/video-playlist/video-playlist-miniature.component.html b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.html similarity index 100% rename from client/src/app/shared/video-playlist/video-playlist-miniature.component.html rename to client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.html diff --git a/client/src/app/shared/video-playlist/video-playlist-miniature.component.scss b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.scss similarity index 100% rename from client/src/app/shared/video-playlist/video-playlist-miniature.component.scss rename to client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.scss diff --git a/client/src/app/shared/video-playlist/video-playlist-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts similarity index 89% rename from client/src/app/shared/video-playlist/video-playlist-miniature.component.ts rename to client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts index 523e96f2a..4b0669a32 100644 --- a/client/src/app/shared/video-playlist/video-playlist-miniature.component.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts @@ -1,5 +1,5 @@ import { Component, Input } from '@angular/core' -import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' +import { VideoPlaylist } from './video-playlist.model' @Component({ selector: 'my-video-playlist-miniature', diff --git a/client/src/app/shared/video-playlist/video-playlist.model.ts b/client/src/app/shared/shared-video-playlist/video-playlist.model.ts similarity index 91% rename from client/src/app/shared/video-playlist/video-playlist.model.ts rename to client/src/app/shared/shared-video-playlist/video-playlist.model.ts index 6f27e7475..8f63d2abd 100644 --- a/client/src/app/shared/video-playlist/video-playlist.model.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist.model.ts @@ -1,13 +1,14 @@ +import { getAbsoluteAPIUrl } from '@app/helpers' +import { Actor } from '@app/shared/shared-main' import { + AccountSummary, + peertubeTranslate, VideoChannelSummary, VideoConstant, VideoPlaylist as ServerVideoPlaylist, VideoPlaylistPrivacy, VideoPlaylistType -} from '../../../../../shared/models/videos' -import { AccountSummary, peertubeTranslate } from '@shared/models' -import { Actor } from '@app/shared/actor/actor.model' -import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' +} from '@shared/models' export class VideoPlaylist implements ServerVideoPlaylist { id: number diff --git a/client/src/app/shared/video-playlist/video-playlist.service.ts b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts similarity index 89% rename from client/src/app/shared/video-playlist/video-playlist.service.ts rename to client/src/app/shared/shared-video-playlist/video-playlist.service.ts index 38d915c6b..cc3d04b9e 100644 --- a/client/src/app/shared/video-playlist/video-playlist.service.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts @@ -1,29 +1,27 @@ -import { bufferTime, catchError, filter, map, observeOn, share, switchMap, tap } from 'rxjs/operators' -import { Injectable, NgZone } from '@angular/core' +import * as debug from 'debug' +import { uniq } from 'lodash-es' import { asyncScheduler, merge, Observable, of, ReplaySubject, Subject } from 'rxjs' -import { RestExtractor } from '../rest/rest-extractor.service' +import { bufferTime, catchError, filter, map, observeOn, share, switchMap, tap } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' -import { ResultList, VideoPlaylistElementCreate, VideoPlaylistElementUpdate } from '../../../../../shared' +import { Injectable, NgZone } from '@angular/core' +import { AuthUser, ComponentPaginationLight, RestExtractor, RestService, ServerService } from '@app/core' +import { enterZone, leaveZone, objectToFormData } from '@app/helpers' +import { Account, AccountService, VideoChannel, VideoChannelService } from '@app/shared/shared-main' +import { + ResultList, + VideoExistInPlaylist, + VideoPlaylist as VideoPlaylistServerModel, + VideoPlaylistCreate, + VideoPlaylistElement as ServerVideoPlaylistElement, + VideoPlaylistElementCreate, + VideoPlaylistElementUpdate, + VideoPlaylistReorder, + VideoPlaylistUpdate, + VideosExistInPlaylists +} from '@shared/models' import { environment } from '../../../environments/environment' -import { VideoPlaylist as VideoPlaylistServerModel } from '@shared/models/videos/playlist/video-playlist.model' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { VideoChannel } from '@app/shared/video-channel/video-channel.model' -import { VideoPlaylistCreate } from '@shared/models/videos/playlist/video-playlist-create.model' -import { VideoPlaylistUpdate } from '@shared/models/videos/playlist/video-playlist-update.model' -import { objectToFormData } from '@app/shared/misc/utils' -import { AuthUser, ServerService } from '@app/core' -import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' -import { AccountService } from '@app/shared/account/account.service' -import { Account } from '@app/shared/account/account.model' -import { RestService } from '@app/shared/rest' -import { VideoExistInPlaylist, VideosExistInPlaylists } from '@shared/models/videos/playlist/video-exist-in-playlist.model' -import { VideoPlaylistReorder } from '@shared/models/videos/playlist/video-playlist-reorder.model' -import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model' -import { VideoPlaylistElement as ServerVideoPlaylistElement } from '@shared/models/videos/playlist/video-playlist-element.model' -import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model' -import { uniq } from 'lodash-es' -import * as debug from 'debug' -import { enterZone, leaveZone } from '@app/shared/rxjs/zone' +import { VideoPlaylistElement } from './video-playlist-element.model' +import { VideoPlaylist } from './video-playlist.model' const logger = debug('peertube:playlists:VideoPlaylistService') diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts deleted file mode 100644 index 98fab9e16..000000000 --- a/client/src/app/shared/shared.module.ts +++ /dev/null @@ -1,337 +0,0 @@ -import { BytesPipe, KeysPipe, NgPipesModule } from 'ngx-pipes' -import { SharedModule as PrimeSharedModule } from 'primeng/api' -import { InputMaskModule } from 'primeng/inputmask' -import { InputSwitchModule } from 'primeng/inputswitch' -import { MultiSelectModule } from 'primeng/multiselect' -import { ClipboardModule } from '@angular/cdk/clipboard' -import { CommonModule } from '@angular/common' -import { HttpClientModule } from '@angular/common/http' -import { NgModule } from '@angular/core' -import { FormsModule, ReactiveFormsModule } from '@angular/forms' -import { RouterModule } from '@angular/router' -import { BatchDomainsValidatorsService } from '@app/+admin/config/shared/batch-domains-validators.service' -import { BatchDomainsModalComponent } from '@app/+admin/config/shared/batch-domains-modal.component' -import { MyAccountInterfaceSettingsComponent } from '@app/+my-account/my-account-settings/my-account-interface' -import { MyAccountVideoSettingsComponent } from '@app/+my-account/my-account-settings/my-account-video-settings' -import { ActorAvatarInfoComponent } from '@app/+my-account/shared/actor-avatar-info.component' -import { AccountService } from '@app/shared/account/account.service' -import { FromNowPipe } from '@app/shared/angular/from-now.pipe' -import { HighlightPipe } from '@app/shared/angular/highlight.pipe' -import { NumberFormatterPipe } from '@app/shared/angular/number-formatter.pipe' -import { ObjectLengthPipe } from '@app/shared/angular/object-length.pipe' -import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template.directive' -import { VideoDurationPipe } from '@app/shared/angular/video-duration-formatter.pipe' -import { BlocklistService } from '@app/shared/blocklist' -import { ActionDropdownComponent } from '@app/shared/buttons/action-dropdown.component' -import { AvatarComponent } from '@app/shared/channel/avatar.component' -import { ConfirmComponent } from '@app/shared/confirm/confirm.component' -import { DateToggleComponent } from '@app/shared/date/date-toggle.component' -import { - CustomConfigValidatorsService, - InstanceValidatorsService, - LoginValidatorsService, - ReactiveFileComponent, - ResetPasswordValidatorsService, - TextareaAutoResizeDirective, - UserValidatorsService, - VideoAbuseValidatorsService, - VideoAcceptOwnershipValidatorsService, - VideoBlockValidatorsService, - VideoChangeOwnershipValidatorsService, - VideoChannelValidatorsService, - VideoCommentValidatorsService, - VideoPlaylistValidatorsService, - VideoValidatorsService -} from '@app/shared/forms' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { VideoCaptionsValidatorsService } from '@app/shared/forms/form-validators/video-captions-validators.service' -import { InputReadonlyCopyComponent } from '@app/shared/forms/input-readonly-copy.component' -import { MarkdownTextareaComponent } from '@app/shared/forms/markdown-textarea.component' -import { PeertubeCheckboxComponent } from '@app/shared/forms/peertube-checkbox.component' -import { TimestampInputComponent } from '@app/shared/forms/timestamp-input.component' -import { I18nPrimengCalendarService } from '@app/shared/i18n/i18n-primeng-calendar' -import { GlobalIconComponent } from '@app/shared/images/global-icon.component' -import { PreviewUploadComponent } from '@app/shared/images/preview-upload.component' -import { FeatureBooleanComponent } from '@app/shared/instance/feature-boolean.component' -import { FollowService } from '@app/shared/instance/follow.service' -import { InstanceFeaturesTableComponent } from '@app/shared/instance/instance-features-table.component' -import { InstanceStatisticsComponent } from '@app/shared/instance/instance-statistics.component' -import { InstanceService } from '@app/shared/instance/instance.service' -import { TopMenuDropdownComponent } from '@app/shared/menu/top-menu-dropdown.component' -import { HelpComponent } from '@app/shared/misc/help.component' -import { ListOverflowComponent } from '@app/shared/misc/list-overflow.component' -import { ScreenService } from '@app/shared/misc/screen.service' -import { SmallLoaderComponent } from '@app/shared/misc/small-loader.component' -import { LocalStorageService, SessionStorageService } from '@app/shared/misc/storage.service' -import { UserBanModalComponent } from '@app/shared/moderation' -import { UserModerationDropdownComponent } from '@app/shared/moderation/user-moderation-dropdown.component' -import { OverviewService } from '@app/shared/overview' -import { HtmlRendererService, LinkifierService, MarkdownService } from '@app/shared/renderer' -import { RemoteSubscribeComponent, SubscribeButtonComponent, UserSubscriptionService } from '@app/shared/user-subscription' -import { UserHistoryService } from '@app/shared/users/user-history.service' -import { UserNotificationService } from '@app/shared/users/user-notification.service' -import { UserNotificationsComponent } from '@app/shared/users/user-notifications.component' -import { VideoCaptionService } from '@app/shared/video-caption' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { VideoImportService } from '@app/shared/video-import/video-import.service' -import { VideoAddToPlaylistComponent } from '@app/shared/video-playlist/video-add-to-playlist.component' -import { VideoPlaylistElementMiniatureComponent } from '@app/shared/video-playlist/video-playlist-element-miniature.component' -import { VideoPlaylistMiniatureComponent } from '@app/shared/video-playlist/video-playlist-miniature.component' -import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' -import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive' -import { VideoBlockComponent } from '@app/shared/video/modals/video-block.component' -import { VideoDownloadComponent } from '@app/shared/video/modals/video-download.component' -import { VideoReportComponent } from '@app/shared/video/modals/video-report.component' -import { RedundancyService } from '@app/shared/video/redundancy.service' -import { VideoActionsDropdownComponent } from '@app/shared/video/video-actions-dropdown.component' -import { VideosSelectionComponent } from '@app/shared/video/videos-selection.component' -import { - NgbCollapseModule, - NgbDropdownModule, - NgbModalModule, - NgbNavModule, - NgbPopoverModule, - NgbTooltipModule -} from '@ng-bootstrap/ng-bootstrap' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { AUTH_INTERCEPTOR_PROVIDER } from './auth' -import { BulkService } from './bulk/bulk.service' -import { ButtonComponent } from './buttons/button.component' -import { DeleteButtonComponent } from './buttons/delete-button.component' -import { EditButtonComponent } from './buttons/edit-button.component' -import { LoaderComponent } from './misc/loader.component' -import { RestExtractor, RestService } from './rest' -import { UserService } from './users' -import { VideoAbuseService } from './video-abuse' -import { VideoBlockService } from './video-block' -import { VideoOwnershipService } from './video-ownership' -import { FeedComponent } from './video/feed.component' -import { VideoMiniatureComponent } from './video/video-miniature.component' -import { VideoThumbnailComponent } from './video/video-thumbnail.component' -import { VideoService } from './video/video.service' - -@NgModule({ - imports: [ - CommonModule, - FormsModule, - ReactiveFormsModule, - RouterModule, - HttpClientModule, - - NgbDropdownModule, - NgbModalModule, - NgbPopoverModule, - NgbNavModule, - NgbTooltipModule, - NgbCollapseModule, - - ClipboardModule, - - PrimeSharedModule, - InputMaskModule, - NgPipesModule, - MultiSelectModule, - InputSwitchModule - ], - - declarations: [ - LoaderComponent, - SmallLoaderComponent, - - VideoThumbnailComponent, - VideoMiniatureComponent, - VideoPlaylistMiniatureComponent, - VideoAddToPlaylistComponent, - VideoPlaylistElementMiniatureComponent, - VideosSelectionComponent, - VideoActionsDropdownComponent, - - VideoDownloadComponent, - VideoReportComponent, - VideoBlockComponent, - - FeedComponent, - - ButtonComponent, - DeleteButtonComponent, - EditButtonComponent, - - NumberFormatterPipe, - ObjectLengthPipe, - FromNowPipe, - HighlightPipe, - PeerTubeTemplateDirective, - VideoDurationPipe, - - ActionDropdownComponent, - MarkdownTextareaComponent, - InfiniteScrollerDirective, - TextareaAutoResizeDirective, - HelpComponent, - ListOverflowComponent, - - ReactiveFileComponent, - PeertubeCheckboxComponent, - TimestampInputComponent, - InputReadonlyCopyComponent, - - AvatarComponent, - SubscribeButtonComponent, - RemoteSubscribeComponent, - InstanceFeaturesTableComponent, - InstanceStatisticsComponent, - FeatureBooleanComponent, - UserBanModalComponent, - UserModerationDropdownComponent, - TopMenuDropdownComponent, - UserNotificationsComponent, - ConfirmComponent, - DateToggleComponent, - - GlobalIconComponent, - PreviewUploadComponent, - - MyAccountVideoSettingsComponent, - MyAccountInterfaceSettingsComponent, - ActorAvatarInfoComponent, - BatchDomainsModalComponent - ], - - exports: [ - CommonModule, - FormsModule, - ReactiveFormsModule, - RouterModule, - HttpClientModule, - - NgbDropdownModule, - NgbModalModule, - NgbPopoverModule, - NgbNavModule, - NgbTooltipModule, - NgbCollapseModule, - - ClipboardModule, - - PrimeSharedModule, - InputMaskModule, - BytesPipe, - KeysPipe, - MultiSelectModule, - - LoaderComponent, - SmallLoaderComponent, - - VideoThumbnailComponent, - VideoMiniatureComponent, - VideoPlaylistMiniatureComponent, - VideoAddToPlaylistComponent, - VideoPlaylistElementMiniatureComponent, - VideosSelectionComponent, - VideoActionsDropdownComponent, - - VideoDownloadComponent, - VideoReportComponent, - VideoBlockComponent, - - FeedComponent, - - ButtonComponent, - DeleteButtonComponent, - EditButtonComponent, - - ActionDropdownComponent, - MarkdownTextareaComponent, - InfiniteScrollerDirective, - TextareaAutoResizeDirective, - HelpComponent, - ListOverflowComponent, - InputReadonlyCopyComponent, - - ReactiveFileComponent, - PeertubeCheckboxComponent, - TimestampInputComponent, - - AvatarComponent, - SubscribeButtonComponent, - RemoteSubscribeComponent, - InstanceFeaturesTableComponent, - InstanceStatisticsComponent, - UserBanModalComponent, - UserModerationDropdownComponent, - TopMenuDropdownComponent, - UserNotificationsComponent, - ConfirmComponent, - DateToggleComponent, - - GlobalIconComponent, - PreviewUploadComponent, - - NumberFormatterPipe, - ObjectLengthPipe, - FromNowPipe, - HighlightPipe, - PeerTubeTemplateDirective, - VideoDurationPipe, - - MyAccountVideoSettingsComponent, - MyAccountInterfaceSettingsComponent, - ActorAvatarInfoComponent, - BatchDomainsModalComponent - ], - - providers: [ - AUTH_INTERCEPTOR_PROVIDER, - RestExtractor, - RestService, - VideoAbuseService, - VideoBlockService, - VideoOwnershipService, - UserService, - VideoService, - AccountService, - VideoChannelService, - VideoPlaylistService, - VideoCaptionService, - VideoImportService, - UserSubscriptionService, - - FormValidatorService, - CustomConfigValidatorsService, - LoginValidatorsService, - ResetPasswordValidatorsService, - UserValidatorsService, - BatchDomainsValidatorsService, - VideoPlaylistValidatorsService, - VideoAbuseValidatorsService, - VideoChannelValidatorsService, - VideoCommentValidatorsService, - VideoValidatorsService, - VideoCaptionsValidatorsService, - VideoBlockValidatorsService, - OverviewService, - VideoChangeOwnershipValidatorsService, - VideoAcceptOwnershipValidatorsService, - InstanceValidatorsService, - BlocklistService, - UserHistoryService, - InstanceService, - BulkService, - - MarkdownService, - LinkifierService, - HtmlRendererService, - - I18nPrimengCalendarService, - ScreenService, - LocalStorageService, SessionStorageService, - - UserNotificationService, - - FollowService, - RedundancyService, - - I18n - ] -}) -export class SharedModule { } diff --git a/client/src/app/shared/video-abuse/index.ts b/client/src/app/shared/video-abuse/index.ts deleted file mode 100644 index 92cbfb5f9..000000000 --- a/client/src/app/shared/video-abuse/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './video-abuse.service' diff --git a/client/src/app/shared/video-block/index.ts b/client/src/app/shared/video-block/index.ts deleted file mode 100644 index a99551a38..000000000 --- a/client/src/app/shared/video-block/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './video-block.service' diff --git a/client/src/app/shared/video-caption/index.ts b/client/src/app/shared/video-caption/index.ts deleted file mode 100644 index c48a70558..000000000 --- a/client/src/app/shared/video-caption/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './video-caption.service' diff --git a/client/src/app/shared/video-import/index.ts b/client/src/app/shared/video-import/index.ts deleted file mode 100644 index 9bb73ec2c..000000000 --- a/client/src/app/shared/video-import/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './video-import.service' diff --git a/client/src/app/shared/video-ownership/index.ts b/client/src/app/shared/video-ownership/index.ts deleted file mode 100644 index fe8902ee2..000000000 --- a/client/src/app/shared/video-ownership/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './video-ownership.service' diff --git a/client/src/app/shared/video/sort-field.type.ts b/client/src/app/shared/video/sort-field.type.ts deleted file mode 100644 index 65b24d946..000000000 --- a/client/src/app/shared/video/sort-field.type.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type VideoSortField = 'name' | '-name' - | 'duration' | '-duration' - | 'publishedAt' | '-publishedAt' - | 'createdAt' | '-createdAt' - | 'views' | '-views' - | 'likes' | '-likes' - | 'trending' | '-trending' - -export type CommentSortField = 'createdAt' | '-createdAt' - | 'totalReplies' | '-totalReplies' diff --git a/client/src/app/shared/i18n/i18n-primeng-calendar.ts b/client/src/app/videos/+video-edit/shared/i18n-primeng-calendar.service.ts similarity index 100% rename from client/src/app/shared/i18n/i18n-primeng-calendar.ts rename to client/src/app/videos/+video-edit/shared/i18n-primeng-calendar.service.ts diff --git a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts index 9856aac9e..a90d04ce8 100644 --- a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts @@ -1,11 +1,9 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' -import { FormReactive } from '@app/shared' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { VideoCaptionsValidatorsService } from '@app/shared/forms/form-validators/video-captions-validators.service' import { ServerService } from '@app/core' -import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' +import { FormReactive, FormValidatorService, VideoCaptionsValidatorsService } from '@app/shared/shared-forms' +import { VideoCaptionEdit } from '@app/shared/shared-main' import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' -import { ServerConfig, VideoConstant } from '../../../../../../shared' +import { ServerConfig, VideoConstant } from '@shared/models' @Component({ selector: 'my-video-caption-add-modal', diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts index 15073fc44..239e453ad 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts @@ -1,19 +1,13 @@ +import { map } from 'rxjs/operators' import { Component, Input, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' import { FormArray, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms' -import { ActivatedRoute, Router } from '@angular/router' -import { FormReactiveValidationMessages, VideoValidatorsService } from '@app/shared' -import { Notifier } from '@app/core' -import { ServerService } from '../../../core/server' -import { VideoEdit } from '../../../shared/video/video-edit.model' -import { map } from 'rxjs/operators' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { I18nPrimengCalendarService } from '@app/shared/i18n/i18n-primeng-calendar' -import { VideoCaptionService } from '@app/shared/video-caption' -import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component' -import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' -import { removeElementFromArray } from '@app/shared/misc/utils' -import { ServerConfig, VideoConstant, VideoPrivacy } from '../../../../../../shared' -import { VideoService } from '@app/shared/video/video.service' +import { ServerService } from '@app/core' +import { removeElementFromArray } from '@app/helpers' +import { FormReactiveValidationMessages, FormValidatorService, VideoValidatorsService } from '@app/shared/shared-forms' +import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main' +import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' +import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service' +import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' @Component({ selector: 'my-video-edit', @@ -60,11 +54,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { constructor ( private formValidatorService: FormValidatorService, private videoValidatorsService: VideoValidatorsService, - private videoCaptionService: VideoCaptionService, private videoService: VideoService, - private route: ActivatedRoute, - private router: Router, - private notifier: Notifier, private serverService: ServerService, private i18nPrimengCalendarService: I18nPrimengCalendarService, private ngZone: NgZone diff --git a/client/src/app/videos/+video-edit/shared/video-edit.module.ts b/client/src/app/videos/+video-edit/shared/video-edit.module.ts index 1357d607c..96061a300 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.module.ts +++ b/client/src/app/videos/+video-edit/shared/video-edit.module.ts @@ -1,16 +1,20 @@ -import { NgModule } from '@angular/core' import { TagInputModule } from 'ngx-chips' -import { SharedModule } from '../../../shared/' -import { VideoEditComponent } from './video-edit.component' import { CalendarModule } from 'primeng/calendar' +import { NgModule } from '@angular/core' +import { SharedFormModule } from '@app/shared/shared-forms' +import { SharedGlobalIconModule } from '@app/shared/shared-icons' +import { SharedMainModule } from '@app/shared/shared-main' import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' +import { VideoEditComponent } from './video-edit.component' @NgModule({ imports: [ TagInputModule, CalendarModule, - SharedModule + SharedMainModule, + SharedFormModule, + SharedGlobalIconModule ], declarations: [ @@ -22,6 +26,10 @@ import { VideoCaptionAddModalComponent } from './video-caption-add-modal.compone TagInputModule, CalendarModule, + SharedMainModule, + SharedFormModule, + SharedGlobalIconModule, + VideoEditComponent ], diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index 4d0b0b080..5b453a1d9 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts @@ -1,17 +1,13 @@ import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' import { Router } from '@angular/router' -import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' -import { AuthService, Notifier, ServerService } from '../../../core' -import { VideoService } from '../../../shared/video/video.service' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { LoadingBarService } from '@ngx-loading-bar/core' +import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@app/core' +import { scrollToTop } from '@app/helpers' +import { FormValidatorService } from '@app/shared/shared-forms' +import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send' -import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' -import { VideoEdit } from '@app/shared/video/video-edit.model' -import { FormValidatorService } from '@app/shared' -import { VideoCaptionService } from '@app/shared/video-caption' -import { VideoImportService } from '@app/shared/video-import' -import { scrollToTop } from '@app/shared/misc/utils' +import { LoadingBarService } from '@ngx-loading-bar/core' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoPrivacy, VideoUpdate } from '@shared/models' @Component({ selector: 'my-video-import-torrent', diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts index 213c42333..d0bd1f54d 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts @@ -1,18 +1,14 @@ +import { map, switchMap } from 'rxjs/operators' import { Component, EventEmitter, OnInit, Output } from '@angular/core' import { Router } from '@angular/router' -import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' -import { AuthService, Notifier, ServerService } from '../../../core' -import { VideoService } from '../../../shared/video/video.service' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { LoadingBarService } from '@ngx-loading-bar/core' +import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@app/core' +import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers' +import { FormValidatorService } from '@app/shared/shared-forms' +import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send' -import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' -import { VideoEdit } from '@app/shared/video/video-edit.model' -import { FormValidatorService } from '@app/shared' -import { VideoCaptionService } from '@app/shared/video-caption' -import { VideoImportService } from '@app/shared/video-import' -import { scrollToTop, getAbsoluteAPIUrl } from '@app/shared/misc/utils' -import { switchMap, map } from 'rxjs/operators' +import { LoadingBarService } from '@ngx-loading-bar/core' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoPrivacy, VideoUpdate } from '@shared/models' @Component({ selector: 'my-video-import-url', diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts index b32f16950..94479321d 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts @@ -1,15 +1,11 @@ +import { catchError, switchMap, tap } from 'rxjs/operators' import { EventEmitter, OnInit } from '@angular/core' +import { AuthService, CanComponentDeactivateResult, Notifier, ServerService } from '@app/core' +import { populateAsyncUserVideoChannels } from '@app/helpers' +import { FormReactive } from '@app/shared/shared-forms' +import { VideoCaptionEdit, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' import { LoadingBarService } from '@ngx-loading-bar/core' -import { AuthService, Notifier, ServerService } from '@app/core' -import { catchError, switchMap, tap } from 'rxjs/operators' -import { FormReactive } from '@app/shared' -import { ServerConfig, VideoConstant, VideoPrivacy } from '../../../../../../shared' -import { VideoService } from '@app/shared/video/video.service' -import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' -import { VideoCaptionService } from '@app/shared/video-caption' -import { VideoEdit } from '@app/shared/video/video-edit.model' -import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' -import { CanComponentDeactivateResult } from '@app/shared/guards/can-deactivate-guard.service' +import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' export abstract class VideoSend extends FormReactive implements OnInit { userVideoChannels: { id: number, label: string, support: string }[] = [] diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts index 9ce3fbc6d..eb7ac32ae 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts @@ -1,19 +1,16 @@ +import { BytesPipe } from 'ngx-pipes' +import { Subscription } from 'rxjs' import { HttpEventType, HttpResponse } from '@angular/common/http' import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' import { Router } from '@angular/router' +import { AuthService, CanComponentDeactivate, Notifier, ServerService, UserService } from '@app/core' +import { scrollToTop } from '@app/helpers' +import { FormValidatorService } from '@app/shared/shared-forms' +import { VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' +import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send' import { LoadingBarService } from '@ngx-loading-bar/core' -import { BytesPipe } from 'ngx-pipes' -import { Subscription } from 'rxjs' -import { VideoPrivacy } from '../../../../../../shared/models/videos' -import { AuthService, Notifier, ServerService } from '../../../core' -import { VideoEdit } from '../../../shared/video/video-edit.model' -import { VideoService } from '../../../shared/video/video.service' import { I18n } from '@ngx-translate/i18n-polyfill' -import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send' -import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' -import { FormValidatorService, UserService } from '@app/shared' -import { VideoCaptionService } from '@app/shared/video-caption' -import { scrollToTop } from '@app/shared/misc/utils' +import { VideoPrivacy } from '@shared/models' @Component({ selector: 'my-video-upload', diff --git a/client/src/app/videos/+video-edit/video-add-routing.module.ts b/client/src/app/videos/+video-edit/video-add-routing.module.ts index e0fef7158..9ff66bea0 100644 --- a/client/src/app/videos/+video-edit/video-add-routing.module.ts +++ b/client/src/app/videos/+video-edit/video-add-routing.module.ts @@ -1,10 +1,7 @@ import { NgModule } from '@angular/core' import { RouterModule, Routes } from '@angular/router' - +import { CanDeactivateGuard, LoginGuard } from '@app/core' import { MetaGuard } from '@ngx-meta/core' - -import { LoginGuard } from '../../core' -import { CanDeactivateGuard } from '../../shared/guards/can-deactivate-guard.service' import { VideoAddComponent } from './video-add.component' const videoAddRoutes: Routes = [ diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts index 30ab08ea0..5bd768809 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts @@ -1,10 +1,9 @@ import { Component, HostListener, OnInit, ViewChild } from '@angular/core' -import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' -import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component' -import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component' -import { AuthService, ServerService } from '@app/core' -import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component' +import { AuthService, CanComponentDeactivate, ServerService } from '@app/core' import { ServerConfig } from '@shared/models' +import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component' +import { VideoImportUrlComponent } from './video-add-components/video-import-url.component' +import { VideoUploadComponent } from './video-add-components/video-upload.component' @Component({ selector: 'my-videos-add', diff --git a/client/src/app/videos/+video-edit/video-add.module.ts b/client/src/app/videos/+video-edit/video-add.module.ts index b8f5a9a47..477c1cf5e 100644 --- a/client/src/app/videos/+video-edit/video-add.module.ts +++ b/client/src/app/videos/+video-edit/video-add.module.ts @@ -1,20 +1,20 @@ import { NgModule } from '@angular/core' -import { SharedModule } from '../../shared' +import { CanDeactivateGuard } from '@app/core' import { VideoEditModule } from './shared/video-edit.module' +import { DragDropDirective } from './video-add-components/drag-drop.directive' +import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component' +import { VideoImportUrlComponent } from './video-add-components/video-import-url.component' +import { VideoUploadComponent } from './video-add-components/video-upload.component' import { VideoAddRoutingModule } from './video-add-routing.module' import { VideoAddComponent } from './video-add.component' -import { DragDropDirective } from './video-add-components/drag-drop.directive' -import { CanDeactivateGuard } from '../../shared/guards/can-deactivate-guard.service' -import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component' -import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component' -import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component' @NgModule({ imports: [ VideoAddRoutingModule, - VideoEditModule, - SharedModule + + VideoEditModule ], + declarations: [ VideoAddComponent, VideoUploadComponent, @@ -22,10 +22,9 @@ import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-c VideoImportTorrentComponent, DragDropDirective ], - exports: [ - VideoAddComponent, - DragDropDirective - ], + + exports: [ ], + providers: [ CanDeactivateGuard ] diff --git a/client/src/app/videos/+video-edit/video-update-routing.module.ts b/client/src/app/videos/+video-edit/video-update-routing.module.ts index 564b8fb45..a04351b05 100644 --- a/client/src/app/videos/+video-edit/video-update-routing.module.ts +++ b/client/src/app/videos/+video-edit/video-update-routing.module.ts @@ -1,12 +1,9 @@ import { NgModule } from '@angular/core' import { RouterModule, Routes } from '@angular/router' - +import { CanDeactivateGuard, LoginGuard } from '@app/core' import { MetaGuard } from '@ngx-meta/core' - -import { LoginGuard } from '../../core' import { VideoUpdateComponent } from './video-update.component' -import { VideoUpdateResolver } from '@app/videos/+video-edit/video-update.resolver' -import { CanDeactivateGuard } from '@app/shared/guards/can-deactivate-guard.service' +import { VideoUpdateResolver } from './video-update.resolver' const videoUpdateRoutes: Routes = [ { diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts index 20a607134..7bd6eb553 100644 --- a/client/src/app/videos/+video-edit/video-update.component.ts +++ b/client/src/app/videos/+video-edit/video-update.component.ts @@ -1,17 +1,11 @@ import { map, switchMap } from 'rxjs/operators' import { Component, HostListener, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { LoadingBarService } from '@ngx-loading-bar/core' import { Notifier } from '@app/core' -import { ServerService } from '../../core' -import { FormReactive } from '../../shared' -import { VideoEdit } from '../../shared/video/video-edit.model' -import { VideoService } from '../../shared/video/video.service' +import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' +import { VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main' +import { LoadingBarService } from '@ngx-loading-bar/core' import { I18n } from '@ngx-translate/i18n-polyfill' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { VideoCaptionService } from '@app/shared/video-caption' -import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' -import { VideoDetails } from '@app/shared/video/video-details.model' import { VideoPrivacy } from '@shared/models' @Component({ diff --git a/client/src/app/videos/+video-edit/video-update.module.ts b/client/src/app/videos/+video-edit/video-update.module.ts index d60aa699f..322c69629 100644 --- a/client/src/app/videos/+video-edit/video-update.module.ts +++ b/client/src/app/videos/+video-edit/video-update.module.ts @@ -1,25 +1,22 @@ import { NgModule } from '@angular/core' -import { SharedModule } from '../../shared' +import { CanDeactivateGuard } from '@app/core' +import { VideoUpdateResolver } from '@app/videos/+video-edit/video-update.resolver' import { VideoEditModule } from './shared/video-edit.module' import { VideoUpdateRoutingModule } from './video-update-routing.module' import { VideoUpdateComponent } from './video-update.component' -import { VideoUpdateResolver } from '@app/videos/+video-edit/video-update.resolver' -import { CanDeactivateGuard } from '@app/shared/guards/can-deactivate-guard.service' @NgModule({ imports: [ VideoUpdateRoutingModule, - VideoEditModule, - SharedModule + + VideoEditModule ], declarations: [ VideoUpdateComponent ], - exports: [ - VideoUpdateComponent - ], + exports: [ ], providers: [ VideoUpdateResolver, diff --git a/client/src/app/videos/+video-edit/video-update.resolver.ts b/client/src/app/videos/+video-edit/video-update.resolver.ts index 4ac517d96..30bcf4d74 100644 --- a/client/src/app/videos/+video-edit/video-update.resolver.ts +++ b/client/src/app/videos/+video-edit/video-update.resolver.ts @@ -1,10 +1,8 @@ +import { forkJoin } from 'rxjs' +import { map, switchMap } from 'rxjs/operators' import { Injectable } from '@angular/core' -import { VideoService } from '@app/shared/video/video.service' import { ActivatedRouteSnapshot, Resolve } from '@angular/router' -import { map, switchMap } from 'rxjs/operators' -import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' -import { VideoCaptionService } from '@app/shared/video-caption' -import { forkJoin } from 'rxjs' +import { VideoCaptionService, VideoChannelService, VideoService } from '@app/shared/shared-main' @Injectable() export class VideoUpdateResolver implements Resolve { diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts index e1a8f6260..79505c779 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts @@ -1,16 +1,13 @@ +import { Observable } from 'rxjs' import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' import { Router } from '@angular/router' -import { Notifier } from '@app/core' -import { Observable } from 'rxjs' -import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' -import { FormReactive } from '../../../shared' -import { User } from '../../../shared/users' -import { Video } from '../../../shared/video/video.model' +import { Notifier, User } from '@app/core' +import { FormReactive, FormValidatorService, VideoCommentValidatorsService } from '@app/shared/shared-forms' +import { Video } from '@app/shared/shared-main' +import { NgbModal } from '@ng-bootstrap/ng-bootstrap' +import { VideoCommentCreate } from '@shared/models' import { VideoComment } from './video-comment.model' import { VideoCommentService } from './video-comment.service' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { VideoCommentValidatorsService } from '@app/shared/forms/form-validators/video-comment-validators.service' -import { NgbModal } from '@ng-bootstrap/ng-bootstrap' @Component({ selector: 'my-video-comment-add', diff --git a/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts b/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts index 1566d7369..7c2aaeadd 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts @@ -1,5 +1,5 @@ -import { VideoCommentThreadTree as VideoCommentThreadTreeServerModel } from '../../../../../../shared/models/videos/video-comment.model' -import { VideoComment } from '@app/videos/+video-watch/comment/video-comment.model' +import { VideoCommentThreadTree as VideoCommentThreadTreeServerModel } from '@shared/models' +import { VideoComment } from './video-comment.model' export class VideoCommentThreadTree implements VideoCommentThreadTreeServerModel { comment: VideoComment diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.ts b/client/src/app/videos/+video-watch/comment/video-comment.component.ts index 868addd58..27846c1ad 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.component.ts @@ -1,15 +1,10 @@ import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' -import { User, UserRight } from '../../../../../../shared/models/users' +import { MarkdownService, Notifier, UserService } from '@app/core' import { AuthService } from '@app/core/auth' -import { AccountService } from '@app/shared/account/account.service' -import { Video } from '@app/shared/video/video.model' +import { Account, Actor, Video } from '@app/shared/shared-main' +import { User, UserRight } from '@shared/models' +import { VideoCommentThreadTree } from './video-comment-thread-tree.model' import { VideoComment } from './video-comment.model' -import { MarkdownService } from '@app/shared/renderer' -import { Account } from '@app/shared/account/account.model' -import { Notifier } from '@app/core' -import { UserService } from '@app/shared' -import { Actor } from '@app/shared/actor/actor.model' -import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model' @Component({ selector: 'my-video-comment', @@ -40,7 +35,6 @@ export class VideoCommentComponent implements OnInit, OnChanges { constructor ( private markdownService: MarkdownService, private authService: AuthService, - private accountService: AccountService, private userService: UserService, private notifier: Notifier ) {} diff --git a/client/src/app/videos/+video-watch/comment/video-comment.model.ts b/client/src/app/videos/+video-watch/comment/video-comment.model.ts index 171fc4acc..e85443196 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.model.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.model.ts @@ -1,7 +1,6 @@ -import { Account as AccountInterface } from '../../../../../../shared/models/actors' -import { VideoComment as VideoCommentServerModel, VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' -import { Actor } from '@app/shared/actor/actor.model' -import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' +import { getAbsoluteAPIUrl } from '@app/helpers' +import { Actor } from '@app/shared/shared-main' +import { Account as AccountInterface, VideoComment as VideoCommentServerModel } from '@shared/models' export class VideoComment implements VideoCommentServerModel { id: number diff --git a/client/src/app/videos/+video-watch/comment/video-comment.service.ts b/client/src/app/videos/+video-watch/comment/video-comment.service.ts index 0b0715390..a73fb9ca8 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.service.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.service.ts @@ -1,20 +1,19 @@ +import { Observable } from 'rxjs' import { catchError, map } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' -import { objectLineFeedToHtml } from '@app/shared/misc/utils' -import { Observable } from 'rxjs' -import { FeedFormat, ResultList } from '../../../../../../shared/models' +import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' +import { objectLineFeedToHtml } from '@app/helpers' import { + FeedFormat, + ResultList, VideoComment as VideoCommentServerModel, VideoCommentCreate, VideoCommentThreadTree as VideoCommentThreadTreeServerModel -} from '../../../../../../shared/models/videos/video-comment.model' +} from '@shared/models' import { environment } from '../../../../environments/environment' -import { RestExtractor, RestService } from '../../../shared/rest' -import { ComponentPaginationLight } from '../../../shared/rest/component-pagination.model' -import { CommentSortField } from '../../../shared/video/sort-field.type' +import { VideoCommentThreadTree } from './video-comment-thread-tree.model' import { VideoComment } from './video-comment.model' -import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model' @Injectable() export class VideoCommentService { @@ -52,7 +51,7 @@ export class VideoCommentService { getVideoCommentThreads (parameters: { videoId: number | string, componentPagination: ComponentPaginationLight, - sort: CommentSortField + sort: string }): Observable> { const { videoId, componentPagination, sort } = parameters diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts index bba9f1372..df0018ec6 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts @@ -1,18 +1,13 @@ +import { Subject, Subscription } from 'rxjs' import { Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core' import { ActivatedRoute } from '@angular/router' -import { ConfirmService, Notifier } from '@app/core' -import { Subject, Subscription } from 'rxjs' -import { AuthService } from '../../../core/auth' -import { ComponentPagination, hasMoreItems } from '../../../shared/rest/component-pagination.model' -import { User } from '../../../shared/users' -import { CommentSortField } from '../../../shared/video/sort-field.type' -import { VideoDetails } from '../../../shared/video/video-details.model' +import { AuthService, ComponentPagination, ConfirmService, hasMoreItems, Notifier, User } from '@app/core' +import { HooksService } from '@app/core/plugins/hooks.service' +import { Syndication, VideoDetails } from '@app/shared/shared-main' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoCommentThreadTree } from './video-comment-thread-tree.model' import { VideoComment } from './video-comment.model' import { VideoCommentService } from './video-comment.service' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { Syndication } from '@app/shared/video/syndication.model' -import { HooksService } from '@app/core/plugins/hooks.service' -import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model' @Component({ selector: 'my-video-comments', @@ -28,7 +23,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { comments: VideoComment[] = [] highlightedThread: VideoComment - sort: CommentSortField = '-createdAt' + sort = '-createdAt' componentPagination: ComponentPagination = { currentPage: 1, itemsPerPage: 10, @@ -154,7 +149,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { this.viewReplies(commentTree.comment.id) } - handleSortChange (sort: CommentSortField) { + handleSortChange (sort: string) { if (this.sort === sort) return this.sort = sort diff --git a/client/src/app/videos/+video-watch/modal/video-share.component.ts b/client/src/app/videos/+video-watch/modal/video-share.component.ts index 3550556a0..b42b775c1 100644 --- a/client/src/app/videos/+video-watch/modal/video-share.component.ts +++ b/client/src/app/videos/+video-watch/modal/video-share.component.ts @@ -1,9 +1,9 @@ import { Component, ElementRef, Input, ViewChild } from '@angular/core' -import { VideoDetails } from '../../../shared/video/video-details.model' import { buildVideoEmbed, buildVideoLink } from '../../../../assets/player/utils' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { VideoCaption } from '@shared/models' -import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' +import { VideoDetails } from '@app/shared/shared-main' +import { VideoPlaylist } from '@app/shared/shared-video-playlist' type Customizations = { startAtCheckbox: boolean @@ -40,13 +40,9 @@ export class VideoShareComponent { isAdvancedCustomizationCollapsed = true includeVideoInPlaylist = false - private currentVideoTimestamp: number - constructor (private modalService: NgbModal) { } show (currentVideoTimestamp?: number) { - this.currentVideoTimestamp = currentVideoTimestamp - let subtitle: string if (this.videoCaptions.length !== 0) { subtitle = this.videoCaptions[0].language.id diff --git a/client/src/app/videos/+video-watch/modal/video-support.component.ts b/client/src/app/videos/+video-watch/modal/video-support.component.ts index 0058172f2..48d5f2948 100644 --- a/client/src/app/videos/+video-watch/modal/video-support.component.ts +++ b/client/src/app/videos/+video-watch/modal/video-support.component.ts @@ -1,7 +1,7 @@ import { Component, Input, ViewChild } from '@angular/core' -import { VideoDetails } from '../../../shared/video/video-details.model' +import { MarkdownService } from '@app/core' +import { VideoDetails } from '@app/shared/shared-main' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { MarkdownService } from '@app/shared/renderer' @Component({ selector: 'my-video-support', diff --git a/client/src/app/shared/angular/timestamp-route-transformer.directive.ts b/client/src/app/videos/+video-watch/timestamp-route-transformer.directive.ts similarity index 100% rename from client/src/app/shared/angular/timestamp-route-transformer.directive.ts rename to client/src/app/videos/+video-watch/timestamp-route-transformer.directive.ts diff --git a/client/src/app/shared/angular/video-duration-formatter.pipe.ts b/client/src/app/videos/+video-watch/video-duration-formatter.pipe.ts similarity index 100% rename from client/src/app/shared/angular/video-duration-formatter.pipe.ts rename to client/src/app/videos/+video-watch/video-duration-formatter.pipe.ts diff --git a/client/src/app/videos/+video-watch/video-watch-playlist.component.ts b/client/src/app/videos/+video-watch/video-watch-playlist.component.ts index 827c34d41..2c21be643 100644 --- a/client/src/app/videos/+video-watch/video-watch-playlist.component.ts +++ b/client/src/app/videos/+video-watch/video-watch-playlist.component.ts @@ -1,15 +1,10 @@ import { Component, Input } from '@angular/core' -import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' -import { ComponentPagination } from '@app/shared/rest/component-pagination.model' -import { VideoDetails, VideoPlaylistPrivacy } from '@shared/models' import { Router } from '@angular/router' -import { UserService } from '@app/shared' -import { AuthService, Notifier } from '@app/core' -import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' -import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model' -import { peertubeLocalStorage, peertubeSessionStorage } from '@app/shared/misc/peertube-web-storage' +import { AuthService, ComponentPagination, LocalStorageService, Notifier, SessionStorageService, UserService } from '@app/core' +import { peertubeLocalStorage, peertubeSessionStorage } from '@app/helpers/peertube-web-storage' +import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist' import { I18n } from '@ngx-translate/i18n-polyfill' -import { SessionStorageService, LocalStorageService } from '@app/shared/misc/storage.service' +import { VideoDetails, VideoPlaylistPrivacy } from '@shared/models' @Component({ selector: 'my-video-watch-playlist', diff --git a/client/src/app/videos/+video-watch/video-watch-routing.module.ts b/client/src/app/videos/+video-watch/video-watch-routing.module.ts index ce9250bdc..d8fecb87d 100644 --- a/client/src/app/videos/+video-watch/video-watch-routing.module.ts +++ b/client/src/app/videos/+video-watch/video-watch-routing.module.ts @@ -1,8 +1,6 @@ import { NgModule } from '@angular/core' import { RouterModule, Routes } from '@angular/router' - import { MetaGuard } from '@ngx-meta/core' - import { VideoWatchComponent } from './video-watch.component' const videoWatchRoutes: Routes = [ diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index df0c1058c..5b0b34c80 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -1,41 +1,33 @@ +import { Hotkey, HotkeysService } from 'angular2-hotkeys' +import { forkJoin, Observable, Subscription } from 'rxjs' import { catchError } from 'rxjs/operators' +import { PlatformLocation } from '@angular/common' import { ChangeDetectorRef, Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' +import { AuthService, AuthUser, ConfirmService, MarkdownService, Notifier, RestExtractor, ServerService, UserService } from '@app/core' +import { HooksService } from '@app/core/plugins/hooks.service' import { RedirectService } from '@app/core/routing/redirect.service' -import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' -import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component' +import { isXPercentInViewport, peertubeLocalStorage, scrollToTop } from '@app/helpers' +import { Video, VideoCaptionService, VideoDetails, VideoService } from '@app/shared/shared-main' +import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' +import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' import { MetaService } from '@ngx-meta/core' -import { AuthUser, Notifier, ServerService } from '@app/core' -import { forkJoin, Observable, Subscription } from 'rxjs' -import { Hotkey, HotkeysService } from 'angular2-hotkeys' -import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared' -import { AuthService, ConfirmService } from '../../core' -import { RestExtractor, UserService } from '../../shared' -import { VideoDetails } from '../../shared/video/video-details.model' -import { VideoService } from '../../shared/video/video.service' -import { VideoShareComponent } from './modal/video-share.component' -import { SubscribeButtonComponent } from '@app/shared/user-subscription/subscribe-button.component' import { I18n } from '@ngx-translate/i18n-polyfill' -import { environment } from '../../../environments/environment' -import { VideoCaptionService } from '@app/shared/video-caption' -import { MarkdownService } from '@app/shared/renderer' +import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models' +import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage' import { - videojs, CustomizationOptions, P2PMediaLoaderOptions, PeertubePlayerManager, PeertubePlayerManagerOptions, - PlayerMode + PlayerMode, + videojs } from '../../../assets/player/peertube-player-manager' -import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' -import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' -import { Video } from '@app/shared/video/video.model' import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils' -import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component' -import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage' -import { HooksService } from '@app/core/plugins/hooks.service' -import { PlatformLocation } from '@angular/common' -import { scrollToTop, isXPercentInViewport } from '@app/shared/misc/utils' +import { environment } from '../../../environments/environment' +import { VideoShareComponent } from './modal/video-share.component' +import { VideoSupportComponent } from './modal/video-support.component' +import { VideoWatchPlaylistComponent } from './video-watch-playlist.component' @Component({ selector: 'my-video-watch', diff --git a/client/src/app/videos/+video-watch/video-watch.module.ts b/client/src/app/videos/+video-watch/video-watch.module.ts index 9b445269d..a1c54f065 100644 --- a/client/src/app/videos/+video-watch/video-watch.module.ts +++ b/client/src/app/videos/+video-watch/video-watch.module.ts @@ -1,26 +1,40 @@ +import { QRCodeModule } from 'angularx-qrcode' import { NgModule } from '@angular/core' -import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component' -import { SharedModule } from '../../shared' +import { SharedFormModule } from '@app/shared/shared-forms' +import { SharedGlobalIconModule } from '@app/shared/shared-icons' +import { SharedMainModule } from '@app/shared/shared-main' +import { SharedModerationModule } from '@app/shared/shared-moderation' +import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription' +import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' +import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist' +import { RecommendationsModule } from '@app/videos/recommendations/recommendations.module' +import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap' import { VideoCommentAddComponent } from './comment/video-comment-add.component' import { VideoCommentComponent } from './comment/video-comment.component' import { VideoCommentService } from './comment/video-comment.service' import { VideoCommentsComponent } from './comment/video-comments.component' import { VideoShareComponent } from './modal/video-share.component' +import { VideoSupportComponent } from './modal/video-support.component' +import { TimestampRouteTransformerDirective } from './timestamp-route-transformer.directive' +import { VideoDurationPipe } from './video-duration-formatter.pipe' +import { VideoWatchPlaylistComponent } from './video-watch-playlist.component' import { VideoWatchRoutingModule } from './video-watch-routing.module' import { VideoWatchComponent } from './video-watch.component' -import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap' -import { RecommendationsModule } from '@app/videos/recommendations/recommendations.module' -import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component' -import { QRCodeModule } from 'angularx-qrcode' -import { TimestampRouteTransformerDirective } from '@app/shared/angular/timestamp-route-transformer.directive' @NgModule({ imports: [ VideoWatchRoutingModule, - SharedModule, NgbTooltipModule, QRCodeModule, - RecommendationsModule + RecommendationsModule, + + SharedMainModule, + SharedFormModule, + SharedVideoMiniatureModule, + SharedVideoPlaylistModule, + SharedUserSubscriptionModule, + SharedModerationModule, + SharedGlobalIconModule ], declarations: [ @@ -33,6 +47,8 @@ import { TimestampRouteTransformerDirective } from '@app/shared/angular/timestam VideoCommentAddComponent, VideoCommentComponent, + TimestampRouteTransformerDirective, + VideoDurationPipe, TimestampRouteTransformerDirective ], diff --git a/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts b/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts index 0abf938b7..a376453bf 100644 --- a/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts +++ b/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts @@ -1,15 +1,13 @@ import { Observable, of } from 'rxjs' import { map, switchMap } from 'rxjs/operators' import { Injectable } from '@angular/core' -import { ServerService } from '@app/core' +import { ServerService, UserService } from '@app/core' import { AdvancedSearch } from '@app/search/advanced-search.model' import { SearchService } from '@app/search/search.service' -import { UserService } from '@app/shared' -import { RecommendationInfo } from '@app/shared/video/recommendation-info.model' -import { Video } from '@app/shared/video/video.model' -import { VideoService } from '@app/shared/video/video.service' -import { RecommendationService } from '@app/videos/recommendations/recommendations.service' +import { Video, VideoService } from '@app/shared/shared-main' import { ServerConfig } from '@shared/models' +import { RecommendationInfo } from './recommendation-info.model' +import { RecommendationService } from './recommendations.service' /** * Provides "recommendations" by providing the most recently uploaded videos. diff --git a/client/src/app/shared/video/recommendation-info.model.ts b/client/src/app/videos/recommendations/recommendation-info.model.ts similarity index 100% rename from client/src/app/shared/video/recommendation-info.model.ts rename to client/src/app/videos/recommendations/recommendation-info.model.ts diff --git a/client/src/app/videos/recommendations/recommendations.module.ts b/client/src/app/videos/recommendations/recommendations.module.ts index 3e279cc29..03cc272ca 100644 --- a/client/src/app/videos/recommendations/recommendations.module.ts +++ b/client/src/app/videos/recommendations/recommendations.module.ts @@ -1,16 +1,21 @@ -import { NgModule } from '@angular/core' import { InputSwitchModule } from 'primeng/inputswitch' -import { RecommendedVideosComponent } from '@app/videos/recommendations/recommended-videos.component' -import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store' import { CommonModule } from '@angular/common' -import { SharedModule } from '@app/shared' -import { RecentVideosRecommendationService } from '@app/videos/recommendations/recent-videos-recommendation.service' +import { NgModule } from '@angular/core' +import { SharedMainModule } from '@app/shared/shared-main' +import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' +import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist' +import { RecentVideosRecommendationService } from './recent-videos-recommendation.service' +import { RecommendedVideosComponent } from './recommended-videos.component' +import { RecommendedVideosStore } from './recommended-videos.store' @NgModule({ imports: [ + CommonModule, InputSwitchModule, - SharedModule, - CommonModule + + SharedMainModule, + SharedVideoPlaylistModule, + SharedVideoMiniatureModule ], declarations: [ RecommendedVideosComponent diff --git a/client/src/app/videos/recommendations/recommendations.service.ts b/client/src/app/videos/recommendations/recommendations.service.ts index a547e289d..1d79d35f6 100644 --- a/client/src/app/videos/recommendations/recommendations.service.ts +++ b/client/src/app/videos/recommendations/recommendations.service.ts @@ -1,6 +1,6 @@ -import { Video } from '@app/shared/video/video.model' -import { RecommendationInfo } from '@app/shared/video/recommendation-info.model' import { Observable } from 'rxjs' +import { Video } from '@app/shared/shared-main' +import { RecommendationInfo } from './recommendation-info.model' export interface RecommendationService { getRecommendations (recommendation: RecommendationInfo): Observable diff --git a/client/src/app/videos/recommendations/recommended-videos.component.ts b/client/src/app/videos/recommendations/recommended-videos.component.ts index a6f3bce3d..016975341 100644 --- a/client/src/app/videos/recommendations/recommended-videos.component.ts +++ b/client/src/app/videos/recommendations/recommended-videos.component.ts @@ -1,15 +1,12 @@ import { Observable } from 'rxjs' import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' -import { AuthService, Notifier } from '@app/core' -import { User } from '@app/shared' -import { SessionStorageService } from '@app/shared/misc/storage.service' -import { UserService } from '@app/shared/users/user.service' -import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' -import { RecommendationInfo } from '@app/shared/video/recommendation-info.model' -import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.component' -import { Video } from '@app/shared/video/video.model' -import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store' +import { AuthService, Notifier, SessionStorageService, User, UserService } from '@app/core' +import { Video } from '@app/shared/shared-main' +import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature' +import { VideoPlaylist } from '@app/shared/shared-video-playlist' import { I18n } from '@ngx-translate/i18n-polyfill' +import { RecommendationInfo } from './recommendation-info.model' +import { RecommendedVideosStore } from './recommended-videos.store' @Component({ selector: 'my-recommended-videos', diff --git a/client/src/app/videos/recommendations/recommended-videos.store.ts b/client/src/app/videos/recommendations/recommended-videos.store.ts index 858ec3a27..8c3fb6480 100644 --- a/client/src/app/videos/recommendations/recommended-videos.store.ts +++ b/client/src/app/videos/recommendations/recommended-videos.store.ts @@ -1,10 +1,10 @@ -import { Inject, Injectable } from '@angular/core' import { Observable, ReplaySubject } from 'rxjs' -import { Video } from '@app/shared/video/video.model' -import { RecommendationInfo } from '@app/shared/video/recommendation-info.model' -import { RecentVideosRecommendationService } from '@app/videos/recommendations/recent-videos-recommendation.service' -import { RecommendationService } from '@app/videos/recommendations/recommendations.service' import { map, shareReplay, switchMap, take } from 'rxjs/operators' +import { Inject, Injectable } from '@angular/core' +import { Video } from '@app/shared/shared-main' +import { RecentVideosRecommendationService } from './recent-videos-recommendation.service' +import { RecommendationInfo } from './recommendation-info.model' +import { RecommendationService } from './recommendations.service' /** * This store is intended to provide data for the RecommendedVideosComponent. @@ -20,7 +20,7 @@ export class RecommendedVideosStore { ) { this.recommendations$ = this.requestsForLoad$$.pipe( switchMap(requestedRecommendation => { - return recommendations.getRecommendations(requestedRecommendation) + return this.recommendations.getRecommendations(requestedRecommendation) .pipe(take(1)) }), shareReplay() diff --git a/client/src/app/videos/video-list/index.ts b/client/src/app/videos/video-list/index.ts index b367110ae..af1bd58b7 100644 --- a/client/src/app/videos/video-list/index.ts +++ b/client/src/app/videos/video-list/index.ts @@ -1,3 +1,4 @@ +export * from './overview' export * from './video-local.component' export * from './video-recently-added.component' export * from './video-trending.component' diff --git a/client/src/app/videos/video-list/overview/index.ts b/client/src/app/videos/video-list/overview/index.ts new file mode 100644 index 000000000..e6cfa4802 --- /dev/null +++ b/client/src/app/videos/video-list/overview/index.ts @@ -0,0 +1,3 @@ +export * from './overview.service' +export * from './video-overview.component' +export * from './videos-overview.model' diff --git a/client/src/app/shared/overview/overview.service.ts b/client/src/app/videos/video-list/overview/overview.service.ts similarity index 83% rename from client/src/app/shared/overview/overview.service.ts rename to client/src/app/videos/video-list/overview/overview.service.ts index 6d8af8052..4458454d5 100644 --- a/client/src/app/shared/overview/overview.service.ts +++ b/client/src/app/videos/video-list/overview/overview.service.ts @@ -1,14 +1,13 @@ +import { forkJoin, Observable, of } from 'rxjs' import { catchError, map, switchMap, tap } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' -import { forkJoin, Observable, of } from 'rxjs' -import { VideosOverview as VideosOverviewServer, peertubeTranslate } from '../../../../../shared/models' -import { environment } from '../../../environments/environment' -import { RestExtractor } from '../rest/rest-extractor.service' -import { VideosOverview } from '@app/shared/overview/videos-overview.model' -import { VideoService } from '@app/shared/video/video.service' -import { ServerService } from '@app/core' -import { immutableAssign } from '@app/shared/misc/utils' +import { RestExtractor, ServerService } from '@app/core' +import { immutableAssign } from '@app/helpers' +import { VideoService } from '@app/shared/shared-main' +import { peertubeTranslate, VideosOverview as VideosOverviewServer } from '@shared/models' +import { environment } from '../../../../environments/environment' +import { VideosOverview } from './videos-overview.model' @Injectable() export class OverviewService { diff --git a/client/src/app/videos/video-list/video-overview.component.html b/client/src/app/videos/video-list/overview/video-overview.component.html similarity index 100% rename from client/src/app/videos/video-list/video-overview.component.html rename to client/src/app/videos/video-list/overview/video-overview.component.html diff --git a/client/src/app/videos/video-list/video-overview.component.scss b/client/src/app/videos/video-list/overview/video-overview.component.scss similarity index 100% rename from client/src/app/videos/video-list/video-overview.component.scss rename to client/src/app/videos/video-list/overview/video-overview.component.scss diff --git a/client/src/app/videos/video-list/video-overview.component.ts b/client/src/app/videos/video-list/overview/video-overview.component.ts similarity index 87% rename from client/src/app/videos/video-list/video-overview.component.ts rename to client/src/app/videos/video-list/overview/video-overview.component.ts index 8ff8400db..b3be1d7b5 100644 --- a/client/src/app/videos/video-list/video-overview.component.ts +++ b/client/src/app/videos/video-list/overview/video-overview.component.ts @@ -1,11 +1,9 @@ import { Subject } from 'rxjs' import { Component, OnInit } from '@angular/core' -import { Notifier } from '@app/core' -import { User, UserService } from '@app/shared' -import { ScreenService } from '@app/shared/misc/screen.service' -import { OverviewService } from '@app/shared/overview' -import { VideosOverview } from '@app/shared/overview/videos-overview.model' -import { Video } from '@app/shared/video/video.model' +import { Notifier, ScreenService, User, UserService } from '@app/core' +import { Video } from '@app/shared/shared-main' +import { OverviewService } from './overview.service' +import { VideosOverview } from './videos-overview.model' @Component({ selector: 'my-video-overview', diff --git a/client/src/app/shared/overview/videos-overview.model.ts b/client/src/app/videos/video-list/overview/videos-overview.model.ts similarity index 76% rename from client/src/app/shared/overview/videos-overview.model.ts rename to client/src/app/videos/video-list/overview/videos-overview.model.ts index 21abe1697..6765ad9b7 100644 --- a/client/src/app/shared/overview/videos-overview.model.ts +++ b/client/src/app/videos/video-list/overview/videos-overview.model.ts @@ -1,5 +1,5 @@ -import { VideoChannelSummary, VideoConstant, VideosOverview as VideosOverviewServer } from '../../../../../shared/models' -import { Video } from '@app/shared/video/video.model' +import { Video } from '@app/shared/shared-main' +import { VideoChannelSummary, VideoConstant, VideosOverview as VideosOverviewServer } from '@shared/models' export class VideosOverview implements VideosOverviewServer { channels: { diff --git a/client/src/app/videos/video-list/video-local.component.ts b/client/src/app/videos/video-list/video-local.component.ts index 960523cd7..b4c71ac49 100644 --- a/client/src/app/videos/video-list/video-local.component.ts +++ b/client/src/app/videos/video-list/video-local.component.ts @@ -1,23 +1,17 @@ import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { immutableAssign } from '@app/shared/misc/utils' -import { AuthService } from '../../core/auth' -import { AbstractVideoList } from '../../shared/video/abstract-video-list' -import { VideoSortField } from '../../shared/video/sort-field.type' -import { VideoService } from '../../shared/video/video.service' -import { VideoFilter } from '../../../../../shared/models/videos/video-query.type' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { ScreenService } from '@app/shared/misc/screen.service' -import { UserRight } from '../../../../../shared/models/users' -import { Notifier, ServerService } from '@app/core' +import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' import { HooksService } from '@app/core/plugins/hooks.service' -import { UserService } from '@app/shared' -import { LocalStorageService } from '@app/shared/misc/storage.service' +import { immutableAssign } from '@app/helpers' +import { VideoService } from '@app/shared/shared-main' +import { AbstractVideoList } from '@app/shared/shared-video-miniature' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { UserRight, VideoFilter, VideoSortField } from '@shared/models' @Component({ selector: 'my-videos-local', - styleUrls: [ '../../shared/video/abstract-video-list.scss' ], - templateUrl: '../../shared/video/abstract-video-list.html' + styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ], + templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html' }) export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy { titlePage: string diff --git a/client/src/app/videos/video-list/video-most-liked.component.ts b/client/src/app/videos/video-list/video-most-liked.component.ts index cc91a2330..ca14851bb 100644 --- a/client/src/app/videos/video-list/video-most-liked.component.ts +++ b/client/src/app/videos/video-list/video-most-liked.component.ts @@ -1,21 +1,17 @@ import { Component, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { immutableAssign } from '@app/shared/misc/utils' -import { AuthService } from '../../core/auth' -import { AbstractVideoList } from '../../shared/video/abstract-video-list' -import { VideoSortField } from '../../shared/video/sort-field.type' -import { VideoService } from '../../shared/video/video.service' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { ScreenService } from '@app/shared/misc/screen.service' -import { Notifier, ServerService } from '@app/core' +import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' import { HooksService } from '@app/core/plugins/hooks.service' -import { UserService } from '@app/shared' -import { LocalStorageService } from '@app/shared/misc/storage.service' +import { immutableAssign } from '@app/helpers' +import { VideoService } from '@app/shared/shared-main' +import { AbstractVideoList } from '@app/shared/shared-video-miniature' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoSortField } from '@shared/models' @Component({ selector: 'my-videos-most-liked', - styleUrls: [ '../../shared/video/abstract-video-list.scss' ], - templateUrl: '../../shared/video/abstract-video-list.html' + styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ], + templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html' }) export class VideoMostLikedComponent extends AbstractVideoList implements OnInit { titlePage: string diff --git a/client/src/app/videos/video-list/video-recently-added.component.ts b/client/src/app/videos/video-list/video-recently-added.component.ts index 9f57a61e3..c9395133f 100644 --- a/client/src/app/videos/video-list/video-recently-added.component.ts +++ b/client/src/app/videos/video-list/video-recently-added.component.ts @@ -1,21 +1,17 @@ import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { immutableAssign } from '@app/shared/misc/utils' -import { AuthService } from '../../core/auth' -import { AbstractVideoList } from '../../shared/video/abstract-video-list' -import { VideoSortField } from '../../shared/video/sort-field.type' -import { VideoService } from '../../shared/video/video.service' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { ScreenService } from '@app/shared/misc/screen.service' -import { Notifier, ServerService } from '@app/core' +import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' import { HooksService } from '@app/core/plugins/hooks.service' -import { UserService } from '@app/shared' -import { LocalStorageService } from '@app/shared/misc/storage.service' +import { immutableAssign } from '@app/helpers' +import { VideoService } from '@app/shared/shared-main' +import { AbstractVideoList } from '@app/shared/shared-video-miniature' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoSortField } from '@shared/models' @Component({ selector: 'my-videos-recently-added', - styleUrls: [ '../../shared/video/abstract-video-list.scss' ], - templateUrl: '../../shared/video/abstract-video-list.html' + styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ], + templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html' }) export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy { titlePage: string diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts index 62e0f4e69..10eab18de 100644 --- a/client/src/app/videos/video-list/video-trending.component.ts +++ b/client/src/app/videos/video-list/video-trending.component.ts @@ -1,21 +1,17 @@ import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { immutableAssign } from '@app/shared/misc/utils' -import { AuthService } from '../../core/auth' -import { AbstractVideoList } from '../../shared/video/abstract-video-list' -import { VideoSortField } from '../../shared/video/sort-field.type' -import { VideoService } from '../../shared/video/video.service' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { ScreenService } from '@app/shared/misc/screen.service' -import { Notifier, ServerService } from '@app/core' +import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' import { HooksService } from '@app/core/plugins/hooks.service' -import { UserService } from '@app/shared' -import { LocalStorageService } from '@app/shared/misc/storage.service' +import { immutableAssign } from '@app/helpers' +import { VideoService } from '@app/shared/shared-main' +import { AbstractVideoList } from '@app/shared/shared-video-miniature' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoSortField } from '@shared/models' @Component({ selector: 'my-videos-trending', - styleUrls: [ '../../shared/video/abstract-video-list.scss' ], - templateUrl: '../../shared/video/abstract-video-list.html' + styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ], + templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html' }) export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy { titlePage: string diff --git a/client/src/app/videos/video-list/video-user-subscriptions.component.ts b/client/src/app/videos/video-list/video-user-subscriptions.component.ts index 036fd8dcb..41ad9b277 100644 --- a/client/src/app/videos/video-list/video-user-subscriptions.component.ts +++ b/client/src/app/videos/video-list/video-user-subscriptions.component.ts @@ -1,22 +1,18 @@ import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { immutableAssign } from '@app/shared/misc/utils' -import { AuthService } from '../../core/auth' -import { AbstractVideoList } from '../../shared/video/abstract-video-list' -import { VideoSortField } from '../../shared/video/sort-field.type' -import { VideoService } from '../../shared/video/video.service' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { ScreenService } from '@app/shared/misc/screen.service' -import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' -import { Notifier, ServerService } from '@app/core' +import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' import { HooksService } from '@app/core/plugins/hooks.service' -import { UserService } from '@app/shared' -import { LocalStorageService } from '@app/shared/misc/storage.service' +import { immutableAssign } from '@app/helpers' +import { VideoService } from '@app/shared/shared-main' +import { UserSubscriptionService } from '@app/shared/shared-user-subscription' +import { AbstractVideoList, OwnerDisplayType } from '@app/shared/shared-video-miniature' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoSortField } from '@shared/models' @Component({ selector: 'my-videos-user-subscriptions', - styleUrls: [ '../../shared/video/abstract-video-list.scss' ], - templateUrl: '../../shared/video/abstract-video-list.html' + styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ], + templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html' }) export class VideoUserSubscriptionsComponent extends AbstractVideoList implements OnInit, OnDestroy { titlePage: string @@ -34,6 +30,7 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement protected userService: UserService, protected screenService: ScreenService, protected storageService: LocalStorageService, + private userSubscription: UserSubscriptionService, private videoService: VideoService, private hooks: HooksService ) { @@ -64,7 +61,7 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement } return this.hooks.wrapObsFun( - this.videoService.getUserSubscriptionVideos.bind(this.videoService), + this.userSubscription.getUserSubscriptionVideos.bind(this.userSubscription), params, 'common', 'filter:api.user-subscriptions-videos.videos.list.params', diff --git a/client/src/app/videos/videos-routing.module.ts b/client/src/app/videos/videos-routing.module.ts index 11a087d0a..16b65be63 100644 --- a/client/src/app/videos/videos-routing.module.ts +++ b/client/src/app/videos/videos-routing.module.ts @@ -6,8 +6,8 @@ import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.c import { VideoTrendingComponent } from './video-list/video-trending.component' import { VideoMostLikedComponent } from './video-list/video-most-liked.component' import { VideosComponent } from './videos.component' -import { VideoUserSubscriptionsComponent } from '@app/videos/video-list/video-user-subscriptions.component' -import { VideoOverviewComponent } from '@app/videos/video-list/video-overview.component' +import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' +import { VideoOverviewComponent } from './video-list/overview/video-overview.component' const videosRoutes: Routes = [ { diff --git a/client/src/app/videos/videos.module.ts b/client/src/app/videos/videos.module.ts index 95078a734..217e5bb50 100644 --- a/client/src/app/videos/videos.module.ts +++ b/client/src/app/videos/videos.module.ts @@ -1,18 +1,27 @@ import { NgModule } from '@angular/core' -import { VideoLocalComponent } from '@app/videos/video-list/video-local.component' -import { SharedModule } from '../shared' +import { SharedFormModule } from '@app/shared/shared-forms' +import { SharedGlobalIconModule } from '@app/shared/shared-icons' +import { SharedMainModule } from '@app/shared/shared-main' +import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription' +import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' +import { VideoOverviewComponent } from './video-list/overview/video-overview.component' +import { VideoLocalComponent } from './video-list/video-local.component' +import { VideoMostLikedComponent } from './video-list/video-most-liked.component' import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' import { VideoTrendingComponent } from './video-list/video-trending.component' -import { VideoMostLikedComponent } from './video-list/video-most-liked.component' +import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' import { VideosRoutingModule } from './videos-routing.module' import { VideosComponent } from './videos.component' -import { VideoUserSubscriptionsComponent } from '@app/videos/video-list/video-user-subscriptions.component' -import { VideoOverviewComponent } from '@app/videos/video-list/video-overview.component' @NgModule({ imports: [ VideosRoutingModule, - SharedModule + + SharedMainModule, + SharedFormModule, + SharedVideoMiniatureModule, + SharedUserSubscriptionModule, + SharedGlobalIconModule ], declarations: [ diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts index 23890e20c..914c52e27 100644 --- a/server/controllers/api/users/me.ts +++ b/server/controllers/api/users/me.ts @@ -1,9 +1,15 @@ -import * as express from 'express' import 'multer' -import { UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared' +import * as express from 'express' +import { UserUpdateMe, UserVideoRate as FormattedUserVideoRate, VideoSortField } from '../../../../shared' +import { UserVideoQuota } from '../../../../shared/models/users/user-video-quota.model' +import { createReqFiles } from '../../../helpers/express-utils' import { getFormattedObjects } from '../../../helpers/utils' +import { CONFIG } from '../../../initializers/config' import { MIMETYPES } from '../../../initializers/constants' +import { sequelizeTypescript } from '../../../initializers/database' import { sendUpdateActor } from '../../../lib/activitypub/send' +import { updateActorAvatarFile } from '../../../lib/avatar' +import { sendVerifyUserEmail } from '../../../lib/user' import { asyncMiddleware, asyncRetryTransactionMiddleware, @@ -15,19 +21,12 @@ import { usersVideoRatingValidator } from '../../../middlewares' import { deleteMeValidator, videoImportsSortValidator, videosSortValidator } from '../../../middlewares/validators' +import { updateAvatarValidator } from '../../../middlewares/validators/avatar' +import { AccountModel } from '../../../models/account/account' import { AccountVideoRateModel } from '../../../models/account/account-video-rate' import { UserModel } from '../../../models/account/user' import { VideoModel } from '../../../models/video/video' -import { VideoSortField } from '../../../../client/src/app/shared/video/sort-field.type' -import { createReqFiles } from '../../../helpers/express-utils' -import { UserVideoQuota } from '../../../../shared/models/users/user-video-quota.model' -import { updateAvatarValidator } from '../../../middlewares/validators/avatar' -import { updateActorAvatarFile } from '../../../lib/avatar' import { VideoImportModel } from '../../../models/video/video-import' -import { AccountModel } from '../../../models/account/account' -import { CONFIG } from '../../../initializers/config' -import { sequelizeTypescript } from '../../../initializers/database' -import { sendVerifyUserEmail } from '../../../lib/user' const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) diff --git a/server/lib/auth.ts b/server/lib/auth.ts index 8579bdbb4..3f8e18633 100644 --- a/server/lib/auth.ts +++ b/server/lib/auth.ts @@ -10,7 +10,7 @@ import { RegisterServerAuthenticatedResult, RegisterServerAuthPassOptions, RegisterServerExternalAuthenticatedResult -} from '@shared/models/plugins/register-server-auth.model' +} from '@server/types/plugins/register-server-auth.model' import * as express from 'express' import * as OAuthServer from 'express-oauth-server' diff --git a/server/lib/plugins/plugin-helpers.ts b/server/lib/plugins/plugin-helpers.ts index de82b4918..39773f693 100644 --- a/server/lib/plugins/plugin-helpers.ts +++ b/server/lib/plugins/plugin-helpers.ts @@ -1,4 +1,4 @@ -import { PeerTubeHelpers } from '@server/typings/plugins' +import { PeerTubeHelpers } from '@server/types/plugins' import { sequelizeTypescript } from '@server/initializers/database' import { buildLogger } from '@server/helpers/logger' import { VideoModel } from '@server/models/video/video' diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts index 7fda5d9a4..94b5ecc41 100644 --- a/server/lib/plugins/plugin-manager.ts +++ b/server/lib/plugins/plugin-manager.ts @@ -1,28 +1,26 @@ -import { PluginModel } from '../../models/server/plugin' -import { logger } from '../../helpers/logger' +import { createReadStream, createWriteStream } from 'fs' +import { outputFile, readJSON } from 'fs-extra' import { basename, join } from 'path' -import { CONFIG } from '../../initializers/config' -import { isLibraryCodeValid, isPackageJSONValid } from '../../helpers/custom-validators/plugins' +import { MOAuthTokenUser, MUser } from '@server/types/models' +import { RegisterServerHookOptions } from '@shared/models/plugins/register-server-hook.model' +import { getHookType, internalRunHook } from '../../../shared/core-utils/plugins/hooks' import { ClientScript, PluginPackageJson, PluginTranslationPaths as PackagePluginTranslations } from '../../../shared/models/plugins/plugin-package-json.model' -import { createReadStream, createWriteStream } from 'fs' -import { PLUGIN_GLOBAL_CSS_PATH } from '../../initializers/constants' +import { PluginTranslation } from '../../../shared/models/plugins/plugin-translation.model' import { PluginType } from '../../../shared/models/plugins/plugin.type' -import { installNpmPlugin, installNpmPluginFromDisk, removeNpmPlugin } from './yarn' -import { outputFile, readJSON } from 'fs-extra' import { ServerHook, ServerHookName } from '../../../shared/models/plugins/server-hook.model' -import { getHookType, internalRunHook } from '../../../shared/core-utils/plugins/hooks' -import { RegisterServerOptions } from '../../typings/plugins/register-server-option.model' -import { PluginLibrary } from '../../typings/plugins' +import { isLibraryCodeValid, isPackageJSONValid } from '../../helpers/custom-validators/plugins' +import { logger } from '../../helpers/logger' +import { CONFIG } from '../../initializers/config' +import { PLUGIN_GLOBAL_CSS_PATH } from '../../initializers/constants' +import { PluginModel } from '../../models/server/plugin' +import { PluginLibrary, RegisterServerAuthExternalOptions, RegisterServerAuthPassOptions, RegisterServerOptions } from '../../types/plugins' import { ClientHtml } from '../client-html' -import { PluginTranslation } from '../../../shared/models/plugins/plugin-translation.model' import { RegisterHelpersStore } from './register-helpers-store' -import { RegisterServerHookOptions } from '@shared/models/plugins/register-server-hook.model' -import { MOAuthTokenUser, MUser } from '@server/types/models' -import { RegisterServerAuthPassOptions, RegisterServerAuthExternalOptions } from '@shared/models/plugins/register-server-auth.model' +import { installNpmPlugin, installNpmPluginFromDisk, removeNpmPlugin } from './yarn' export interface RegisteredPlugin { npmName: string diff --git a/server/lib/plugins/register-helpers-store.ts b/server/lib/plugins/register-helpers-store.ts index e337b1cb0..c73079302 100644 --- a/server/lib/plugins/register-helpers-store.ts +++ b/server/lib/plugins/register-helpers-store.ts @@ -9,22 +9,24 @@ import { } from '@server/initializers/constants' import { onExternalUserAuthenticated } from '@server/lib/auth' import { PluginModel } from '@server/models/server/plugin' -import { RegisterServerOptions } from '@server/typings/plugins' -import { PluginPlaylistPrivacyManager } from '@shared/models/plugins/plugin-playlist-privacy-manager.model' -import { PluginSettingsManager } from '@shared/models/plugins/plugin-settings-manager.model' -import { PluginStorageManager } from '@shared/models/plugins/plugin-storage-manager.model' -import { PluginVideoCategoryManager } from '@shared/models/plugins/plugin-video-category-manager.model' -import { PluginVideoLanguageManager } from '@shared/models/plugins/plugin-video-language-manager.model' -import { PluginVideoLicenceManager } from '@shared/models/plugins/plugin-video-licence-manager.model' -import { PluginVideoPrivacyManager } from '@shared/models/plugins/plugin-video-privacy-manager.model' import { RegisterServerAuthExternalOptions, RegisterServerAuthExternalResult, RegisterServerAuthPassOptions, - RegisterServerExternalAuthenticatedResult -} from '@shared/models/plugins/register-server-auth.model' -import { RegisterServerHookOptions } from '@shared/models/plugins/register-server-hook.model' -import { RegisterServerSettingOptions } from '@shared/models/plugins/register-server-setting.model' + RegisterServerExternalAuthenticatedResult, + RegisterServerOptions +} from '@server/types/plugins' +import { + PluginPlaylistPrivacyManager, + PluginSettingsManager, + PluginStorageManager, + PluginVideoCategoryManager, + PluginVideoLanguageManager, + PluginVideoLicenceManager, + PluginVideoPrivacyManager, + RegisterServerHookOptions, + RegisterServerSettingOptions +} from '@shared/models' import { serverHookObject } from '@shared/models/plugins/server-hook.model' import { buildPluginHelpers } from './plugin-helpers' diff --git a/server/models/utils.ts b/server/models/utils.ts index 88c9b4adb..d706d9ea8 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts @@ -3,23 +3,6 @@ import validator from 'validator' import { Col } from 'sequelize/types/lib/utils' import { literal, OrderItem, Op } from 'sequelize' -type Primitive = string | Function | number | boolean | Symbol | undefined | null -type DeepOmitHelper = { - [P in K]: // extra level of indirection needed to trigger homomorhic behavior - T[P] extends infer TP // distribute over unions - ? TP extends Primitive - ? TP // leave primitives and functions alone - : TP extends any[] - ? DeepOmitArray // Array special handling - : DeepOmit - : never -} -type DeepOmit = T extends Primitive ? T : DeepOmitHelper> - -type DeepOmitArray = { - [P in keyof T]: DeepOmit -} - type SortType = { sortModel: string, sortValue: string } // Translate for example "-name" to [ [ 'name', 'DESC' ], [ 'id', 'ASC' ] ] @@ -217,7 +200,6 @@ function searchAttribute (sourceField?: string, targetField?: string) { // --------------------------------------------------------------------------- export { - DeepOmit, buildBlockedAccountSQL, buildLocalActorIdsIn, SortType, diff --git a/server/types/index.ts b/server/types/index.ts new file mode 100644 index 000000000..18d3827a5 --- /dev/null +++ b/server/types/index.ts @@ -0,0 +1,3 @@ +export * from './plugins' +export * from './activitypub-processor.model' +export * from './sequelize' diff --git a/server/types/models/account/account-blocklist.ts b/server/types/models/account/account-blocklist.ts index 0d8bf11bd..3126fd0ab 100644 --- a/server/types/models/account/account-blocklist.ts +++ b/server/types/models/account/account-blocklist.ts @@ -1,5 +1,5 @@ import { AccountBlocklistModel } from '../../../models/account/account-blocklist' -import { PickWith } from '../../utils' +import { PickWith } from '@shared/core-utils' import { MAccountDefault, MAccountFormattable } from './account' type Use = PickWith diff --git a/server/types/models/account/account.ts b/server/types/models/account/account.ts index 7b826ee04..d2add9810 100644 --- a/server/types/models/account/account.ts +++ b/server/types/models/account/account.ts @@ -13,7 +13,7 @@ import { MActorSummaryFormattable, MActorUrl } from './actor' -import { FunctionProperties, PickWith } from '../../utils' +import { FunctionProperties, PickWith } from '@shared/core-utils' import { MAccountBlocklistId } from './account-blocklist' import { MChannelDefault } from '../video/video-channels' diff --git a/server/types/models/account/actor-follow.ts b/server/types/models/account/actor-follow.ts index 5d0c03c8d..8c213d09c 100644 --- a/server/types/models/account/actor-follow.ts +++ b/server/types/models/account/actor-follow.ts @@ -8,7 +8,7 @@ import { MActorHost, MActorUsername } from './actor' -import { PickWith } from '../../utils' +import { PickWith } from '@shared/core-utils' import { ActorModel } from '@server/models/activitypub/actor' import { MChannelDefault } from '../video/video-channels' diff --git a/server/types/models/account/actor.ts b/server/types/models/account/actor.ts index 1160e84cb..ee0d05f4e 100644 --- a/server/types/models/account/actor.ts +++ b/server/types/models/account/actor.ts @@ -1,5 +1,5 @@ import { ActorModel } from '../../../models/activitypub/actor' -import { FunctionProperties, PickWith, PickWithOpt } from '../../utils' +import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils' import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' import { MAvatar, MAvatarFormattable } from './avatar' diff --git a/server/types/models/account/avatar.ts b/server/types/models/account/avatar.ts index 6eba59ee4..0489a8599 100644 --- a/server/types/models/account/avatar.ts +++ b/server/types/models/account/avatar.ts @@ -1,5 +1,5 @@ import { AvatarModel } from '../../../models/avatar/avatar' -import { FunctionProperties } from '@server/types/utils' +import { FunctionProperties } from '@shared/core-utils' export type MAvatar = AvatarModel diff --git a/server/types/models/oauth/oauth-token.ts b/server/types/models/oauth/oauth-token.ts index 396cf6429..8399af8f1 100644 --- a/server/types/models/oauth/oauth-token.ts +++ b/server/types/models/oauth/oauth-token.ts @@ -1,5 +1,5 @@ import { OAuthTokenModel } from '@server/models/oauth/oauth-token' -import { PickWith } from '@server/types/utils' +import { PickWith } from '@shared/core-utils' import { MUserAccountUrl } from '../user/user' type Use = PickWith diff --git a/server/types/models/server/server-blocklist.ts b/server/types/models/server/server-blocklist.ts index cfbf3b73a..801f179fd 100644 --- a/server/types/models/server/server-blocklist.ts +++ b/server/types/models/server/server-blocklist.ts @@ -1,5 +1,5 @@ import { ServerBlocklistModel } from '@server/models/server/server-blocklist' -import { PickWith } from '@server/types/utils' +import { PickWith } from '@shared/core-utils' import { MAccountDefault, MAccountFormattable } from '../account/account' import { MServer, MServerFormattable } from './server' diff --git a/server/types/models/server/server.ts b/server/types/models/server/server.ts index b35e55aeb..f8b053e3b 100644 --- a/server/types/models/server/server.ts +++ b/server/types/models/server/server.ts @@ -1,5 +1,5 @@ import { ServerModel } from '../../../models/server/server' -import { FunctionProperties, PickWith } from '../../utils' +import { FunctionProperties, PickWith } from '@shared/core-utils' import { MAccountBlocklistId } from '../account' type Use = PickWith diff --git a/server/types/models/user/user-notification.ts b/server/types/models/user/user-notification.ts index 2080360e1..dd3de423b 100644 --- a/server/types/models/user/user-notification.ts +++ b/server/types/models/user/user-notification.ts @@ -1,5 +1,5 @@ import { UserNotificationModel } from '../../../models/account/user-notification' -import { PickWith, PickWithOpt } from '../../utils' +import { PickWith, PickWithOpt } from '@shared/core-utils' import { VideoModel } from '../../../models/video/video' import { ActorModel } from '../../../models/activitypub/actor' import { ServerModel } from '../../../models/server/server' diff --git a/server/types/models/user/user.ts b/server/types/models/user/user.ts index 7938ea288..12a68accf 100644 --- a/server/types/models/user/user.ts +++ b/server/types/models/user/user.ts @@ -1,5 +1,5 @@ import { UserModel } from '../../../models/account/user' -import { PickWith, PickWithOpt } from '../../utils' +import { PickWith, PickWithOpt } from '@shared/core-utils' import { MAccount, MAccountDefault, diff --git a/server/types/models/video/schedule-video-update.ts b/server/types/models/video/schedule-video-update.ts index 6336fdabe..5d2936000 100644 --- a/server/types/models/video/schedule-video-update.ts +++ b/server/types/models/video/schedule-video-update.ts @@ -1,5 +1,5 @@ import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' -import { PickWith } from '@server/types/utils' +import { PickWith } from '@shared/core-utils' import { MVideoAPWithoutCaption, MVideoWithBlacklistLight } from './video' type Use = PickWith diff --git a/server/types/models/video/video-abuse.ts b/server/types/models/video/video-abuse.ts index d60f05e4c..279a87cf3 100644 --- a/server/types/models/video/video-abuse.ts +++ b/server/types/models/video/video-abuse.ts @@ -1,5 +1,5 @@ import { VideoAbuseModel } from '../../../models/video/video-abuse' -import { PickWith } from '../../utils' +import { PickWith } from '@shared/core-utils' import { MVideoAccountLightBlacklistAllFiles, MVideo } from './video' import { MAccountDefault, MAccountFormattable } from '../account' diff --git a/server/types/models/video/video-blacklist.ts b/server/types/models/video/video-blacklist.ts index 08e59284a..2ac912405 100644 --- a/server/types/models/video/video-blacklist.ts +++ b/server/types/models/video/video-blacklist.ts @@ -1,5 +1,5 @@ import { VideoBlacklistModel } from '../../../models/video/video-blacklist' -import { PickWith } from '@server/types/utils' +import { PickWith } from '@shared/core-utils' import { MVideo, MVideoFormattable } from './video' type Use = PickWith diff --git a/server/types/models/video/video-caption.ts b/server/types/models/video/video-caption.ts index 9bb067001..ab80ff830 100644 --- a/server/types/models/video/video-caption.ts +++ b/server/types/models/video/video-caption.ts @@ -1,5 +1,5 @@ import { VideoCaptionModel } from '../../../models/video/video-caption' -import { FunctionProperties, PickWith } from '@server/types/utils' +import { FunctionProperties, PickWith } from '@shared/core-utils' import { MVideo, MVideoUUID } from './video' type Use = PickWith diff --git a/server/types/models/video/video-change-ownership.ts b/server/types/models/video/video-change-ownership.ts index 7421e081e..244d1a671 100644 --- a/server/types/models/video/video-change-ownership.ts +++ b/server/types/models/video/video-change-ownership.ts @@ -1,5 +1,5 @@ import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership' -import { PickWith } from '@server/types/utils' +import { PickWith } from '@shared/core-utils' import { MAccountDefault, MAccountFormattable } from '../account/account' import { MVideo, MVideoWithAllFiles } from './video' diff --git a/server/types/models/video/video-channels.ts b/server/types/models/video/video-channels.ts index 50f7c2d8a..2e05d8753 100644 --- a/server/types/models/video/video-channels.ts +++ b/server/types/models/video/video-channels.ts @@ -1,4 +1,4 @@ -import { FunctionProperties, PickWith, PickWithOpt } from '../../utils' +import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils' import { VideoChannelModel } from '../../../models/video/video-channel' import { MAccountActor, diff --git a/server/types/models/video/video-comment.ts b/server/types/models/video/video-comment.ts index d6e0b66f5..f1c50c753 100644 --- a/server/types/models/video/video-comment.ts +++ b/server/types/models/video/video-comment.ts @@ -1,5 +1,5 @@ import { VideoCommentModel } from '../../../models/video/video-comment' -import { PickWith, PickWithOpt } from '../../utils' +import { PickWith, PickWithOpt } from '@shared/core-utils' import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account' import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video' diff --git a/server/types/models/video/video-file.ts b/server/types/models/video/video-file.ts index 3fcaca78f..327a148ce 100644 --- a/server/types/models/video/video-file.ts +++ b/server/types/models/video/video-file.ts @@ -1,5 +1,5 @@ import { VideoFileModel } from '../../../models/video/video-file' -import { PickWith, PickWithOpt } from '../../utils' +import { PickWith, PickWithOpt } from '@shared/core-utils' import { MVideo, MVideoUUID } from './video' import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy' import { MStreamingPlaylistVideo, MStreamingPlaylist } from './video-streaming-playlist' diff --git a/server/types/models/video/video-import.ts b/server/types/models/video/video-import.ts index f1385877e..759b13c6e 100644 --- a/server/types/models/video/video-import.ts +++ b/server/types/models/video/video-import.ts @@ -1,5 +1,5 @@ import { VideoImportModel } from '@server/models/video/video-import' -import { PickWith, PickWithOpt } from '@server/types/utils' +import { PickWith, PickWithOpt } from '@shared/core-utils' import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video' import { MUser } from '../user/user' diff --git a/server/types/models/video/video-playlist-element.ts b/server/types/models/video/video-playlist-element.ts index c50992da7..f46ff4d49 100644 --- a/server/types/models/video/video-playlist-element.ts +++ b/server/types/models/video/video-playlist-element.ts @@ -1,5 +1,5 @@ import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element' -import { PickWith } from '@server/types/utils' +import { PickWith } from '@shared/core-utils' import { MVideoFormattable, MVideoThumbnail, MVideoUrl } from './video' import { MVideoPlaylistPrivacy } from './video-playlist' diff --git a/server/types/models/video/video-playlist.ts b/server/types/models/video/video-playlist.ts index b504d1664..79e2daebf 100644 --- a/server/types/models/video/video-playlist.ts +++ b/server/types/models/video/video-playlist.ts @@ -1,5 +1,5 @@ import { VideoPlaylistModel } from '../../../models/video/video-playlist' -import { PickWith } from '../../utils' +import { PickWith } from '@shared/core-utils' import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account' import { MThumbnail } from './thumbnail' import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels' diff --git a/server/types/models/video/video-rate.ts b/server/types/models/video/video-rate.ts index a7682ef31..7bd54f7b0 100644 --- a/server/types/models/video/video-rate.ts +++ b/server/types/models/video/video-rate.ts @@ -1,5 +1,5 @@ import { AccountVideoRateModel } from '@server/models/account/account-video-rate' -import { PickWith } from '@server/types/utils' +import { PickWith } from '@shared/core-utils' import { MAccountAudience, MAccountUrl } from '../account/account' import { MVideo, MVideoFormattable } from './video' diff --git a/server/types/models/video/video-redundancy.ts b/server/types/models/video/video-redundancy.ts index 7c7d52035..411375c81 100644 --- a/server/types/models/video/video-redundancy.ts +++ b/server/types/models/video/video-redundancy.ts @@ -1,5 +1,5 @@ import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' -import { PickWith, PickWithOpt } from '@server/types/utils' +import { PickWith, PickWithOpt } from '@shared/core-utils' import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' import { VideoFileModel } from '@server/models/video/video-file' import { MVideoFile, MVideoFileVideo } from './video-file' diff --git a/server/types/models/video/video-share.ts b/server/types/models/video/video-share.ts index 50ca75d26..b7a783bb6 100644 --- a/server/types/models/video/video-share.ts +++ b/server/types/models/video/video-share.ts @@ -1,5 +1,5 @@ import { VideoShareModel } from '../../../models/video/video-share' -import { PickWith } from '../../utils' +import { PickWith } from '@shared/core-utils' import { MActorDefault } from '../account' import { MVideo } from './video' diff --git a/server/types/models/video/video-streaming-playlist.ts b/server/types/models/video/video-streaming-playlist.ts index 3f54aa560..8b3ef51fc 100644 --- a/server/types/models/video/video-streaming-playlist.ts +++ b/server/types/models/video/video-streaming-playlist.ts @@ -1,5 +1,5 @@ import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist' -import { PickWith, PickWithOpt } from '../../utils' +import { PickWith, PickWithOpt } from '@shared/core-utils' import { MVideoRedundancyFileUrl, MVideoRedundancy } from './video-redundancy' import { MVideo } from './video' import { MVideoFile } from './video-file' diff --git a/server/types/models/video/video.ts b/server/types/models/video/video.ts index 022a9566d..3d8f85b3d 100644 --- a/server/types/models/video/video.ts +++ b/server/types/models/video/video.ts @@ -1,5 +1,5 @@ import { VideoModel } from '../../../models/video/video' -import { PickWith, PickWithOpt } from '../../utils' +import { PickWith, PickWithOpt } from '@shared/core-utils' import { MChannelAccountDefault, MChannelAccountLight, diff --git a/server/typings/plugins/index.d.ts b/server/types/plugins/index.ts similarity index 65% rename from server/typings/plugins/index.d.ts rename to server/types/plugins/index.ts index 9570579ef..de30ff2ab 100644 --- a/server/typings/plugins/index.d.ts +++ b/server/types/plugins/index.ts @@ -1,2 +1,3 @@ -export * from './register-server-option.model' export * from './plugin-library.model' +export * from './register-server-auth.model' +export * from './register-server-option.model' diff --git a/server/typings/plugins/plugin-library.model.ts b/server/types/plugins/plugin-library.model.ts similarity index 100% rename from server/typings/plugins/plugin-library.model.ts rename to server/types/plugins/plugin-library.model.ts diff --git a/shared/models/plugins/register-server-auth.model.ts b/server/types/plugins/register-server-auth.model.ts similarity index 96% rename from shared/models/plugins/register-server-auth.model.ts rename to server/types/plugins/register-server-auth.model.ts index fc6f0f258..31c71b0d0 100644 --- a/shared/models/plugins/register-server-auth.model.ts +++ b/server/types/plugins/register-server-auth.model.ts @@ -1,6 +1,6 @@ -import { UserRole } from '@shared/models' -import { MOAuthToken, MUser } from '@server/types/models' import * as express from 'express' +import { UserRole } from '@shared/models' +import { MOAuthToken, MUser } from '../models' export type RegisterServerAuthOptions = RegisterServerAuthPassOptions | RegisterServerAuthExternalOptions diff --git a/server/typings/plugins/register-server-option.model.ts b/server/types/plugins/register-server-option.model.ts similarity index 66% rename from server/typings/plugins/register-server-option.model.ts rename to server/types/plugins/register-server-option.model.ts index b4594c6cd..74303d383 100644 --- a/server/typings/plugins/register-server-option.model.ts +++ b/server/types/plugins/register-server-option.model.ts @@ -2,22 +2,24 @@ import * as Bluebird from 'bluebird' import { Router } from 'express' import { Logger } from 'winston' import { ActorModel } from '@server/models/activitypub/actor' -import { VideoBlacklistCreate } from '@shared/models' -import { PluginPlaylistPrivacyManager } from '@shared/models/plugins/plugin-playlist-privacy-manager.model' -import { PluginVideoPrivacyManager } from '@shared/models/plugins/plugin-video-privacy-manager.model' +import { + PluginPlaylistPrivacyManager, + PluginSettingsManager, + PluginStorageManager, + PluginVideoCategoryManager, + PluginVideoLanguageManager, + PluginVideoLicenceManager, + PluginVideoPrivacyManager, + RegisterServerHookOptions, + RegisterServerSettingOptions, + VideoBlacklistCreate +} from '@shared/models' +import { MVideoThumbnail } from '../models' import { RegisterServerAuthExternalOptions, RegisterServerAuthExternalResult, RegisterServerAuthPassOptions -} from '@shared/models/plugins/register-server-auth.model' -import { PluginSettingsManager } from '../../../shared/models/plugins/plugin-settings-manager.model' -import { PluginStorageManager } from '../../../shared/models/plugins/plugin-storage-manager.model' -import { PluginVideoCategoryManager } from '../../../shared/models/plugins/plugin-video-category-manager.model' -import { PluginVideoLanguageManager } from '../../../shared/models/plugins/plugin-video-language-manager.model' -import { PluginVideoLicenceManager } from '../../../shared/models/plugins/plugin-video-licence-manager.model' -import { RegisterServerHookOptions } from '../../../shared/models/plugins/register-server-hook.model' -import { RegisterServerSettingOptions } from '../../../shared/models/plugins/register-server-setting.model' -import { MVideoThumbnail } from '../../types/models' +} from './register-server-auth.model' export type PeerTubeHelpers = { logger: Logger diff --git a/server/typings/express/index.d.ts b/server/typings/express/index.d.ts index ad3212340..cac801e55 100644 --- a/server/typings/express/index.d.ts +++ b/server/typings/express/index.d.ts @@ -1,3 +1,20 @@ +import { RegisterServerAuthExternalOptions } from '@server/types' +import { + MAccountBlocklist, + MActorUrl, + MStreamingPlaylist, + MVideoChangeOwnershipFull, + MVideoFile, + MVideoImmutable, + MVideoPlaylistFull, + MVideoPlaylistFullSummary +} from '@server/types/models' +import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token' +import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server' +import { MVideoImportDefault } from '@server/types/models/video/video-import' +import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element' +import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate' +import { UserRole } from '@shared/models' import { RegisteredPlugin } from '../../lib/plugins/plugin-manager' import { MAccountDefault, @@ -19,17 +36,6 @@ import { MVideoThumbnail, MVideoWithRights } from '../../types/models' -import { MVideoPlaylistFull, MVideoPlaylistFullSummary } from '../../types/models/video/video-playlist' -import { MVideoImportDefault } from '@server/types/models/video/video-import' -import { MAccountBlocklist, MActorUrl, MStreamingPlaylist, MVideoFile, MVideoImmutable } from '@server/types/models' -import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element' -import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate' -import { MVideoChangeOwnershipFull } from '../../types/models/video/video-change-ownership' -import { MPlugin, MServer } from '@server/types/models/server' -import { MServerBlocklist } from '../../types/models/server/server-blocklist' -import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token' -import { UserRole } from '@shared/models' -import { RegisterServerAuthExternalOptions } from '@shared/models/plugins/register-server-auth.model' declare module 'express' { export interface Request { diff --git a/shared/core-utils/index.ts b/shared/core-utils/index.ts new file mode 100644 index 000000000..54e233522 --- /dev/null +++ b/shared/core-utils/index.ts @@ -0,0 +1,3 @@ +export * from './logs' +export * from './miscs' +export * from './plugins' diff --git a/shared/core-utils/logs/index.ts b/shared/core-utils/logs/index.ts new file mode 100644 index 000000000..ceb5d7a7f --- /dev/null +++ b/shared/core-utils/logs/index.ts @@ -0,0 +1 @@ +export * from './logs' diff --git a/shared/core-utils/miscs/index.ts b/shared/core-utils/miscs/index.ts new file mode 100644 index 000000000..afd147f24 --- /dev/null +++ b/shared/core-utils/miscs/index.ts @@ -0,0 +1,3 @@ +export * from './date' +export * from './miscs' +export * from './types' diff --git a/server/types/utils.ts b/shared/core-utils/miscs/types.ts similarity index 51% rename from server/types/utils.ts rename to shared/core-utils/miscs/types.ts index 55500d8c4..bb64dc830 100644 --- a/server/types/utils.ts +++ b/shared/core-utils/miscs/types.ts @@ -22,3 +22,20 @@ export type DeepPartial = { ? ReadonlyArray> : DeepPartial } + +type Primitive = string | Function | number | boolean | Symbol | undefined | null +export type DeepOmitHelper = { + [P in K]: // extra level of indirection needed to trigger homomorhic behavior + T[P] extends infer TP // distribute over unions + ? TP extends Primitive + ? TP // leave primitives and functions alone + : TP extends any[] + ? DeepOmitArray // Array special handling + : DeepOmit + : never +} +export type DeepOmit = T extends Primitive ? T : DeepOmitHelper> + +export type DeepOmitArray = { + [P in keyof T]: DeepOmit +} diff --git a/shared/core-utils/plugins/index.ts b/shared/core-utils/plugins/index.ts new file mode 100644 index 000000000..fc78d3512 --- /dev/null +++ b/shared/core-utils/plugins/index.ts @@ -0,0 +1 @@ +export * from './hooks' diff --git a/shared/extra-utils/server/config.ts b/shared/extra-utils/server/config.ts index 2b04a0396..3ae1c6e67 100644 --- a/shared/extra-utils/server/config.ts +++ b/shared/extra-utils/server/config.ts @@ -1,6 +1,6 @@ import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests' import { CustomConfig } from '../../models/server/custom-config.model' -import { DeepPartial } from '@server/types/utils' +import { DeepPartial } from '@shared/core-utils' import { merge } from 'lodash' function getConfig (url: string) { diff --git a/shared/models/actors/index.ts b/shared/models/actors/index.ts index 8fe437b81..c7a92399d 100644 --- a/shared/models/actors/index.ts +++ b/shared/models/actors/index.ts @@ -1,2 +1,3 @@ export * from './account.model' +export * from './actor.model' export * from './follow.model' diff --git a/shared/models/index.ts b/shared/models/index.ts index b562e04a3..3d4bdedde 100644 --- a/shared/models/index.ts +++ b/shared/models/index.ts @@ -9,8 +9,9 @@ export * from './videos' export * from './feeds' export * from './i18n' export * from './overviews' +export * from './plugins' export * from './search' -export * from './server/job.model' +export * from './server' export * from './oauth-client-local.model' export * from './result-list.model' export * from './server/server-config.model' diff --git a/shared/models/plugins/index.ts b/shared/models/plugins/index.ts new file mode 100644 index 000000000..209fca791 --- /dev/null +++ b/shared/models/plugins/index.ts @@ -0,0 +1,24 @@ +export * from './client-hook.model' +export * from './hook-type.enum' +export * from './install-plugin.model' +export * from './manage-plugin.model' +export * from './peertube-plugin-index-list.model' +export * from './peertube-plugin-index.model' +export * from './peertube-plugin-latest-version.model' +export * from './peertube-plugin.model' +export * from './plugin-client-scope.type' +export * from './plugin-package-json.model' +export * from './plugin-playlist-privacy-manager.model' +export * from './plugin-settings-manager.model' +export * from './plugin-storage-manager.model' +export * from './plugin-translation.model' +export * from './plugin-video-category-manager.model' +export * from './plugin-video-language-manager.model' +export * from './plugin-video-licence-manager.model' +export * from './plugin-video-privacy-manager.model' +export * from './plugin.type' +export * from './public-server.setting' +export * from './register-client-hook.model' +export * from './register-server-hook.model' +export * from './register-server-setting.model' +export * from './server-hook.model' diff --git a/shared/models/plugins/plugin-playlist-privacy-manager.model.ts b/shared/models/plugins/plugin-playlist-privacy-manager.model.ts index f9630c77f..d1823ef4e 100644 --- a/shared/models/plugins/plugin-playlist-privacy-manager.model.ts +++ b/shared/models/plugins/plugin-playlist-privacy-manager.model.ts @@ -1,4 +1,4 @@ -import { VideoPlaylistPrivacy } from '@shared/models' +import { VideoPlaylistPrivacy } from '../videos/playlist/video-playlist-privacy.model' export interface PluginPlaylistPrivacyManager { // PUBLIC = 1, diff --git a/shared/models/plugins/plugin-video-privacy-manager.model.ts b/shared/models/plugins/plugin-video-privacy-manager.model.ts index d602ba297..c0e8117b5 100644 --- a/shared/models/plugins/plugin-video-privacy-manager.model.ts +++ b/shared/models/plugins/plugin-video-privacy-manager.model.ts @@ -1,4 +1,4 @@ -import { VideoPrivacy } from '@shared/models' +import { VideoPrivacy } from '@shared/models/videos/video-privacy.enum' export interface PluginVideoPrivacyManager { // PUBLIC = 1 diff --git a/shared/models/search/index.ts b/shared/models/search/index.ts index 28dd95443..e2d0ab620 100644 --- a/shared/models/search/index.ts +++ b/shared/models/search/index.ts @@ -1,3 +1,4 @@ export * from './nsfw-query.model' +export * from './search-target-query.model' export * from './videos-search-query.model' export * from './video-channels-search-query.model' diff --git a/shared/models/server/index.ts b/shared/models/server/index.ts index 2bb443d46..b079bc9a0 100644 --- a/shared/models/server/index.ts +++ b/shared/models/server/index.ts @@ -5,5 +5,6 @@ export * from './custom-config.model' export * from './debug.model' export * from './emailer.model' export * from './job.model' +export * from './log-level.type' export * from './server-config.model' export * from './server-stats.model' diff --git a/shared/models/users/index.ts b/shared/models/users/index.ts index cd07cf320..a9d578054 100644 --- a/shared/models/users/index.ts +++ b/shared/models/users/index.ts @@ -1,12 +1,14 @@ -export * from './user.model' export * from './user-create.model' +export * from './user-flag.model' export * from './user-login.model' -export * from './user-notification.model' export * from './user-notification-setting.model' +export * from './user-notification.model' export * from './user-refresh-token.model' -export * from './user-update.model' -export * from './user-update-me.model' +export * from './user-register.model' export * from './user-right.enum' export * from './user-role' +export * from './user-update-me.model' +export * from './user-update.model' export * from './user-video-quota.model' export * from './user-watching-video.model' +export * from './user.model' diff --git a/shared/models/videos/abuse/index.ts b/shared/models/videos/abuse/index.ts new file mode 100644 index 000000000..bdeef1dad --- /dev/null +++ b/shared/models/videos/abuse/index.ts @@ -0,0 +1,5 @@ +export * from './video-abuse-create.model' +export * from './video-abuse-state.model' +export * from './video-abuse-update.model' +export * from './video-abuse-video-is.type' +export * from './video-abuse.model' diff --git a/shared/models/videos/blacklist/index.ts b/shared/models/videos/blacklist/index.ts new file mode 100644 index 000000000..66082be34 --- /dev/null +++ b/shared/models/videos/blacklist/index.ts @@ -0,0 +1,3 @@ +export * from './video-blacklist.model' +export * from './video-blacklist-create.model' +export * from './video-blacklist-update.model' diff --git a/shared/models/videos/caption/index.ts b/shared/models/videos/caption/index.ts new file mode 100644 index 000000000..2a5ff512d --- /dev/null +++ b/shared/models/videos/caption/index.ts @@ -0,0 +1,2 @@ +export * from './video-caption.model' +export * from './video-caption-update.model' diff --git a/shared/models/videos/channel/index.ts b/shared/models/videos/channel/index.ts new file mode 100644 index 000000000..9dbaa42da --- /dev/null +++ b/shared/models/videos/channel/index.ts @@ -0,0 +1,3 @@ +export * from './video-channel-create.model' +export * from './video-channel-update.model' +export * from './video-channel.model' diff --git a/shared/models/videos/import/index.ts b/shared/models/videos/import/index.ts new file mode 100644 index 000000000..8884ee8f2 --- /dev/null +++ b/shared/models/videos/import/index.ts @@ -0,0 +1,3 @@ +export * from './video-import-create.model' +export * from './video-import-state.enum' +export * from './video-import.model' diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts index 58bd1ebd7..e1d96b40a 100644 --- a/shared/models/videos/index.ts +++ b/shared/models/videos/index.ts @@ -1,41 +1,38 @@ -export * from './rate/user-video-rate-update.model' -export * from './rate/user-video-rate.model' -export * from './rate/account-video-rate.model' -export * from './rate/user-video-rate.type' -export * from './abuse/video-abuse-state.model' -export * from './abuse/video-abuse-create.model' -export * from './abuse/video-abuse-reason.model' -export * from './abuse/video-abuse.model' -export * from './abuse/video-abuse-update.model' -export * from './blacklist/video-blacklist.model' -export * from './blacklist/video-blacklist-create.model' -export * from './blacklist/video-blacklist-update.model' -export * from './channel/video-channel-create.model' -export * from './channel/video-channel-update.model' -export * from './channel/video-channel.model' -export * from './playlist/video-playlist-create.model' -export * from './playlist/video-playlist-element-create.model' -export * from './playlist/video-playlist-element-update.model' -export * from './playlist/video-playlist-privacy.model' -export * from './playlist/video-playlist-type.model' -export * from './playlist/video-playlist-update.model' -export * from './playlist/video-playlist.model' -export * from './playlist/video-playlist-element.model' -export * from './video-change-ownership.model' +export * from './abuse' +export * from './blacklist' +export * from './caption' +export * from './channel' +export * from './import' +export * from './playlist' +export * from './rate' + +export * from './nsfw-policy.type' + +export * from './thumbnail.type' + +export * from './video-change-ownership-accept.model' export * from './video-change-ownership-create.model' +export * from './video-change-ownership.model' + +export * from './video-comment.model' +export * from './video-constant.model' export * from './video-create.model' +export * from './video-file-metadata' export * from './video-file.model' + export * from './video-privacy.enum' +export * from './video-query.type' export * from './video-rate.type' export * from './video-resolution.enum' -export * from './video-update.model' -export * from './video.model' -export * from './video-query.type' + +export * from './video-schedule-update.model' +export * from './video-sort-field.type' export * from './video-state.enum' + +export * from './video-streaming-playlist.model' +export * from './video-streaming-playlist.type' + export * from './video-transcoding-fps.model' -export * from './caption/video-caption.model' -export * from './caption/video-caption-update.model' -export * from './import/video-import-create.model' -export * from './import/video-import-state.enum' -export * from './import/video-import.model' -export * from './video-constant.model' + +export * from './video-update.model' +export * from './video.model' diff --git a/shared/models/videos/playlist/index.ts b/shared/models/videos/playlist/index.ts new file mode 100644 index 000000000..99f7e9bab --- /dev/null +++ b/shared/models/videos/playlist/index.ts @@ -0,0 +1,10 @@ +export * from './video-exist-in-playlist.model' +export * from './video-playlist-create.model' +export * from './video-playlist-element-create.model' +export * from './video-playlist-element-update.model' +export * from './video-playlist-element.model' +export * from './video-playlist-privacy.model' +export * from './video-playlist-reorder.model' +export * from './video-playlist-type.model' +export * from './video-playlist-update.model' +export * from './video-playlist.model' diff --git a/shared/models/videos/rate/index.ts b/shared/models/videos/rate/index.ts new file mode 100644 index 000000000..06aa691bd --- /dev/null +++ b/shared/models/videos/rate/index.ts @@ -0,0 +1,5 @@ + +export * from './user-video-rate-update.model' +export * from './user-video-rate.model' +export * from './account-video-rate.model' +export * from './user-video-rate.type' diff --git a/shared/models/videos/video-file-metadata.ts b/shared/models/videos/video-file-metadata.ts index 15683cacf..010bf7cf5 100644 --- a/shared/models/videos/video-file-metadata.ts +++ b/shared/models/videos/video-file-metadata.ts @@ -1,5 +1,5 @@ -import { FfprobeData } from "fluent-ffmpeg" -import { DeepOmit } from "@server/models/utils" +import { FfprobeData } from 'fluent-ffmpeg' +import { DeepOmit } from '../../core-utils' export type VideoFileMetadataModel = DeepOmit diff --git a/shared/models/videos/video-sort-field.type.ts b/shared/models/videos/video-sort-field.type.ts new file mode 100644 index 000000000..f2e70f5fa --- /dev/null +++ b/shared/models/videos/video-sort-field.type.ts @@ -0,0 +1,8 @@ +export type VideoSortField = + 'name' | '-name' | + 'duration' | '-duration' | + 'publishedAt' | '-publishedAt' | + 'createdAt' | '-createdAt' | + 'views' | '-views' | + 'likes' | '-likes' | + 'trending' | '-trending' -- 2.41.0