feat: 支持配置证书文本模板和作者显示方式
This commit is contained in:
@@ -29,6 +29,16 @@ export function safeCertificateUrl(value: unknown, environment: DepositEnvironme
|
||||
|
||||
export class DepositRejected extends Error {}
|
||||
|
||||
/** 官方证书页的显示参数;保留原address、digest和txHash,不改变存证身份。 */
|
||||
export function certificateAuthorUrl(url: string, mode: string | null, artist?: string | null): string {
|
||||
const parsed = new URL(url);
|
||||
const params = new URLSearchParams(parsed.hash.slice('#/certificate?'.length));
|
||||
if (mode === 'ARTWORK_ARTIST' && artist?.trim()) params.set('author', artist.trim());
|
||||
else params.delete('author');
|
||||
parsed.hash = '/certificate?' + params.toString();
|
||||
return parsed.toString();
|
||||
}
|
||||
|
||||
/** V3 uses signed headers and code=200, unlike the existing V2 provider. */
|
||||
export class DepositProvider {
|
||||
constructor(private readonly environment: DepositEnvironment, private readonly appId: string, private readonly appKey: string) {}
|
||||
|
||||
Reference in New Issue
Block a user