tangled
alpha
login
or
join now
vielle.dev
/
atcities.dev
8
fork
atom
[WIP] A (somewhat barebones) atproto app for creating custom sites without hosting!
8
fork
atom
overview
issues
pulls
pipelines
server: simple html index landing page
vielle.dev
5 months ago
428f76c5
5b6c91b8
+48
-5
4 changed files
expand all
collapse all
unified
split
deno.json
index
index.html
main.ts
root.ts
+1
-1
deno.json
···
2
2
"tasks": {
3
3
"dev": "PORT=8000 deno run --watch --allow-net --allow-env=HOSTNAME,PORT main.ts"
4
4
},
5
5
-
"imports": {}
5
5
+
"unstable": ["raw-imports"]
6
6
}
+31
index/index.html
···
1
1
+
<!doctype html>
2
2
+
<html lang="en">
3
3
+
<head>
4
4
+
<meta charset="UTF-8" />
5
5
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
+
<title>atcities.dev</title>
7
7
+
8
8
+
<style>
9
9
+
:root {
10
10
+
color-scheme: light dark;
11
11
+
}
12
12
+
13
13
+
dt {
14
14
+
font-weight: bold;
15
15
+
}
16
16
+
</style>
17
17
+
</head>
18
18
+
<body>
19
19
+
<h1>atcities.dev</h1>
20
20
+
<dl>
21
21
+
<dt>Visit someones site by handle:</dt>
22
22
+
<dd>Head to <code>https://HANDLE.atcities.dev</code></dd>
23
23
+
24
24
+
<dt>Visit someones site by DID:</dt>
25
25
+
<dd>Head to <code>https://DID.DID-METHOD.atcities.dev</code></dd>
26
26
+
27
27
+
<dt>Create your own site:</dt>
28
28
+
<dd>Suffer</dd>
29
29
+
</dl>
30
30
+
</body>
31
31
+
</html>
+3
-4
main.ts
···
1
1
+
import root from "./root.ts";
2
2
+
1
3
const ROOT_DOMAIN = Deno.env.get("HOSTNAME") || "localhost";
2
4
const PORT = Number(Deno.env.get("PORT")) || 80;
3
5
···
19
21
});
20
22
}
21
23
22
22
-
if (subdomain.length === 1 && subdomain[0] === "www")
23
23
-
return new Response("Index site not implemented", {
24
24
-
status: 501,
25
25
-
});
24
24
+
if (subdomain.length === 1 && subdomain[0] === "www") return root(req);
26
25
27
26
// did:plc example: `sjkdgfjk.did-plc.ROOT_DOMAIN`
28
27
// did:web example: `vielle.dev.did-web.ROOT_DOMAIN
+13
root.ts
···
1
1
+
import index from "./index/index.html" with { type: "text" };
2
2
+
3
3
+
export default function (req: Request) {
4
4
+
if (new URL(req.url).pathname === "/")
5
5
+
return new Response(index, {
6
6
+
headers: {
7
7
+
"Content-Type": "text/html; charset=utf8",
8
8
+
},
9
9
+
});
10
10
+
return new Response("404", {
11
11
+
status: 404,
12
12
+
});
13
13
+
}