Makelore 2.0 initial clean snapshot

This commit is contained in:
inman
2026-07-29 17:22:35 +08:00
commit b8ca3f8eea
694 changed files with 139782 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import { describe, expect, it } from 'vitest';
import {
findNianCodeDeepLinkUrl,
parseNianCodeDeepLinkUrl,
} from '@electron/main/app-deep-link';
describe('NianCode app deep links', () => {
it('parses desktop auth callback request ids from niancode links', () => {
expect(parseNianCodeDeepLinkUrl('niancode://auth/callback?request_id=desktop-request-id')).toEqual({
type: 'desktop-auth-callback',
requestId: 'desktop-request-id',
url: 'niancode://auth/callback?request_id=desktop-request-id',
});
});
it('rejects links that do not target the desktop auth callback', () => {
expect(parseNianCodeDeepLinkUrl('https://square.nianxx.cn/#desktop-auth?request_id=1')).toBeNull();
expect(parseNianCodeDeepLinkUrl('niancode://auth/callback')).toBeNull();
expect(parseNianCodeDeepLinkUrl('niancode://auth/callback?request_id=')).toBeNull();
expect(parseNianCodeDeepLinkUrl('niancode://auth/callback?request_id=1&access_token=secret')).toBeNull();
expect(parseNianCodeDeepLinkUrl('niancode://settings')).toBeNull();
});
it('finds the app link from platform launch arguments', () => {
expect(findNianCodeDeepLinkUrl([
'C:\\Program Files\\NianCode\\NianCode.exe',
'--flag',
'niancode://auth/callback?request_id=desktop-request-id',
])).toBe('niancode://auth/callback?request_id=desktop-request-id');
});
});