Skip to content

Commit

Permalink
feat!: use domains as usernames.
Browse files Browse the repository at this point in the history
Major refactor that stores username registrations
in redis and uses domains as the usernames.
  • Loading branch information
zicklag committed Nov 13, 2024
1 parent e291612 commit 2a3b32c
Show file tree
Hide file tree
Showing 34 changed files with 783 additions and 441 deletions.
2 changes: 0 additions & 2 deletions .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ DNS_TTL=0

PUBLIC_INSTANCE_NAME="Weird.One"
PUBLIC_MEMBERS_TITLE="Weird Ones"
PUBLIC_DICEBEAR_URL="https://avatars.weird.one"
PUBLIC_DICEBEAR_STYLE="bottts"

MICROSOFT_APPLICATION_ID=""

Expand Down
15 changes: 15 additions & 0 deletions leaf/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ export const PathSegmentSchema = BorshSchema.Enum({
Bytes: BorshSchema.Vec(BorshSchema.u8)
});

export type IntoPathSegment = string | boolean | null | PathSegment;
export function intoPathSegment(value: IntoPathSegment): PathSegment {
if (typeof value == 'string') {
return { String: value };
} else if (typeof value == 'boolean') {
return { Bool: value };
} else if (value === null) {
return { Null: {} };
} else {
return value;
}
}

export type EntityPath = PathSegment[];
export const EntityPathSchema = BorshSchema.Vec(PathSegmentSchema);

Expand All @@ -55,6 +68,8 @@ export function formatEntityPath(p: EntityPath): string {
s += `/base32:${base32Encode(new Uint8Array(segment.Bytes))}`;
} else if ('Uint' in segment) {
s += `/Uint:${segment.Uint.toString()}`;
} else if ('Null' in segment) {
s += `/Null`
} else {
throw 'TODO: implement formatting for other path segment types.';
}
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"devDependencies": {
"@codemirror/lang-markdown": "^6.3.0",
"@codemirror/language": "^6.10.3",
"@dicebear/collection": "^9.2.2",
"@dicebear/core": "^9.2.2",
"@iconify/svelte": "^4.0.2",
"@keyv/redis": "^3.0.1",
"@lezer/highlight": "^1.2.1",
Expand Down
Loading

0 comments on commit 2a3b32c

Please sign in to comment.