summaryrefslogtreecommitdiff
path: root/src/client/app/auth
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2020-01-30 04:37:25 +0900
committerGitHub <noreply@github.com>2020-01-30 04:37:25 +0900
commitf6154dc0af1a0d65819e87240f4385f9573095cb (patch)
tree699a5ca07d6727b7f8497d4769f25d6d62f94b5a /src/client/app/auth
parentAdd Event activity-type support (#5785) (diff)
downloadsharkey-f6154dc0af1a0d65819e87240f4385f9573095cb.tar.gz
sharkey-f6154dc0af1a0d65819e87240f4385f9573095cb.tar.bz2
sharkey-f6154dc0af1a0d65819e87240f4385f9573095cb.zip
v12 (#5712)
Co-authored-by: MeiMei <30769358+mei23@users.noreply.github.com> Co-authored-by: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com>
Diffstat (limited to 'src/client/app/auth')
-rw-r--r--src/client/app/auth/assets/icon.svg1
-rw-r--r--src/client/app/auth/script.ts30
-rw-r--r--src/client/app/auth/style.styl15
-rw-r--r--src/client/app/auth/views/form.vue141
-rw-r--r--src/client/app/auth/views/index.vue153
5 files changed, 0 insertions, 340 deletions
diff --git a/src/client/app/auth/assets/icon.svg b/src/client/app/auth/assets/icon.svg
deleted file mode 100644
index 36f5d3e404..0000000000
--- a/src/client/app/auth/assets/icon.svg
+++ /dev/null
@@ -1 +0,0 @@
-<?xml version="1.0" standalone="no"?><!-- Generator: Gravit.io --><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="0 0 512 512" width="512" height="512"><defs><clipPath id="_clipPath_P6eAE2OaBltOJ3gHGVajfqsOnfv4xIns"><rect width="512" height="512"/></clipPath></defs><g clip-path="url(#_clipPath_P6eAE2OaBltOJ3gHGVajfqsOnfv4xIns)"><clipPath id="_clipPath_P6q7MZAUp3XpQhVgs2GuAbegX9v4gkom"><rect x="0" y="0" width="512" height="512" transform="matrix(1,0,0,1,0,0)" fill="rgb(255,255,255)"/></clipPath><g clip-path="url(#_clipPath_P6q7MZAUp3XpQhVgs2GuAbegX9v4gkom)"><g id="Group"><g id="g4502"><g id="g5125"><g id="text4489"><path d=" M 190.093 359.243 C 167.923 359.32 148.881 345.963 139.9 330.409 C 135.104 323.615 125.617 321.198 125.482 330.409 L 125.482 372.939 C 125.482 390.026 119.253 404.799 106.794 417.258 C 94.69 429.362 79.917 435.413 62.474 435.413 C 45.387 435.413 30.614 429.362 18.155 417.258 C 6.052 404.799 0 390.026 0 372.939 L 0 139.061 C 0 125.89 3.738 113.965 11.213 103.285 C 19.045 92.25 29.012 84.596 41.116 80.325 C 47.879 77.833 54.999 76.587 62.474 76.587 C 81.697 76.587 97.716 84.062 110.531 99.013 C 117.295 106.489 121.211 110.405 122.279 110.761 C 122.279 110.761 173.043 172.145 174.467 173.213 C 175.891 174.281 180.073 182.446 190.093 182.446 C 200.112 182.446 204.829 174.281 206.253 173.213 C 207.676 172.145 258.44 110.761 258.44 110.761 C 258.796 111.117 262.534 107.201 269.654 99.013 C 282.825 84.062 299.022 76.587 318.245 76.587 C 325.364 76.587 332.484 77.833 339.603 80.325 C 351.707 84.596 361.496 92.25 368.972 103.285 C 376.803 113.965 380.719 125.89 380.719 139.061 L 380.719 372.939 C 380.719 390.026 374.489 404.799 362.03 417.258 C 349.927 429.362 335.154 435.413 317.711 435.413 C 300.624 435.413 285.851 429.362 273.391 417.258 C 261.288 404.799 255.237 390.026 255.237 372.939 L 255.237 330.409 C 254.184 318.802 243.925 326.116 240.285 330.409 C 230.674 348.208 212.262 359.167 190.093 359.243 Z M 457.535 184.448 Q 435.109 184.448 419.09 168.963 Q 403.605 152.944 403.605 130.518 Q 403.605 108.091 419.09 92.606 Q 435.109 76.587 457.535 76.587 Q 479.962 76.587 495.981 92.606 Q 512 108.091 512 130.518 Q 512 152.944 495.981 168.963 Q 479.962 184.448 457.535 184.448 Z M 458.069 195.128 Q 480.496 195.128 495.981 211.147 Q 512 227.166 512 249.592 L 512 381.482 Q 512 403.909 495.981 419.928 Q 480.496 435.413 458.069 435.413 Q 435.643 435.413 419.624 419.928 Q 403.605 403.909 403.605 381.482 L 403.605 249.592 Q 403.605 227.166 419.624 211.147 Q 435.643 195.128 458.069 195.128 Z " fill-rule="evenodd" fill="rgb(157,157,157)"/></g></g></g></g></g></g></svg> \ No newline at end of file
diff --git a/src/client/app/auth/script.ts b/src/client/app/auth/script.ts
deleted file mode 100644
index 91bb24b108..0000000000
--- a/src/client/app/auth/script.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Authorize Form
- */
-
-import VueRouter from 'vue-router';
-
-// Style
-import './style.styl';
-
-import init from '../init';
-import Index from './views/index.vue';
-import NotFound from '../common/views/pages/not-found.vue';
-
-/**
- * init
- */
-init(launch => {
- // Init router
- const router = new VueRouter({
- mode: 'history',
- base: '/auth/',
- routes: [
- { path: '/:token', component: Index },
- { path: '*', component: NotFound }
- ]
- });
-
- // Launch the app
- launch(router);
-});
diff --git a/src/client/app/auth/style.styl b/src/client/app/auth/style.styl
deleted file mode 100644
index bd25e1b572..0000000000
--- a/src/client/app/auth/style.styl
+++ /dev/null
@@ -1,15 +0,0 @@
-@import "../app"
-@import "../reset"
-
-html
- background #eee
-
- @media (max-width 600px)
- background #fff
-
-body
- margin 0
- padding 32px 0
-
- @media (max-width 600px)
- padding 0
diff --git a/src/client/app/auth/views/form.vue b/src/client/app/auth/views/form.vue
deleted file mode 100644
index 064dbf3887..0000000000
--- a/src/client/app/auth/views/form.vue
+++ /dev/null
@@ -1,141 +0,0 @@
-<template>
-<div class="form">
- <header>
- <h1 v-html="$t('share-access', { name })"></h1>
- <img :src="app.iconUrl"/>
- </header>
- <div class="app">
- <section>
- <h2>{{ app.name }}</h2>
- <p class="id">{{ app.id }}</p>
- <p class="description">{{ app.description }}</p>
- </section>
- <section>
- <h2>{{ $t('permission-ask') }}</h2>
- <ul>
- <template v-for="p in app.permission">
- <li :key="p">{{ $t(`@.permissions.${p}`) }}</li>
- </template>
- </ul>
- </section>
- </div>
- <div class="action">
- <button @click="cancel">{{ $t('cancel') }}</button>
- <button @click="accept">{{ $t('accept') }}</button>
- </div>
-</div>
-</template>
-
-<script lang="ts">
-import Vue from 'vue';
-import i18n from '../../i18n';
-
-export default Vue.extend({
- i18n: i18n('auth/views/form.vue'),
- props: ['session'],
- computed: {
- name(): string {
- const el = document.createElement('div');
- el.textContent = this.app.name
- return el.innerHTML;
- },
- app(): any {
- return this.session.app;
- }
- },
- methods: {
- cancel() {
- this.$root.api('auth/deny', {
- token: this.session.token
- }).then(() => {
- this.$emit('denied');
- });
- },
-
- accept() {
- this.$root.api('auth/accept', {
- token: this.session.token
- }).then(() => {
- this.$emit('accepted');
- });
- }
- }
-});
-</script>
-
-<style lang="stylus" scoped>
-.form
-
- > header
- > h1
- margin 0
- padding 32px 32px 20px 32px
- font-size 24px
- font-weight normal
- color #777
-
- i
- color #77aeca
-
- &:before
- content '「'
-
- &:after
- content '」'
-
- b
- color #666
-
- > img
- display block
- z-index 1
- width 84px
- height 84px
- margin 0 auto -38px auto
- border solid 5px #fff
- border-radius 100%
- box-shadow 0 2px 2px rgba(#000, 0.1)
-
- > .app
- padding 44px 16px 0 16px
- color #555
- background #eee
- box-shadow 0 2px 2px rgba(#000, 0.1) inset
-
- &:after
- content ''
- display block
- clear both
-
- > section
- float left
- width 50%
- padding 8px
- text-align left
-
- > h2
- margin 0
- font-size 16px
- color #777
-
- > .action
- padding 16px
-
- > button
- margin 0 8px
- padding 0
-
- @media (max-width 600px)
- > header
- > img
- box-shadow none
-
- > .app
- box-shadow none
-
- @media (max-width 500px)
- > header
- > h1
- font-size 16px
-
-</style>
diff --git a/src/client/app/auth/views/index.vue b/src/client/app/auth/views/index.vue
deleted file mode 100644
index ad9b1e4e35..0000000000
--- a/src/client/app/auth/views/index.vue
+++ /dev/null
@@ -1,153 +0,0 @@
-<template>
-<div class="index">
- <main v-if="$store.getters.isSignedIn">
- <p class="fetching" v-if="fetching">{{ $t('loading') }}<mk-ellipsis/></p>
- <x-form
- class="form"
- ref="form"
- v-if="state == 'waiting'"
- :session="session"
- @denied="state = 'denied'"
- @accepted="accepted"
- />
- <div class="denied" v-if="state == 'denied'">
- <h1>{{ $t('denied') }}</h1>
- <p>{{ $t('denied-paragraph') }}</p>
- </div>
- <div class="accepted" v-if="state == 'accepted'">
- <h1>{{ session.app.isAuthorized ? this.$t('already-authorized') : this.$t('allowed') }}</h1>
- <p v-if="session.app.callbackUrl">{{ $t('callback-url') }}<mk-ellipsis/></p>
- <p v-if="!session.app.callbackUrl">{{ $t('please-go-back') }}</p>
- </div>
- <div class="error" v-if="state == 'fetch-session-error'">
- <p>{{ $t('error') }}</p>
- </div>
- </main>
- <main class="signin" v-if="!$store.getters.isSignedIn">
- <h1>{{ $t('sign-in') }}</h1>
- <mk-signin/>
- </main>
- <footer><img src="/assets/auth/icon.svg" alt="Misskey"/></footer>
-</div>
-</template>
-
-<script lang="ts">
-import Vue from 'vue';
-import i18n from '../../i18n';
-import XForm from './form.vue';
-
-export default Vue.extend({
- i18n: i18n('auth/views/index.vue'),
- components: {
- XForm
- },
- data() {
- return {
- state: null,
- session: null,
- fetching: true
- };
- },
- computed: {
- token(): string {
- return this.$route.params.token;
- }
- },
- mounted() {
- if (!this.$store.getters.isSignedIn) return;
-
- // Fetch session
- this.$root.api('auth/session/show', {
- token: this.token
- }).then(session => {
- this.session = session;
- this.fetching = false;
-
- // 既に連携していた場合
- if (this.session.app.isAuthorized) {
- this.$root.api('auth/accept', {
- token: this.session.token
- }).then(() => {
- this.accepted();
- });
- } else {
- this.state = 'waiting';
- }
- }).catch(error => {
- this.state = 'fetch-session-error';
- this.fetching = false;
- });
- },
- methods: {
- accepted() {
- this.state = 'accepted';
- if (this.session.app.callbackUrl) {
- location.href = `${this.session.app.callbackUrl}?token=${this.session.token}`;
- }
- }
- }
-});
-</script>
-
-<style lang="stylus" scoped>
-.index
-
- > main
- width 100%
- max-width 500px
- margin 0 auto
- text-align center
- background #fff
- box-shadow 0 4px 16px rgba(#000, 0.2)
-
- > .fetching
- margin 0
- padding 32px
- color #555
-
- > div:not(.form)
- padding 64px
-
- > h1
- margin 0 0 8px 0
- padding 0
- font-size 20px
- font-weight normal
-
- > p
- margin 0
- color #555
-
- &.denied > h1
- color #e65050
-
- &.accepted > h1
- color #54af7c
-
- &.signin
- padding 32px 32px 16px 32px
-
- > h1
- margin 0 0 22px 0
- padding 0
- font-size 20px
- font-weight normal
- color #555
-
- @media (max-width 600px)
- max-width none
- box-shadow none
-
- @media (max-width 500px)
- > div
- > h1
- font-size 16px
-
- > footer
- > img
- display block
- width 32px
- height 32px
- margin 16px auto
-
-</style>