mirror of
				https://github.com/Blah-IM/Weblah.git
				synced 2025-11-04 03:41:37 +00:00 
			
		
		
		
	chore: update @blah-im/core and use ID URL validation from it
Upgrade pnpm to 10.10.0 and @blah-im/core to 0.7.0, refactor identity URL validation to use the core library's getIdentityDescriptionFileURL function
This commit is contained in:
		
							parent
							
								
									c5716718bf
								
							
						
					
					
						commit
						757175a5c7
					
				
					 3 changed files with 18 additions and 23 deletions
				
			
		| 
						 | 
					@ -13,7 +13,7 @@
 | 
				
			||||||
		"format": "prettier --write ."
 | 
							"format": "prettier --write ."
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	"type": "module",
 | 
						"type": "module",
 | 
				
			||||||
	"packageManager": "pnpm@10.9.0",
 | 
						"packageManager": "pnpm@10.10.0",
 | 
				
			||||||
	"devDependencies": {
 | 
						"devDependencies": {
 | 
				
			||||||
		"@sveltejs/adapter-auto": "^6.0.0",
 | 
							"@sveltejs/adapter-auto": "^6.0.0",
 | 
				
			||||||
		"@sveltejs/kit": "^2.20.7",
 | 
							"@sveltejs/kit": "^2.20.7",
 | 
				
			||||||
| 
						 | 
					@ -37,7 +37,7 @@
 | 
				
			||||||
		"vitest": "^3.1.2"
 | 
							"vitest": "^3.1.2"
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	"dependencies": {
 | 
						"dependencies": {
 | 
				
			||||||
		"@blah-im/core": "^0.6.0",
 | 
							"@blah-im/core": "^0.7.0",
 | 
				
			||||||
		"@zeabur/svelte-adapter": "^1.0.0",
 | 
							"@zeabur/svelte-adapter": "^1.0.0",
 | 
				
			||||||
		"bits-ui": "^1.3.19",
 | 
							"bits-ui": "^1.3.19",
 | 
				
			||||||
		"canonicalize": "^2.1.0",
 | 
							"canonicalize": "^2.1.0",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										10
									
								
								pnpm-lock.yaml
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										10
									
								
								pnpm-lock.yaml
									
										
									
										generated
									
									
									
								
							| 
						 | 
					@ -9,8 +9,8 @@ importers:
 | 
				
			||||||
  .:
 | 
					  .:
 | 
				
			||||||
    dependencies:
 | 
					    dependencies:
 | 
				
			||||||
      '@blah-im/core':
 | 
					      '@blah-im/core':
 | 
				
			||||||
        specifier: ^0.6.0
 | 
					        specifier: ^0.7.0
 | 
				
			||||||
        version: 0.6.0
 | 
					        version: 0.7.0
 | 
				
			||||||
      '@zeabur/svelte-adapter':
 | 
					      '@zeabur/svelte-adapter':
 | 
				
			||||||
        specifier: ^1.0.0
 | 
					        specifier: ^1.0.0
 | 
				
			||||||
        version: 1.0.0(@sveltejs/kit@2.20.7(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.28.2)(vite@6.3.3(jiti@2.4.2)(lightningcss@1.29.2)))(svelte@5.28.2)(vite@6.3.3(jiti@2.4.2)(lightningcss@1.29.2)))
 | 
					        version: 1.0.0(@sveltejs/kit@2.20.7(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.28.2)(vite@6.3.3(jiti@2.4.2)(lightningcss@1.29.2)))(svelte@5.28.2)(vite@6.3.3(jiti@2.4.2)(lightningcss@1.29.2)))
 | 
				
			||||||
| 
						 | 
					@ -133,8 +133,8 @@ packages:
 | 
				
			||||||
    resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==}
 | 
					    resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==}
 | 
				
			||||||
    engines: {node: '>=6.0.0'}
 | 
					    engines: {node: '>=6.0.0'}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  '@blah-im/core@0.6.0':
 | 
					  '@blah-im/core@0.7.0':
 | 
				
			||||||
    resolution: {integrity: sha512-CBYFGbCDkQ1vXGYskKSxCWiknaga63NCtmpraZyWjHq8ZyNcG6UYIe6K0DMCJ7BtkbImW+7jk/k4Z2J+0e2kSw==}
 | 
					    resolution: {integrity: sha512-S3XhaETyRdz9kdeMHrk0yokDYbWaFKvC12uJjd4FGAZZx+40w9+RUCrDxkrqifn8QOiZR3xw6eAryeLILNuIcA==}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  '@esbuild/aix-ppc64@0.19.12':
 | 
					  '@esbuild/aix-ppc64@0.19.12':
 | 
				
			||||||
    resolution: {integrity: sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==}
 | 
					    resolution: {integrity: sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==}
 | 
				
			||||||
