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']
|
||||
/** @type {string} */
|
||||
const profileDescription = payloadJson['http://ariadne.id/description']
|
||||
/** @type {string} */
|
||||
const profileThemeColor = payloadJson['http://ariadne.id/color']
|
||||
/** @type {string[]} */
|
||||
const profileClaims = payloadJson['http://ariadne.id/claims']
|
||||
|
||||
|
@ -139,6 +141,9 @@ export async function parseProfileJws (profileJws, uri) {
|
|||
if (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])
|
||||
profile.publicKey.fingerprint = fp
|
||||
|
|
|
@ -60,6 +60,12 @@ export class Persona {
|
|||
* @public
|
||||
*/
|
||||
this.avatarUrl = null
|
||||
/**
|
||||
* Theme color
|
||||
* @type {string | null}
|
||||
* @public
|
||||
*/
|
||||
this.themeColor = null
|
||||
/**
|
||||
* List of identity claims
|
||||
* @type {import('./claim.js').Claim[]}
|
||||
|
@ -164,6 +170,7 @@ export class Persona {
|
|||
email: this.email,
|
||||
description: this.description,
|
||||
avatarUrl: this.avatarUrl,
|
||||
themeColor: this.themeColor,
|
||||
isRevoked: this.isRevoked,
|
||||
claims: this.claims.map(x => x.toJSON())
|
||||
}
|
||||
|
@ -183,6 +190,7 @@ function importJsonPersonaVersion2 (personaObject) {
|
|||
persona.email = personaObject.email
|
||||
persona.description = personaObject.description
|
||||
persona.avatarUrl = personaObject.avatarUrl
|
||||
persona.themeColor = personaObject.avatarUrl
|
||||
persona.isRevoked = personaObject.isRevoked
|
||||
|
||||
return persona
|
||||
|
|
Loading…
Reference in a new issue