mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 22:49:28 -07:00
feat: support themeColor
This commit is contained in:
parent
2dd18395dd
commit
a3c9e9137d
2 changed files with 13 additions and 0 deletions
|
@ -130,6 +130,8 @@ export async function parseProfileJws (profileJws, uri) {
|
||||||
const profileName = payloadJson['http://ariadne.id/name']
|
const profileName = payloadJson['http://ariadne.id/name']
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
const profileDescription = payloadJson['http://ariadne.id/description']
|
const profileDescription = payloadJson['http://ariadne.id/description']
|
||||||
|
/** @type {string} */
|
||||||
|
const profileThemeColor = payloadJson['http://ariadne.id/color']
|
||||||
/** @type {string[]} */
|
/** @type {string[]} */
|
||||||
const profileClaims = payloadJson['http://ariadne.id/claims']
|
const profileClaims = payloadJson['http://ariadne.id/claims']
|
||||||
|
|
||||||
|
@ -139,6 +141,9 @@ export async function parseProfileJws (profileJws, uri) {
|
||||||
if (profileDescription) {
|
if (profileDescription) {
|
||||||
pe.setDescription(profileDescription)
|
pe.setDescription(profileDescription)
|
||||||
}
|
}
|
||||||
|
if (profileThemeColor && /^#([0-9A-F]{3}){1,2}$/i.test(profileThemeColor)) {
|
||||||
|
pe.themeColor = profileThemeColor
|
||||||
|
}
|
||||||
|
|
||||||
const profile = new Profile(ProfileType.ASP, uri, [pe])
|
const profile = new Profile(ProfileType.ASP, uri, [pe])
|
||||||
profile.publicKey.fingerprint = fp
|
profile.publicKey.fingerprint = fp
|
||||||
|
|
|
@ -60,6 +60,12 @@ export class Persona {
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
this.avatarUrl = null
|
this.avatarUrl = null
|
||||||
|
/**
|
||||||
|
* Theme color
|
||||||
|
* @type {string | null}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
this.themeColor = null
|
||||||
/**
|
/**
|
||||||
* List of identity claims
|
* List of identity claims
|
||||||
* @type {import('./claim.js').Claim[]}
|
* @type {import('./claim.js').Claim[]}
|
||||||
|
@ -164,6 +170,7 @@ export class Persona {
|
||||||
email: this.email,
|
email: this.email,
|
||||||
description: this.description,
|
description: this.description,
|
||||||
avatarUrl: this.avatarUrl,
|
avatarUrl: this.avatarUrl,
|
||||||
|
themeColor: this.themeColor,
|
||||||
isRevoked: this.isRevoked,
|
isRevoked: this.isRevoked,
|
||||||
claims: this.claims.map(x => x.toJSON())
|
claims: this.claims.map(x => x.toJSON())
|
||||||
}
|
}
|
||||||
|
@ -183,6 +190,7 @@ function importJsonPersonaVersion2 (personaObject) {
|
||||||
persona.email = personaObject.email
|
persona.email = personaObject.email
|
||||||
persona.description = personaObject.description
|
persona.description = personaObject.description
|
||||||
persona.avatarUrl = personaObject.avatarUrl
|
persona.avatarUrl = personaObject.avatarUrl
|
||||||
|
persona.themeColor = personaObject.avatarUrl
|
||||||
persona.isRevoked = personaObject.isRevoked
|
persona.isRevoked = personaObject.isRevoked
|
||||||
|
|
||||||
return persona
|
return persona
|
||||||
|
|
Loading…
Reference in a new issue