+5
-1
config.maple
+5
-1
config.maple
+1
doc/todo.md
+1
doc/todo.md
+11
src/config.v
+11
src/config.v
···
6
6
pub mut:
7
7
dev_mode bool
8
8
static_path string
9
+
instance struct {
10
+
pub mut:
11
+
name string
12
+
welcome string
13
+
}
9
14
http struct {
10
15
pub mut:
11
16
port int
···
55
60
56
61
config.dev_mode = loaded.get('dev_mode').to_bool()
57
62
config.static_path = loaded.get('static_path').to_str()
63
+
64
+
loaded_instance := loaded.get('instance')
65
+
// yes i am still sanatizing these despite being configured exclusively
66
+
// by the instance owner. redundant? maybe.
67
+
config.instance.name = sanatize(loaded_instance.get('name').to_str())
68
+
config.instance.welcome = sanatize(loaded_instance.get('welcome').to_str())
58
69
59
70
loaded_http := loaded.get('http')
60
71
config.http.port = loaded_http.get('port').to_int()
+7
-7
src/pages.v
+7
-7
src/pages.v
···
4
4
import entity { User, Post }
5
5
6
6
fn (mut app App) index(mut ctx Context) veb.Result {
7
-
ctx.title = 'beep'
7
+
ctx.title = app.config.instance.name
8
8
user := app.whoami(mut ctx) or { User{} }
9
9
recent_posts := app.get_recent_posts()
10
10
pinned_posts := app.get_pinned_posts()
···
12
12
}
13
13
14
14
fn (mut app App) login(mut ctx Context) veb.Result {
15
-
ctx.title = 'login to beep'
15
+
ctx.title = 'login to ${app.config.instance.name}'
16
16
user := app.whoami(mut ctx) or { User{} }
17
17
return $veb.html()
18
18
}
19
19
20
20
fn (mut app App) register(mut ctx Context) veb.Result {
21
-
ctx.title = 'register for beep'
21
+
ctx.title = 'register for ${app.config.instance.name}'
22
22
user := app.whoami(mut ctx) or { User{} }
23
23
return $veb.html()
24
24
}
···
28
28
ctx.error('not logged in')
29
29
return ctx.redirect('/login')
30
30
}
31
-
ctx.title = 'beep - ${user.get_name()}'
31
+
ctx.title = '${app.config.instance.name} - ${user.get_name()}'
32
32
return $veb.html()
33
33
}
34
34
35
35
fn (mut app App) admin(mut ctx Context) veb.Result {
36
-
ctx.title = 'beep dashboard'
36
+
ctx.title = '${app.config.instance.name} dashboard'
37
37
user := app.whoami(mut ctx) or { User{} }
38
38
return $veb.html()
39
39
}
···
44
44
ctx.error('user not found')
45
45
return ctx.redirect('/')
46
46
}
47
-
ctx.title = 'beep - ${user.get_name()}'
47
+
ctx.title = '${app.config.instance.name} - ${user.get_name()}'
48
48
return $veb.html()
49
49
}
50
50
···
54
54
ctx.error('no such post')
55
55
return ctx.redirect('/')
56
56
}
57
-
ctx.title = 'beep - ${post.title}'
57
+
ctx.title = '${app.config.instance.name} - ${post.title}'
58
58
user := app.whoami(mut ctx) or { User{} }
59
59
return $veb.html()
60
60
}