-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathsetup.templ
More file actions
113 lines (110 loc) · 4.19 KB
/
setup.templ
File metadata and controls
113 lines (110 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package main
import "github.com/fiatjaf/pyramid/global"
templ domainSetupPage() {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>setup - domain configuration</title>
<link rel="stylesheet" href="/static/styles.css">
</head>
<body class="min-h-screen flex items-center justify-center bg-stone-50 dark:bg-stone-900">
<div class="max-w-md w-full mx-4">
<div class="bg-white dark:bg-stone-800 rounded-lg shadow-lg p-8">
<h1 class="text-3xl font-bold text-center mb-2 text-stone-800 dark:text-stone-100">
pyramid setup
</h1>
<p class="text-center text-stone-600 dark:text-stone-400 mb-8">
configure your relay domain
</p>
<form method="POST" action="/setup/domain" class="space-y-4">
<div>
<label class="block text-sm font-medium mb-2 text-stone-700 dark:text-stone-300">
domain
</label>
<input
type="text"
name="domain"
placeholder="relay.example.com"
required
autofocus
class="w-full px-4 py-2 rounded border border-stone-300 dark:border-stone-600 bg-white dark:bg-stone-700 dark:text-stone-100 focus:ring-2 focus:ring-blue-500"
/>
<p class="mt-1 text-xs text-stone-500 dark:text-stone-400">
enter the domain name where this relay will be accessible
</p>
</div>
<button
type="submit"
class="w-full px-4 py-3 rounded-lg font-semibold text-white bg-stone-700 hover:bg-stone-800 dark:bg-stone-600 dark:hover:bg-stone-500 shadow-lg"
>
set domain
</button>
</form>
<div id="dns-message" class="mt-4 text-sm text-stone-500 dark:text-stone-400 hidden"></div>
</div>
</div>
<script>
const hostname = window.location.hostname;
const isIP = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(hostname);
if (window.location.protocol === 'http:' && isIP && hostname !== '0.0.0.0' && hostname != '127.0.0.1') {
const messageDiv = document.getElementById('dns-message');
messageDiv.innerHTML = `in your domain name provider, set a DNS "<code>A</code>" record pointing to "<code>${hostname}</code>".`;
messageDiv.classList.remove('hidden');
}
</script>
</body>
</html>
}
templ rootUserSetupPage() {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>setup - root user</title>
<link rel="stylesheet" href="/static/styles.css">
</head>
<body class="min-h-screen flex items-center justify-center bg-stone-50 dark:bg-stone-900">
<div class="max-w-md w-full mx-4">
<div class="bg-white dark:bg-stone-800 rounded-lg shadow-lg p-8">
<div class="text-center mb-6">
if global.Settings.RelayIcon != "" {
<img class="h-16 mx-auto mb-4" src={ global.Settings.RelayIcon }/>
}
<h1 class="text-3xl font-bold text-stone-800 dark:text-stone-100">{ global.Settings.RelayName }</h1>
<p class="text-stone-600 dark:text-stone-400 mt-2">add root user</p>
</div>
<p class="text-sm text-stone-600 dark:text-stone-400 mb-6">
enter the public key (npub or hex) of the first root user.
</p>
<p class="text-sm text-stone-600 dark:text-stone-400 mb-6">
this user will have full administrative privileges and will be able to add more users later.
</p>
<form method="POST" action="/setup/root" class="space-y-4">
<div>
<label class="block text-sm font-medium mb-2 text-stone-700 dark:text-stone-300">
root user public key
</label>
<input
type="text"
name="pubkey"
required
autofocus
placeholder="npub1... or hex pubkey"
class="w-full px-4 py-3 rounded border border-stone-300 dark:border-stone-600 bg-white dark:bg-stone-700 dark:text-stone-100 font-mono text-sm focus:ring-2 focus:ring-blue-500"
/>
</div>
<button
type="submit"
class="w-full px-4 py-3 rounded-lg font-semibold text-white bg-stone-700 hover:bg-stone-800 dark:bg-stone-600 dark:hover:bg-stone-500 shadow-lg"
>
set first root user
</button>
</form>
</div>
</div>
</body>
</html>
}