fix: update lobste.rs URL syntax

This commit is contained in:
Yarmo Mackenbach 2023-10-07 12:49:35 +02:00
parent a616dcd66d
commit 34ad2d718d
No known key found for this signature in database
GPG key ID: C248C28D432560ED

View file

@ -16,7 +16,7 @@ limitations under the License.
import * as E from '../enums.js'
import { ServiceProvider } from '../serviceProvider.js'
export const reURI = /^https:\/\/lobste\.rs\/u\/(.*)\/?/
export const reURI = /^https:\/\/lobste\.rs\/(:?~|u\/)(.*)\/?/
/**
* @function
@ -33,7 +33,7 @@ export function processURI (uri) {
},
profile: {
display: match[1],
uri,
uri: `https://lobste.rs/~${match[1]}`,
qr: null
},
claim: {
@ -42,11 +42,11 @@ export function processURI (uri) {
},
proof: {
request: {
uri: `https://lobste.rs/u/${match[1]}.json`,
uri: `https://lobste.rs/~${match[1]}.json`,
fetcher: E.Fetcher.HTTP,
accessRestriction: E.ProofAccessRestriction.NOCORS,
data: {
url: `https://lobste.rs/u/${match[1]}.json`,
url: `https://lobste.rs/~${match[1]}.json`,
format: E.ProofFormat.JSON
}
},
@ -64,6 +64,10 @@ export function processURI (uri) {
}
export const tests = [
{
uri: 'https://lobste.rs/~Alice',
shouldMatch: true
},
{
uri: 'https://lobste.rs/u/Alice',
shouldMatch: true
@ -72,6 +76,10 @@ export const tests = [
uri: 'https://lobste.rs/u/Alice/',
shouldMatch: true
},
{
uri: 'https://domain.org/~Alice',
shouldMatch: false
},
{
uri: 'https://domain.org/u/Alice',
shouldMatch: false