+3
.gitignore
+3
.gitignore
+7
-7
build.maple
+7
-7
build.maple
···
1
plugins = [ 'v' ]
2
3
task:db.init = {
4
-
description = 'Initialize and start a test postgres database'
5
category = 'db'
6
run = 'docker run -it \
7
--name beep-database \
···
14
}
15
16
task:db.start = {
17
-
description = 'Start the docker image for the database'
18
category = 'db'
19
run = 'docker start beep-database'
20
}
21
22
task:db.stop = {
23
-
description = 'Stop the docker image for the database'
24
category = 'db'
25
run = 'docker stop beep-database'
26
}
27
28
task:db.login = {
29
-
description = 'Log into and modify the database'
30
category = 'db'
31
run = 'docker exec -it beep-database psql -h localhost -p 5432 -d beep -U beep -W'
32
}
33
34
task:db.shell = {
35
-
description = 'Open a shell in the database'
36
category = 'db'
37
run = 'docker exec -it beep-database sh'
38
}
39
40
task:db.dangerous.nuke = {
41
-
description = 'Nuke the docker image AND ITS DATA. This will delete **EVERYTHING** in the database.'
42
category = 'db'
43
run = 'docker rm beep-database && docker volume rm beep-data'
44
}
···
46
task:run = {
47
description = 'Run beep'
48
category = 'run'
49
-
run = '${v} -d veb_livereload watch run ${v_main}'
50
}
···
1
plugins = [ 'v' ]
2
3
task:db.init = {
4
+
description = 'Initialize and start a local Postgres database via Docker'
5
category = 'db'
6
run = 'docker run -it \
7
--name beep-database \
···
14
}
15
16
task:db.start = {
17
+
description = 'Start the docker image for the local database'
18
category = 'db'
19
run = 'docker start beep-database'
20
}
21
22
task:db.stop = {
23
+
description = 'Stop the docker image for the local database'
24
category = 'db'
25
run = 'docker stop beep-database'
26
}
27
28
task:db.login = {
29
+
description = 'Log into and modify the local database'
30
category = 'db'
31
run = 'docker exec -it beep-database psql -h localhost -p 5432 -d beep -U beep -W'
32
}
33
34
task:db.shell = {
35
+
description = 'Open a shell in the local database'
36
category = 'db'
37
run = 'docker exec -it beep-database sh'
38
}
39
40
task:db.dangerous.nuke = {
41
+
description = 'Delete the docker image AND ITS DATA. This will delete **EVERYTHING** in the database.'
42
category = 'db'
43
run = 'docker rm beep-database && docker volume rm beep-data'
44
}
···
46
task:run = {
47
description = 'Run beep'
48
category = 'run'
49
+
run = '${v} -d veb_livereload watch run ${v_main} config.maple'
50
}
-9
config.maple
-9
config.maple
+18
-4
readme.md
+18
-4
readme.md
···
1
# beep
2
3
-
a self-hosted mini-blogger
4
5
technically made because i wanted to mess around with rss, but i also wanted a
6
-
teensy little blog for myself
7
8
## hosting
9
10
```sh
11
git clone https://github.com/emmathemartian/beep
12
v -prod .
13
-
./beep [port]
14
```
15
16
-
then go to `localhost:[port]` to view
···
1
# beep
2
3
+
> *a legendary land of lowercase lovers.*
4
+
5
+
a self-hosted mini-blogger.
6
7
technically made because i wanted to mess around with rss, but i also wanted a
8
+
teensy little blog/slow-paced-chat-app for myself and my friends.
9
10
## hosting
11
12
+
you will need a postgresql database somewhere, along with v to compile beep:
13
+
14
+
edit `config.maple` to set the url, port, username, password, and database name.
15
+
16
+
> `config.maple` also has settings to configure the feel of your beep instance,
17
+
> including toggling images, post length, username length, etc etc.
18
+
19
+
> **do not** push your `config.maple`'s secrets to git!
20
+
> instead, use `config.real.maple` if you plan to push anywhere.
21
+
> it will be gitignored to keep your secrets a secret.
22
+
23
```sh
24
git clone https://github.com/emmathemartian/beep
25
+
cd beep
26
v -prod .
27
+
./beep config.maple
28
```
29
30
+
then go to the configured url to view (default is `http://localhost:8008`).
+2
-1
src/auth/auth.v
+2
-1
src/auth/auth.v
···
1
// From: https://github.com/vlang/v/blob/1fae506900c79e3aafc00e08e1f861fc7cbf8012/vlib/veb/auth/auth.v
2
// The original file's source is licensed under MIT.
3
4
+
// This fork re-introduces the `ip` field of each token for additional security,
5
+
// along with delete_tokens_for_ip
6
7
module auth
8
-15
src/config.v
-15
src/config.v
···
17
password string
18
db string
19
}
20
-
oauth struct {
21
-
pub mut:
22
-
github struct {
23
-
pub mut:
24
-
enabled bool
25
-
id string
26
-
secret string
27
-
}
28
-
}
29
post struct {
30
pub mut:
31
title_max_len int
···
60
config.postgres.user = loaded_postgres.get('user').to_str()
61
config.postgres.password = loaded_postgres.get('password').to_str()
62
config.postgres.db = loaded_postgres.get('db').to_str()
63
-
64
-
loaded_oauth := loaded.get('oauth')
65
-
loaded_oauth_github := loaded_oauth.get('github')
66
-
config.oauth.github.enabled = loaded_oauth_github.get('enabled').to_bool()
67
-
config.oauth.github.id = loaded_oauth_github.get('id').to_str()
68
-
config.oauth.github.secret = loaded_oauth_github.get('secret').to_str()
69
70
loaded_post := loaded.get('post')
71
config.post.title_max_len = loaded_post.get('title_max_len').to_int()
···
17
password string
18
db string
19
}
20
post struct {
21
pub mut:
22
title_max_len int
···
51
config.postgres.user = loaded_postgres.get('user').to_str()
52
config.postgres.password = loaded_postgres.get('password').to_str()
53
config.postgres.db = loaded_postgres.get('db').to_str()
54
55
loaded_post := loaded.get('post')
56
config.post.title_max_len = loaded_post.get('title_max_len').to_int()
+2
-1
src/main.v
+2
-1
src/main.v
+1
-1
src/templates/admin.html
+1
-1
src/templates/admin.html
+6
-1
src/templates/partial/header.html
+6
-1
src/templates/partial/header.html
···
13
<body>
14
15
<header>
16
+
@if app.config.dev_mode
17
+
<span><strong>dev mode</strong></span>
18
+
-
19
+
@end
20
+
21
<a href="/">home</a>
22
-
23
···
29
@if ctx.is_logged_in()
30
<a href="/me">profile</a>
31
-
32
+
<a href="/api/user/logout">log out</a>
33
@else
34
<a href="/login">log in</a>
35
<span>or</span>
+23
todo.md
+23
todo.md
···
···
1
+
# todo
2
+
3
+
> i use `:` to denote categories
4
+
5
+
## in-progress
6
+
7
+
- [ ] user:nicknames
8
+
9
+
## planing
10
+
11
+
- [ ] site:stylesheet (and a toggle for html-only mode)
12
+
- [ ] post:mentioning ('tagging') other users in posts
13
+
- [ ] post:replies
14
+
- [ ] post:likes/dislikes/favourites
15
+
- [ ] post:tags ('hashtags')
16
+
- [ ] post:images (should have a config.maple toggle to enable/disable)
17
+
- [ ] user:deletion
18
+
- [ ] user:bio/about me
19
+
- [ ] user:listed pronouns
20
+
21
+
## ideas
22
+
23
+
## done