| 
						 | 
					@ -2074,7 +2074,7 @@ snapshots:
 | 
				
			||||||
      '@jridgewell/gen-mapping': 0.3.8
 | 
					      '@jridgewell/gen-mapping': 0.3.8
 | 
				
			||||||
      '@jridgewell/trace-mapping': 0.3.25
 | 
					      '@jridgewell/trace-mapping': 0.3.25
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  '@blah-im/core@0.6.0':
 | 
					  '@blah-im/core@0.7.0':
 | 
				
			||||||
    dependencies:
 | 
					    dependencies:
 | 
				
			||||||
      zod: 3.24.3
 | 
					      zod: 3.24.3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,8 @@
 | 
				
			||||||
import { BlahIdentity, blahIdentityDescriptionSchema } from '@blah-im/core/identity';
 | 
					import {
 | 
				
			||||||
 | 
						BlahIdentity,
 | 
				
			||||||
 | 
						blahIdentityDescriptionSchema,
 | 
				
			||||||
 | 
						getIdentityDescriptionFileURL
 | 
				
			||||||
 | 
					} from '@blah-im/core/identity';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function idURLToUsername(idURL: string): string {
 | 
					export function idURLToUsername(idURL: string): string {
 | 
				
			||||||
	const url = new URL(idURL);
 | 
						const url = new URL(idURL);
 | 
				
			||||||
| 
						 | 
					@ -24,22 +28,13 @@ export type IDURLValidity =
 | 
				
			||||||
			  }
 | 
								  }
 | 
				
			||||||
	  ));
 | 
						  ));
 | 
				
			||||||
export async function validateIDURL(url: string, identity: BlahIdentity): Promise<IDURLValidity> {
 | 
					export async function validateIDURL(url: string, identity: BlahIdentity): Promise<IDURLValidity> {
 | 
				
			||||||
	const idURL = URL.parse(url);
 | 
						let profileFileURL: string;
 | 
				
			||||||
	if (
 | 
					 | 
				
			||||||
		!idURL ||
 | 
					 | 
				
			||||||
		idURL.protocol !== 'https:' ||
 | 
					 | 
				
			||||||
		idURL.pathname !== '/' ||
 | 
					 | 
				
			||||||
		idURL.search ||
 | 
					 | 
				
			||||||
		idURL.username ||
 | 
					 | 
				
			||||||
		idURL.password
 | 
					 | 
				
			||||||
	)
 | 
					 | 
				
			||||||
		return { valid: false, reason: 'invalid-url' };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const profileFileURL = (() => {
 | 
						try {
 | 
				
			||||||
		let url = idURL;
 | 
							profileFileURL = getIdentityDescriptionFileURL(url);
 | 
				
			||||||
		url.pathname = identityDescriptionFilePath;
 | 
						} catch (e) {
 | 
				
			||||||
		return url.toString();
 | 
							return { valid: false, reason: 'invalid-url' };
 | 
				
			||||||
	})();
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	try {
 | 
						try {
 | 
				
			||||||
		const response = await fetch(profileFileURL, {
 | 
							const response = await fetch(profileFileURL, {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue