···1-import { RichText } from "npm:@atproto/api";
2-import * as ammonia from "https://deno.land/x/ammonia@0.3.1/mod.ts";
3-import { agent } from "./main.js";
4-5-await ammonia.init();
6-7-export function getFacets(text) {
8- const rt = new RichText({ text: text });
9- rt.detectFacetsWithoutResolution(agent);
10-11- let res = "";
12- for (const segment of rt.segments()) {
13- if (segment.isLink()) res += `<a href="${segment.link.uri}">${segment.text}</a>`;
14- else if (segment.isMention()) res += `<a href="/profile/${segment.mention.did}/">${segment.text}</a>`;
15- else if (segment.isTag()) res += `<a href="https://bsky.app/hashtag/${segment.tag.tag}">${segment.text}</a>`;
16- else res += segment.text;
17- }
18-19- res = ammonia.clean(res);
20- res = res.replaceAll("\n", "<br>");
21-22- return res;
23-}
···00000000000000000000000
+26
fly.toml
···00000000000000000000000000
···1+# fly.toml app configuration file generated for htmlsky on 2024-06-08T16:01:00Z
2+#
3+# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
4+#
5+6+app = 'htmlsky'
7+primary_region = 'iad'
8+9+[build]
10+ [build.args]
11+ GO_VERSION = '1.22.1'
12+13+[env]
14+ PORT = '8080'
15+16+[http_service]
17+ internal_port = 8080
18+ auto_stop_machines = true
19+ auto_start_machines = true
20+ min_machines_running = 0
21+ processes = ['app']
22+23+[[vm]]
24+ memory = '256mb'
25+ cpu_kind = 'shared'
26+ cpus = 1