mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	feat: Like(Note) and Undo(Like); federating likes
This commit is contained in:
		| @@ -94,7 +94,7 @@ Helpers.resolveLocalUid = async (input) => { | ||||
| 		const { host, pathname } = new URL(input); | ||||
|  | ||||
| 		if (host === nconf.get('url_parsed').host) { | ||||
| 			const [type, value] = pathname.replace(nconf.get('relative_path'), '').split('/').filter(Boolean)[1]; | ||||
| 			const [type, value] = pathname.replace(nconf.get('relative_path'), '').split('/').filter(Boolean); | ||||
| 			if (type === 'uid') { | ||||
| 				return value; | ||||
| 			} | ||||
| @@ -111,3 +111,17 @@ Helpers.resolveLocalUid = async (input) => { | ||||
|  | ||||
| 	return await user.getUidByUserslug(slug); | ||||
| }; | ||||
|  | ||||
| Helpers.resolveLocalPid = async (uri) => { | ||||
| 	const { host, pathname } = new URL(uri); | ||||
| 	if (host === nconf.get('url_parsed').host) { | ||||
| 		const [type, value] = pathname.replace(nconf.get('relative_path'), '').split('/').filter(Boolean); | ||||
| 		if (type !== 'post') { | ||||
| 			throw new Error('[[error:activitypub.invalid-id]]'); | ||||
| 		} | ||||
|  | ||||
| 		return value; | ||||
| 	} | ||||
|  | ||||
| 	throw new Error('[[error:activitypub.invalid-id]]'); | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user