summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-06-29 21:22:18 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-06-29 21:22:18 +0900
commit3f6e04697a9deb7f3eb9ff82e496f2e16e334c9f (patch)
treed21f5ce3a0261e2f91cbd914fec124a64e9115f5 /packages
parentfeat(client): add tag cloud component (diff)
parent Prevent access to user pages when not logged in [v2] (#8904) (diff)
downloadsharkey-3f6e04697a9deb7f3eb9ff82e496f2e16e334c9f.tar.gz
sharkey-3f6e04697a9deb7f3eb9ff82e496f2e16e334c9f.tar.bz2
sharkey-3f6e04697a9deb7f3eb9ff82e496f2e16e334c9f.zip
Merge branch 'develop' of https://github.com/misskey-dev/misskey into develop
Diffstat (limited to 'packages')
-rw-r--r--packages/client/src/nirax.ts6
-rw-r--r--packages/client/src/router.ts27
-rw-r--r--packages/client/src/scripts/please-login.ts2
3 files changed, 34 insertions, 1 deletions
diff --git a/packages/client/src/nirax.ts b/packages/client/src/nirax.ts
index 9dc787de4e..19c4464ea8 100644
--- a/packages/client/src/nirax.ts
+++ b/packages/client/src/nirax.ts
@@ -2,11 +2,13 @@
import { EventEmitter } from 'eventemitter3';
import { Ref, Component, ref, shallowRef, ShallowRef } from 'vue';
+import { pleaseLogin } from '@/scripts/please-login';
type RouteDef = {
path: string;
component: Component;
query?: Record<string, string>;
+ loginRequired?: boolean;
name?: string;
hash?: string;
globalCacheKey?: string;
@@ -169,6 +171,10 @@ export class Router extends EventEmitter<{
throw new Error('no route found for: ' + path);
}
+ if (res.route.loginRequired) {
+ pleaseLogin('/');
+ }
+
const isSamePath = beforePath === path;
if (isSamePath && key == null) key = this.currentKey;
this.currentComponent = res.route.component;
diff --git a/packages/client/src/router.ts b/packages/client/src/router.ts
index d257612f35..54cd7231d5 100644
--- a/packages/client/src/router.ts
+++ b/packages/client/src/router.ts
@@ -38,6 +38,7 @@ export const routes = [{
name: 'settings',
path: '/settings/:initialPage(*)?',
component: page(() => import('./pages/settings/index.vue')),
+ loginRequired: true,
}, {
path: '/reset-password/:token?',
component: page(() => import('./pages/reset-password.vue')),
@@ -60,6 +61,7 @@ export const routes = [{
}, {
path: '/theme-editor',
component: page(() => import('./pages/theme-editor.vue')),
+ loginRequired: true,
}, {
path: '/explore/tags/:tag',
component: page(() => import('./pages/explore.vue')),
@@ -76,12 +78,15 @@ export const routes = [{
}, {
path: '/authorize-follow',
component: page(() => import('./pages/follow.vue')),
+ loginRequired: true,
}, {
path: '/share',
component: page(() => import('./pages/share.vue')),
+ loginRequired: true,
}, {
path: '/api-console',
component: page(() => import('./pages/api-console.vue')),
+ loginRequired: true,
}, {
path: '/mfm-cheat-sheet',
component: page(() => import('./pages/mfm-cheat-sheet.vue')),
@@ -109,18 +114,22 @@ export const routes = [{
}, {
path: '/pages/new',
component: page(() => import('./pages/page-editor/page-editor.vue')),
+ loginRequired: true,
}, {
path: '/pages/edit/:initPageId',
component: page(() => import('./pages/page-editor/page-editor.vue')),
+ loginRequired: true,
}, {
path: '/pages',
component: page(() => import('./pages/pages.vue')),
}, {
path: '/gallery/:postId/edit',
component: page(() => import('./pages/gallery/edit.vue')),
+ loginRequired: true,
}, {
path: '/gallery/new',
component: page(() => import('./pages/gallery/edit.vue')),
+ loginRequired: true,
}, {
path: '/gallery/:postId',
component: page(() => import('./pages/gallery/post.vue')),
@@ -130,9 +139,11 @@ export const routes = [{
}, {
path: '/channels/:channelId/edit',
component: page(() => import('./pages/channel-editor.vue')),
+ loginRequired: true,
}, {
path: '/channels/new',
component: page(() => import('./pages/channel-editor.vue')),
+ loginRequired: true,
}, {
path: '/channels/:channelId',
component: page(() => import('./pages/channel.vue')),
@@ -148,52 +159,68 @@ export const routes = [{
}, {
path: '/my/notifications',
component: page(() => import('./pages/notifications.vue')),
+ loginRequired: true,
}, {
path: '/my/favorites',
component: page(() => import('./pages/favorites.vue')),
+ loginRequired: true,
}, {
name: 'messaging',
path: '/my/messaging',
component: page(() => import('./pages/messaging/index.vue')),
+ loginRequired: true,
}, {
path: '/my/messaging/:userAcct',
component: page(() => import('./pages/messaging/messaging-room.vue')),
+ loginRequired: true,
}, {
path: '/my/messaging/group/:groupId',
component: page(() => import('./pages/messaging/messaging-room.vue')),
+ loginRequired: true,
}, {
path: '/my/drive/folder/:folder',
component: page(() => import('./pages/drive.vue')),
+ loginRequired: true,
}, {
path: '/my/drive',
component: page(() => import('./pages/drive.vue')),
+ loginRequired: true,
}, {
path: '/my/follow-requests',
component: page(() => import('./pages/follow-requests.vue')),
+ loginRequired: true,
}, {
path: '/my/lists/:listId',
component: page(() => import('./pages/my-lists/list.vue')),
+ loginRequired: true,
}, {
path: '/my/lists',
component: page(() => import('./pages/my-lists/index.vue')),
+ loginRequired: true,
}, {
path: '/my/clips',
component: page(() => import('./pages/my-clips/index.vue')),
+ loginRequired: true,
}, {
path: '/my/antennas/create',
component: page(() => import('./pages/my-antennas/create.vue')),
+ loginRequired: true,
}, {
path: '/my/antennas/:antennaId',
component: page(() => import('./pages/my-antennas/edit.vue')),
+ loginRequired: true,
}, {
path: '/my/antennas',
component: page(() => import('./pages/my-antennas/index.vue')),
+ loginRequired: true,
}, {
path: '/timeline/list/:listId',
component: page(() => import('./pages/user-list-timeline.vue')),
+ loginRequired: true,
}, {
path: '/timeline/antenna/:antennaId',
component: page(() => import('./pages/antenna-timeline.vue')),
+ loginRequired: true,
}, {
name: 'index',
path: '/',
diff --git a/packages/client/src/scripts/please-login.ts b/packages/client/src/scripts/please-login.ts
index e21a6d2ed3..1f38061841 100644
--- a/packages/client/src/scripts/please-login.ts
+++ b/packages/client/src/scripts/please-login.ts
@@ -17,5 +17,5 @@ export function pleaseLogin(path?: string) {
},
}, 'closed');
- throw new Error('signin required');
+ if (!path) throw new Error('signin required');
}