mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 15:34:13 +00:00 
			
		
		
		
	enhance: プラグイン削除時にアクセストークンも削除する (#12167)
* (enhance) プラグイン削除時にトークンも削除 * update changelog
This commit is contained in:
		
							parent
							
								
									8a2309ba7d
								
							
						
					
					
						commit
						e5ff8d8445
					
				
					 3 changed files with 27 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -23,6 +23,7 @@
 | 
			
		|||
	- 外部サイトでの実装が必要です。詳細は Misskey Hub をご覧ください
 | 
			
		||||
	  https://misskey-hub.net/docs/advanced/publish-on-your-website.html
 | 
			
		||||
- Feat: AiScript関数`Mk:nyaize()`が追加されました
 | 
			
		||||
- Enhance: プラグインを削除した際には、使用されていたアクセストークンも同時に削除されるようになりました
 | 
			
		||||
- Fix: 投稿フォームでのユーザー変更がプレビューに反映されない問題を修正
 | 
			
		||||
- Fix: ユーザーページの ノート > ファイル付き タブにリプライが表示されてしまう
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,8 +18,12 @@ export const paramDef = {
 | 
			
		|||
	type: 'object',
 | 
			
		||||
	properties: {
 | 
			
		||||
		tokenId: { type: 'string', format: 'misskey:id' },
 | 
			
		||||
		token: { type: 'string' },
 | 
			
		||||
	},
 | 
			
		||||
	required: ['tokenId'],
 | 
			
		||||
	anyOf: [
 | 
			
		||||
		{ required: ['tokenId'] },
 | 
			
		||||
		{ required: ['token'] },
 | 
			
		||||
	],
 | 
			
		||||
} as const;
 | 
			
		||||
 | 
			
		||||
@Injectable()
 | 
			
		||||
| 
						 | 
				
			
			@ -29,13 +33,24 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
			
		|||
		private accessTokensRepository: AccessTokensRepository,
 | 
			
		||||
	) {
 | 
			
		||||
		super(meta, paramDef, async (ps, me) => {
 | 
			
		||||
			const tokenExist = await this.accessTokensRepository.exist({ where: { id: ps.tokenId } });
 | 
			
		||||
			if (ps.tokenId) {
 | 
			
		||||
				const tokenExist = await this.accessTokensRepository.exist({ where: { id: ps.tokenId } });
 | 
			
		||||
 | 
			
		||||
			if (tokenExist) {
 | 
			
		||||
				await this.accessTokensRepository.delete({
 | 
			
		||||
					id: ps.tokenId,
 | 
			
		||||
					userId: me.id,
 | 
			
		||||
				});
 | 
			
		||||
				if (tokenExist) {
 | 
			
		||||
					await this.accessTokensRepository.delete({
 | 
			
		||||
						id: ps.tokenId,
 | 
			
		||||
						userId: me.id,
 | 
			
		||||
					});
 | 
			
		||||
				}
 | 
			
		||||
			} else if (ps.token) {
 | 
			
		||||
				const tokenExist = await this.accessTokensRepository.exist({ where: { token: ps.token } });
 | 
			
		||||
 | 
			
		||||
				if (tokenExist) {
 | 
			
		||||
					await this.accessTokensRepository.delete({
 | 
			
		||||
						token: ps.token,
 | 
			
		||||
						userId: me.id,
 | 
			
		||||
					});
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -77,9 +77,11 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
 | 
			
		|||
 | 
			
		||||
const plugins = ref(ColdDeviceStorage.get('plugins'));
 | 
			
		||||
 | 
			
		||||
function uninstall(plugin) {
 | 
			
		||||
async function uninstall(plugin) {
 | 
			
		||||
	ColdDeviceStorage.set('plugins', plugins.value.filter(x => x.id !== plugin.id));
 | 
			
		||||
	os.success();
 | 
			
		||||
	await os.apiWithDialog('i/revoke-token', {
 | 
			
		||||
		token: plugin.token,
 | 
			
		||||
	});
 | 
			
		||||
	nextTick(() => {
 | 
			
		||||
		unisonReload();
 | 
			
		||||
	});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue