ghostの設定をDBに保存するように
This commit is contained in:
		
							parent
							
								
									87d4452d19
								
							
						
					
					
						commit
						2de48110bb
					
				
					 9 changed files with 55 additions and 21 deletions
				
			
		| 
						 | 
				
			
			@ -98,17 +98,24 @@ export const meta = {
 | 
			
		|||
		},
 | 
			
		||||
 | 
			
		||||
		recaptchaSiteKey: {
 | 
			
		||||
			validator: $.str.optional,
 | 
			
		||||
			validator: $.str.optional.nullable,
 | 
			
		||||
			desc: {
 | 
			
		||||
				'ja-JP': 'reCAPTCHA site key'
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		recaptchaSecretKey: {
 | 
			
		||||
			validator: $.str.optional,
 | 
			
		||||
			validator: $.str.optional.nullable,
 | 
			
		||||
			desc: {
 | 
			
		||||
				'ja-JP': 'reCAPTCHA secret key'
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		proxyAccount: {
 | 
			
		||||
			validator: $.str.optional.nullable,
 | 
			
		||||
			desc: {
 | 
			
		||||
				'ja-JP': 'Proxy account username'
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -172,6 +179,10 @@ export default define(meta, (ps) => new Promise(async (res, rej) => {
 | 
			
		|||
		set.recaptchaSecretKey = ps.recaptchaSecretKey;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (ps.proxyAccount !== undefined) {
 | 
			
		||||
		set.proxyAccount = ps.proxyAccount;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	await Meta.update({}, {
 | 
			
		||||
		$set: set
 | 
			
		||||
	}, { upsert: true });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,6 +85,7 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
 | 
			
		|||
	if (me && me.isAdmin) {
 | 
			
		||||
		response.hidedTags = instance.hidedTags;
 | 
			
		||||
		response.recaptchaSecretKey = instance.recaptchaSecretKey;
 | 
			
		||||
		response.proxyAccount = instance.proxyAccount;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	res(response);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
import $ from 'cafy'; import ID, { transform } from '../../../../../misc/cafy-id';
 | 
			
		||||
import UserList from '../../../../../models/user-list';
 | 
			
		||||
import User, { pack as packUser, isRemoteUser, getGhost } from '../../../../../models/user';
 | 
			
		||||
import User, { pack as packUser, isRemoteUser, fetchProxyAccount } from '../../../../../models/user';
 | 
			
		||||
import { publishUserListStream } from '../../../../../stream';
 | 
			
		||||
import ap from '../../../../../remote/activitypub/renderer';
 | 
			
		||||
import renderFollow from '../../../../../remote/activitypub/renderer/follow';
 | 
			
		||||
| 
						 | 
				
			
			@ -71,8 +71,8 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
 | 
			
		|||
 | 
			
		||||
	// このインスタンス内にこのリモートユーザーをフォローしているユーザーがいなくても投稿を受け取るためにダミーのユーザーがフォローしたということにする
 | 
			
		||||
	if (isRemoteUser(user)) {
 | 
			
		||||
		const ghost = await getGhost();
 | 
			
		||||
		const content = ap(renderFollow(ghost, user));
 | 
			
		||||
		deliver(ghost, content, user.inbox);
 | 
			
		||||
		const proxy = await fetchProxyAccount();
 | 
			
		||||
		const content = ap(renderFollow(proxy, user));
 | 
			
		||||
		deliver(proxy, content, user.inbox);
 | 
			
		||||
	}
 | 
			
		||||
}));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue