mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-12-12 21:58:58 +09:00
nanka iroiro
This commit is contained in:
parent
0aa6d848fa
commit
bc1698e755
@ -46,6 +46,7 @@ export default [
|
|||||||
{ name: 'i/appdata/get', shouldBeSignin: true },
|
{ name: 'i/appdata/get', shouldBeSignin: true },
|
||||||
{ name: 'i/appdata/set', shouldBeSignin: true },
|
{ name: 'i/appdata/set', shouldBeSignin: true },
|
||||||
{ name: 'i/signin_history', shouldBeSignin: true, kind: 'account-read' },
|
{ name: 'i/signin_history', shouldBeSignin: true, kind: 'account-read' },
|
||||||
|
{ name: 'i/authorized_apps', shouldBeSignin: true, secure: true },
|
||||||
|
|
||||||
{ name: 'i/notifications', shouldBeSignin: true, kind: 'notification-read' },
|
{ name: 'i/notifications', shouldBeSignin: true, kind: 'notification-read' },
|
||||||
{ name: 'notifications/delete', shouldBeSignin: true, kind: 'notification-write' },
|
{ name: 'notifications/delete', shouldBeSignin: true, kind: 'notification-write' },
|
||||||
|
60
src/api/endpoints/i/authorized_apps.js
Normal file
60
src/api/endpoints/i/authorized_apps.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies
|
||||||
|
*/
|
||||||
|
import * as mongo from 'mongodb';
|
||||||
|
import AccessToken from '../../models/access-token';
|
||||||
|
import App from '../../models/app';
|
||||||
|
import serialize from '../../serializers/app';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get authorized apps of my account
|
||||||
|
*
|
||||||
|
* @param {Object} params
|
||||||
|
* @param {Object} user
|
||||||
|
* @return {Promise<object>}
|
||||||
|
*/
|
||||||
|
module.exports = (params, user) =>
|
||||||
|
new Promise(async (res, rej) =>
|
||||||
|
{
|
||||||
|
// Get 'limit' parameter
|
||||||
|
let limit = params.limit;
|
||||||
|
if (limit !== undefined && limit !== null) {
|
||||||
|
limit = parseInt(limit, 10);
|
||||||
|
|
||||||
|
// From 1 to 100
|
||||||
|
if (!(1 <= limit && limit <= 100)) {
|
||||||
|
return rej('invalid limit range');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
limit = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get 'offset' parameter
|
||||||
|
let offset = params.offset;
|
||||||
|
if (offset !== undefined && offset !== null) {
|
||||||
|
offset = parseInt(offset, 10);
|
||||||
|
} else {
|
||||||
|
offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get 'sort' parameter
|
||||||
|
let sort = params.sort || 'desc';
|
||||||
|
|
||||||
|
// Get tokens
|
||||||
|
const tokens = await AccessToken
|
||||||
|
.find({
|
||||||
|
user_id: user._id
|
||||||
|
}, {
|
||||||
|
limit: limit,
|
||||||
|
skip: offset,
|
||||||
|
sort: {
|
||||||
|
_id: sort == 'asc' ? 1 : -1
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Serialize
|
||||||
|
res(await Promise.all(tokens.map(async token =>
|
||||||
|
await serialize(token.app_id))));
|
||||||
|
});
|
34
src/web/app/common/tags/authorized-apps.tag
Normal file
34
src/web/app/common/tags/authorized-apps.tag
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<mk-authorized-apps>
|
||||||
|
<p class="none" if={ apps.length == 0 }>連携しているアプリケーションはありません。</p>
|
||||||
|
<div class="apps" if={ apps.length != 0 }>
|
||||||
|
<div each={ apps }>
|
||||||
|
<p><b>{ app.name }</b></p>
|
||||||
|
<p>{ app.description }</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<style type="stylus">
|
||||||
|
:scope
|
||||||
|
display block
|
||||||
|
|
||||||
|
> .apps
|
||||||
|
> div
|
||||||
|
padding 16px 0 0 0
|
||||||
|
border-bottom solid 1px #eee
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
@mixin \api
|
||||||
|
|
||||||
|
@apps = []
|
||||||
|
@fetching = true
|
||||||
|
|
||||||
|
@on \mount ~>
|
||||||
|
@api \i/authorized_apps
|
||||||
|
.then (apps) ~>
|
||||||
|
@apps = apps
|
||||||
|
@fetching = false
|
||||||
|
@update!
|
||||||
|
.catch (err) ~>
|
||||||
|
console.error err
|
||||||
|
</script>
|
||||||
|
</mk-authorized-apps>
|
@ -17,3 +17,4 @@ require('./copyright.tag');
|
|||||||
require('./signin-history.tag');
|
require('./signin-history.tag');
|
||||||
require('./api-info.tag');
|
require('./api-info.tag');
|
||||||
require('./twitter-setting.tag');
|
require('./twitter-setting.tag');
|
||||||
|
require('./authorized-apps.tag');
|
||||||
|
@ -63,6 +63,11 @@
|
|||||||
</label>
|
</label>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="apps" show={ page == 'apps' }>
|
||||||
|
<h1>アプリケーション</h1>
|
||||||
|
<mk-authorized-apps></mk-authorized-apps>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="twitter" show={ page == 'twitter' }>
|
<section class="twitter" show={ page == 'twitter' }>
|
||||||
<h1>Twitter</h1>
|
<h1>Twitter</h1>
|
||||||
<mk-twitter-setting></mk-twitter-setting>
|
<mk-twitter-setting></mk-twitter-setting>
|
||||||
|
@ -19,6 +19,7 @@ module.exports = (me) ~>
|
|||||||
route \/i/settings/signin-history settings-signin
|
route \/i/settings/signin-history settings-signin
|
||||||
route \/i/settings/api settings-api
|
route \/i/settings/api settings-api
|
||||||
route \/i/settings/twitter settings-twitter
|
route \/i/settings/twitter settings-twitter
|
||||||
|
route \/i/settings/authorized-apps settings-authorized-apps
|
||||||
route \/post/new new-post
|
route \/post/new new-post
|
||||||
route \/post::post post
|
route \/post::post post
|
||||||
route \/search::query search
|
route \/search::query search
|
||||||
@ -61,6 +62,8 @@ module.exports = (me) ~>
|
|||||||
mount document.create-element \mk-api-info-page
|
mount document.create-element \mk-api-info-page
|
||||||
function settings-twitter
|
function settings-twitter
|
||||||
mount document.create-element \mk-twitter-setting-page
|
mount document.create-element \mk-twitter-setting-page
|
||||||
|
function settings-authorized-apps
|
||||||
|
mount document.create-element \mk-authorized-apps-page
|
||||||
|
|
||||||
# 検索
|
# 検索
|
||||||
function search ctx
|
function search ctx
|
||||||
|
@ -17,6 +17,7 @@ require('./page/search.tag');
|
|||||||
require('./page/settings.tag');
|
require('./page/settings.tag');
|
||||||
require('./page/settings/signin.tag');
|
require('./page/settings/signin.tag');
|
||||||
require('./page/settings/api.tag');
|
require('./page/settings/api.tag');
|
||||||
|
require('./page/settings/authorized-apps.tag');
|
||||||
require('./page/settings/twitter.tag');
|
require('./page/settings/twitter.tag');
|
||||||
require('./home.tag');
|
require('./home.tag');
|
||||||
require('./home-timeline.tag');
|
require('./home-timeline.tag');
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<mk-ui ref="ui">
|
<mk-ui ref="ui">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a><i class="fa fa-user"></i>プロフィール</a></li>
|
<li><a><i class="fa fa-user"></i>プロフィール</a></li>
|
||||||
|
<li><a href="./settings/authorized-apps"><i class="fa fa-puzzle-piece"></i>アプリケーション</a></li>
|
||||||
<li><a href="./settings/twitter"><i class="fa fa-twitter"></i>Twitter連携</a></li>
|
<li><a href="./settings/twitter"><i class="fa fa-twitter"></i>Twitter連携</a></li>
|
||||||
<li><a href="./settings/signin-history"><i class="fa fa-sign-in"></i>ログイン履歴</a></li>
|
<li><a href="./settings/signin-history"><i class="fa fa-sign-in"></i>ログイン履歴</a></li>
|
||||||
<li><a href="./settings/api"><i class="fa fa-key"></i>API</a></li>
|
<li><a href="./settings/api"><i class="fa fa-key"></i>API</a></li>
|
||||||
|
16
src/web/app/mobile/tags/page/settings/authorized-apps.tag
Normal file
16
src/web/app/mobile/tags/page/settings/authorized-apps.tag
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<mk-authorized-apps-page>
|
||||||
|
<mk-ui ref="ui">
|
||||||
|
<mk-authorized-apps></mk-authorized-apps>
|
||||||
|
</mk-ui>
|
||||||
|
<style type="stylus">
|
||||||
|
:scope
|
||||||
|
display block
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
@mixin \ui
|
||||||
|
|
||||||
|
@on \mount ~>
|
||||||
|
document.title = 'Misskey | アプリケーション'
|
||||||
|
@ui.trigger \title '<i class="fa fa-puzzle-piece"></i>アプリケーション'
|
||||||
|
</script>
|
||||||
|
</mk-authorized-apps-page>
|
Loading…
Reference in New Issue
Block a user