aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/shared.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/shared.ts')
-rw-r--r--src/routes/shared.ts130
1 files changed, 45 insertions, 85 deletions
diff --git a/src/routes/shared.ts b/src/routes/shared.ts
index e4a3e6d..5d20dd6 100644
--- a/src/routes/shared.ts
+++ b/src/routes/shared.ts
@@ -37,37 +37,37 @@ export type RenderBlock = {
italic?: boolean;
underlined?: boolean;
url?:
- | `newtab:${string}`
- | `currenttab:${string}`
- | ((textObj: TTYText & { kind: 'text' }) => void);
+ | `newtab:${string}`
+ | `currenttab:${string}`
+ | ((textObj: TTYText & { kind: 'text' }) => void);
bg?: string;
raw?: boolean;
dl?: string;
};
export type TTYText =
| {
- kind: 'text';
- renderrestriction?: 'everywhere' | 'js-only' | 'noscript';
- value: RenderBlock[];
- id: string;
- classes: string[];
- }
+ kind: 'text';
+ renderrestriction?: 'everywhere' | 'js-only' | 'noscript';
+ value: RenderBlock[];
+ id: string;
+ classes: string[];
+ }
| {
- kind: 'removeNode';
- removedId: string;
- removedItemClassList: string[];
- }
+ kind: 'removeNode';
+ removedId: string;
+ removedItemClassList: string[];
+ }
| {
- kind: 'time';
- delay: number;
- }
+ kind: 'time';
+ delay: number;
+ }
| {
- kind: 'cursorVisibility';
- visible: boolean;
- }
+ kind: 'cursorVisibility';
+ visible: boolean;
+ }
| {
- kind: 'clear';
- };
+ kind: 'clear';
+ };
export type Only<Obj, Keys extends keyof Obj> = {
[k in Keys]: Obj[k];
};
@@ -396,7 +396,7 @@ export const ttyLines: TTYText[] = (() => {
colour: '#7a7a7a',
},
],
- ['GPG Root Key: ', { colour: '#cdcdcd' }],
+ ['GPG Key: ', { colour: '#cdcdcd' }],
);
wait(1000);
replaceLast((v) => [
@@ -412,19 +412,9 @@ export const ttyLines: TTYText[] = (() => {
},
],
]);
- wait(100);
- replaceLast((v) => [
- ...v,
- [
- ' (root key)',
- {
- colour: '#999999',
- },
- ],
- ]);
wait(400);
text([
- ' - ',
+ ' - ',
{
colour: '#7a7a7a',
},
@@ -469,58 +459,6 @@ export const ttyLines: TTYText[] = (() => {
],
[')', { colour: '#999999' }],
]);
- wait(45);
- text([
- ' - ',
- {
- colour: '#7a7a7a',
- },
- ]);
- wait(70);
- replaceLast((v) => [
- ...v,
- [
- 'GPG Release Signing Key: ',
- {
- colour: '#cdcdcd',
- },
- ],
- ]);
- wait(100);
- replaceLast((v) => [
- ...v,
- [
- '0D93102265071798C7B65A4C9F0739B9E0C8FD60',
- {
- colour: '#ffffff',
- underlined: true,
- weight: 700,
- url: `currenttab:/keys/memdmp/release.pgp`,
- dl: 'memdmp-release.pgp',
- },
- ],
- ]);
- wait(100);
- replaceLast((v) => [
- ...v,
- [
- ' (',
- {
- colour: '#999999',
- },
- ],
- [
- 'signed',
- {
- colour: '#ffffff',
- underlined: true,
- weight: 500,
- url: `currenttab:/keys/memdmp/release.pgp.sig`,
- dl: 'memdmp-release.pgp.sig',
- },
- ],
- [')', { colour: '#999999' }],
- ]);
wait(100);
text([
' - ',
@@ -620,3 +558,25 @@ export const ttyLines: TTYText[] = (() => {
return lines;
})();
+export const joinSimilarTTYLines = (lines: TTYText[]) => {
+ for (const line of lines)
+ if (line.kind === 'text') {
+ const newvalues = [] as RenderBlock[];
+ let lastvalue: string = '';
+ for (const value of line.value) {
+ const thisvalue_raw = { ...value } as Omit<RenderBlock, 'value'> & {
+ value?: string
+ };
+ delete (thisvalue_raw as Partial<RenderBlock>)['value']
+ const thisvalue = Object.entries(thisvalue_raw).toSorted((a, b) => a[0] > b[0] ? 1 : a[0] === b[0] ? 0 : -1).map(v => v[1]).join('\r\n\n\r\r\n')
+ if (thisvalue === lastvalue) {
+ newvalues[newvalues.length - 1].value += value.value
+ } else {
+ lastvalue = thisvalue
+ newvalues.push(value)
+ }
+ }
+ line.value = newvalues
+ }
+ return lines
+}