Compare commits

...

263 commits

Author SHA1 Message Date
f2606fe2d0 Merge pull request 'chore(deps): update dependency sass to v1.79.3' (#112) from renovate/sass-1.x-lockfile into master
Reviewed-on: #112
2024-09-21 20:05:39 +05:30
2fc66ab165 Merge pull request 'fix(deps): update rust crate clap to v4.5.18' (#113) from renovate/clap-4.x-lockfile into master
Reviewed-on: #113
2024-09-21 20:05:34 +05:30
Renovate Bot
3a5cbcbf0e chore(deps): update dependency sass to v1.79.3
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-09-20 21:35:24 +00:00
Renovate Bot
8983df286b fix(deps): update rust crate clap to v4.5.18
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-09-20 20:36:40 +00:00
a8fe4faf59 Merge pull request 'chore(deps): update dependency sass to v1.79.1' (#111) from renovate/sass-1.x-lockfile into master
Reviewed-on: #111
2024-09-18 11:27:20 +05:30
Renovate Bot
fbe187ab3e chore(deps): update dependency sass to v1.79.1
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-09-18 00:35:56 +00:00
12f8de0642 Merge pull request 'fix(deps): update rust crate tokio to v1.40.0' (#110) from renovate/tokio-1.x-lockfile into master
Reviewed-on: #110
2024-09-12 22:12:41 +05:30
105cedb268 Merge pull request 'fix(deps): update rust crate serde_json to v1.0.128' (#109) from renovate/serde_json-1.x-lockfile into master
Reviewed-on: #109
2024-09-12 22:10:13 +05:30
26aa18b530 Merge pull request 'fix(deps): update rust crate serde to v1.0.210' (#108) from renovate/serde-monorepo into master
Reviewed-on: #108
2024-09-12 22:09:25 +05:30
9cc9a4e435 Merge pull request 'fix(deps): update rust crate clap to v4.5.17' (#107) from renovate/clap-4.x-lockfile into master
Reviewed-on: #107
2024-09-12 22:09:21 +05:30
3bdda44c58 Merge pull request 'chore(deps): update dependency sass to v1.78.0' (#106) from renovate/sass-1.x-lockfile into master
Reviewed-on: #106
2024-09-12 22:03:50 +05:30
Renovate Bot
05048d102d fix(deps): update rust crate tokio to v1.40.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-09-11 14:13:14 +00:00
Renovate Bot
37702f62a2 fix(deps): update rust crate serde_json to v1.0.128
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-09-11 14:12:37 +00:00
Renovate Bot
25e9b6fc3c fix(deps): update rust crate serde to v1.0.210
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-09-11 14:12:29 +00:00
Renovate Bot
203851a266 fix(deps): update rust crate clap to v4.5.17
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-09-11 14:12:14 +00:00
Renovate Bot
ecd8636d45 chore(deps): update dependency sass to v1.78.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-09-03 23:06:53 +00:00
d683bb00eb Merge pull request 'chore(deps): update node.js to v20.17.0' (#105) from renovate/node-20.x into master
Reviewed-on: #105
2024-08-28 13:41:51 +05:30
Renovate Bot
5d71433228 chore(deps): update node.js to v20.17.0
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-08-21 22:06:38 +00:00
6d9cf81766 Merge pull request 'fix(deps): update rust crate tokio to v1.39.3' (#104) from renovate/tokio-1.x-lockfile into master
Reviewed-on: https://git.batsense.net///LibrePages/librepages/pulls/104
2024-08-19 13:54:38 +05:30
5fa03ecaa1 Merge pull request 'fix(deps): update rust crate clap to v4.5.16' (#103) from renovate/clap-4.x-lockfile into master
Reviewed-on: https://git.batsense.net///LibrePages/librepages/pulls/103
2024-08-19 13:54:28 +05:30
e8ef87768b Merge pull request 'fix(deps): update rust crate serde to v1.0.208' (#102) from renovate/serde-monorepo into master
Reviewed-on: https://git.batsense.net///LibrePages/librepages/pulls/102
2024-08-19 13:53:10 +05:30
c0267665ae Merge pull request 'fix(deps): update rust crate serde_json to v1.0.125' (#101) from renovate/serde_json-1.x-lockfile into master
Reviewed-on: https://git.batsense.net///LibrePages/librepages/pulls/101
2024-08-19 13:52:42 +05:30
Renovate Bot
6ad6ad43ff fix(deps): update rust crate tokio to v1.39.3
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-08-17 18:05:12 +00:00
Renovate Bot
3fd4fec5b0 fix(deps): update rust crate clap to v4.5.16
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-08-15 22:05:04 +00:00
Renovate Bot
178defb4c0 fix(deps): update rust crate serde to v1.0.208
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-08-15 16:05:26 +00:00
Renovate Bot
43bbd65bdf fix(deps): update rust crate serde_json to v1.0.125
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-08-15 06:05:21 +00:00
2445da5164 Merge pull request 'fix(deps): update rust crate serde to v1.0.207' (#96) from renovate/serde-monorepo into master
Reviewed-on: https://git.batsense.net///LibrePages/librepages/pulls/96
2024-08-13 15:34:33 +05:30
8bf9e6e1ce Merge pull request 'fix(deps): update rust crate actix-web to v4.9.0' (#99) from renovate/actix-web-4.x-lockfile into master
Reviewed-on: https://git.batsense.net///LibrePages/librepages/pulls/99
2024-08-13 15:30:55 +05:30
b120a628f1 Merge pull request 'fix(deps): update rust crate actix-http to v3.9.0' (#98) from renovate/actix-http-3.x-lockfile into master
Reviewed-on: https://git.batsense.net///LibrePages/librepages/pulls/98
2024-08-13 15:30:55 +05:30
a972b871dc Merge pull request 'fix(deps): update rust crate clap to v4.5.15' (#97) from renovate/clap-4.x-lockfile into master
Reviewed-on: https://git.batsense.net///LibrePages/librepages/pulls/97
2024-08-13 15:29:28 +05:30
9e6e1caa56 Merge pull request 'fix(deps): update rust crate serde_json to v1.0.124' (#100) from renovate/serde_json-1.x-lockfile into master
Reviewed-on: https://git.batsense.net///LibrePages/librepages/pulls/100
2024-08-13 15:28:05 +05:30
Renovate Bot
a24136062d fix(deps): update rust crate serde to v1.0.207
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-08-12 20:35:55 +00:00
Renovate Bot
d16aa959d1 fix(deps): update rust crate serde_json to v1.0.124
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-08-11 21:34:55 +00:00
Renovate Bot
c1f73939ff fix(deps): update rust crate actix-web to v4.9.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-08-10 02:35:07 +00:00
Renovate Bot
6fbcfd7476 fix(deps): update rust crate actix-http to v3.9.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-08-10 02:35:00 +00:00
Renovate Bot
4f644f6868 fix(deps): update rust crate clap to v4.5.15
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-08-10 00:35:34 +00:00
718bace169 Merge pull request 'fix(deps): update rust crate serde_json to v1.0.122' (#94) from renovate/serde_json-1.x-lockfile into master
Reviewed-on: https://git.batsense.net///LibrePages/librepages/pulls/94
2024-08-02 11:48:48 +05:30
Renovate Bot
ce309c4b56 fix(deps): update rust crate serde_json to v1.0.122
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-08-01 21:36:16 +00:00
6d444923f1 Merge pull request 'fix(deps): update rust crate clap to v4.5.13' (#93) from renovate/clap-4.x-lockfile into master
Reviewed-on: https://git.batsense.net///LibrePages/librepages/pulls/93
2024-08-01 09:20:37 +05:30
Renovate Bot
cc7fa95571 fix(deps): update rust crate clap to v4.5.13
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-31 22:04:17 +00:00
31a2f71bf8 Merge pull request 'fix(deps): update rust crate clap to v4.5.12' (#91) from renovate/clap-4.x-lockfile into master
Reviewed-on: https://git.batsense.net///LibrePages/librepages/pulls/91
2024-08-01 03:27:03 +05:30
f7253389db Merge pull request 'fix(deps): update rust crate toml to v0.8.19' (#92) from renovate/toml-0.x-lockfile into master
Reviewed-on: https://git.batsense.net///LibrePages/librepages/pulls/92
2024-08-01 03:26:42 +05:30
Renovate Bot
576b6e30eb fix(deps): update rust crate toml to v0.8.19
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-31 19:37:02 +00:00
Renovate Bot
7194a0c30f fix(deps): update rust crate clap to v4.5.12
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-31 17:34:44 +00:00
38a9fb8ec3 Merge pull request 'fix(deps): update rust crate toml to v0.8.17' (#90) from renovate/toml-0.x-lockfile into master
Reviewed-on: https://git.batsense.net///LibrePages/librepages/pulls/90
2024-07-31 21:30:18 +05:30
Renovate Bot
10b84c3613 fix(deps): update rust crate toml to v0.8.17
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-30 16:36:59 +00:00
74dbae5cdd Merge pull request 'fix(deps): update rust crate num_enum to v0.7.3' (#89) from renovate/num_enum-0.x-lockfile into master
Reviewed-on: #89
2024-07-30 18:00:16 +05:30
Renovate Bot
f8bcfc85b9 fix(deps): update rust crate num_enum to v0.7.3
Some checks are pending
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline is running
2024-07-29 13:03:59 +00:00
13b7c8d587 Merge pull request 'fix(deps): update rust crate serde_json to v1.0.121' (#88) from renovate/serde_json-1.x-lockfile into master
Reviewed-on: #88
2024-07-29 16:10:31 +05:30
Renovate Bot
1d0e49b24e fix(deps): update rust crate serde_json to v1.0.121
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-28 21:34:01 +00:00
62a1147447 Merge pull request 'fix(deps): update rust crate tokio to v1.39.2' (#87) from renovate/tokio-1.x-lockfile into master
Reviewed-on: #87
2024-07-27 20:28:39 +05:30
Renovate Bot
1f7f6eb52e fix(deps): update rust crate tokio to v1.39.2
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-27 11:04:16 +00:00
2e6c95eb09 Merge pull request 'fix(deps): update rust crate clap to v4.5.11' (#85) from renovate/clap-4.x-lockfile into master
Reviewed-on: #85
2024-07-26 13:44:27 +05:30
83b6f88244 Merge pull request 'fix(deps): update rust crate toml to v0.8.16' (#86) from renovate/toml-0.x-lockfile into master
Reviewed-on: #86
2024-07-26 13:44:13 +05:30
Renovate Bot
b9997bc84e fix(deps): update rust crate toml to v0.8.16
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-25 15:07:40 +00:00
Renovate Bot
0550ef3133 fix(deps): update rust crate clap to v4.5.11
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-25 14:07:41 +00:00
5c0eef4a96 Merge pull request 'chore(deps): update node.js to v20.16.0' (#84) from renovate/node-20.x into master
Reviewed-on: #84
2024-07-25 17:31:28 +05:30
Renovate Bot
2354062b35 chore(deps): update node.js to v20.16.0
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-24 16:32:50 +00:00
47a5b42507 Merge pull request 'fix(deps): update rust crate tokio to v1.39.1' (#83) from renovate/tokio-1.x-lockfile into master
Reviewed-on: #83
2024-07-24 11:42:35 +05:30
Renovate Bot
e989c134b0 fix(deps): update rust crate tokio to v1.39.1
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-23 16:32:51 +00:00
e19867a616 Merge pull request 'fix(deps): update rust crate clap to v4.5.10' (#82) from renovate/clap-4.x-lockfile into master
Reviewed-on: #82
2024-07-23 21:51:05 +05:30
Renovate Bot
d245215c06 fix(deps): update rust crate clap to v4.5.10
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-23 16:04:10 +00:00
64e2487285 Merge pull request 'fix(deps): update rust crate tokio to v1.39.0' (#81) from renovate/tokio-1.x-lockfile into master
Reviewed-on: #81
2024-07-23 21:27:13 +05:30
Renovate Bot
af0af42dc9 fix(deps): update rust crate tokio to v1.39.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-23 14:04:30 +00:00
094dff8367 Merge pull request 'fix(deps): update rust crate toml to v0.8.15' (#80) from renovate/toml-0.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #80
2024-07-18 22:44:52 +05:30
Renovate Bot
e71da62d03 fix(deps): update rust crate toml to v0.8.15
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-18 16:44:28 +00:00
cdfc8d21a8 Merge pull request 'fix(deps): update rust crate tokio to v1.38.1' (#79) from renovate/tokio-1.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #79
2024-07-17 09:52:09 +05:30
Renovate Bot
7bf0f92ae2 fix(deps): update rust crate tokio to v1.38.1
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-16 17:34:08 +00:00
e1f182abff Merge pull request 'chore(deps): update dependency sass to v1.77.8' (#78) from renovate/sass-1.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #78
2024-07-12 16:35:03 +05:30
Renovate Bot
374aa71574 chore(deps): update dependency sass to v1.77.8
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-11 20:06:54 +00:00
83d16f85d9 Merge pull request 'chore(deps): update dependency sass to v1.77.7' (#77) from renovate/sass-1.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #77
2024-07-10 16:30:39 +05:30
d4fc77cbe3 Merge pull request 'chore(deps): update node.js to v20.15.1' (#76) from renovate/node-20.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #76
2024-07-10 16:30:35 +05:30
Renovate Bot
72cac97a43 chore(deps): update dependency sass to v1.77.7
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline failed
2024-07-09 22:04:37 +00:00
Renovate Bot
30b292a6d8 chore(deps): update node.js to v20.15.1
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-09 16:04:21 +00:00
d18ace4d1e Merge pull request 'fix(deps): update rust crate rust-embed to v8.5.0' (#75) from renovate/rust-embed-8.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #75
2024-07-09 14:04:16 +05:30
d99fd71e4a Merge pull request 'fix(deps): update rust crate clap to v4.5.9' (#74) from renovate/clap-4.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #74
2024-07-09 14:03:45 +05:30
Renovate Bot
18f15cae55 fix(deps): update rust crate rust-embed to v8.5.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-09 06:33:22 +00:00
Renovate Bot
ebc07b4bee fix(deps): update rust crate clap to v4.5.9
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-09 02:32:47 +00:00
93e17d8ba5 Merge pull request 'fix(deps): update rust crate serde to v1.0.204' (#73) from renovate/serde-monorepo into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #73
2024-07-08 18:56:03 +05:30
Renovate Bot
fb45112eb0 fix(deps): update rust crate serde to v1.0.204
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-06 21:05:40 +00:00
790355bc7d Merge pull request 'fix(deps): update rust crate serde_json to v1.0.120' (#72) from renovate/serde_json-1.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #72
2024-07-02 11:35:10 +05:30
Renovate Bot
ea64b5f73e fix(deps): update rust crate serde_json to v1.0.120
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-07-01 17:36:35 +00:00
c1a1e41661 Merge pull request 'fix(deps): update rust crate serde_json to v1.0.119' (#71) from renovate/serde_json-1.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #71
2024-07-01 03:55:03 +05:30
Renovate Bot
0a31f39b5a fix(deps): update rust crate serde_json to v1.0.119
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-30 18:35:12 +00:00
0cefd9ebb3 Merge pull request 'fix(deps): update rust crate mime_guess to v2.0.5' (#70) from renovate/mime_guess-2.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #70
2024-06-30 22:10:54 +05:30
5c135a3b7d Merge pull request 'fix(deps): update rust crate clap to v4.5.8' (#69) from renovate/clap-4.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #69
2024-06-30 22:10:50 +05:30
Renovate Bot
d9800f9c3b fix(deps): update rust crate mime_guess to v2.0.5
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-29 08:03:25 +00:00
Renovate Bot
de6f37b054 fix(deps): update rust crate clap to v4.5.8
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-29 05:38:58 +00:00
a4b0ddcf3d Merge pull request 'fix(deps): update rust crate serde_json to v1.0.118' (#68) from renovate/serde_json-1.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #68
2024-06-25 11:52:04 +05:30
14157ca184 Merge pull request 'chore(deps): update node.js to v20.15.0' (#67) from renovate/node-20.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #67
2024-06-25 11:52:00 +05:30
458d0d5c30 Merge pull request 'fix(deps): update rust crate lazy_static to v1.5.0' (#66) from renovate/lazy_static-1.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #66
2024-06-25 11:51:56 +05:30
ec328d81df Merge pull request 'fix(deps): update rust crate actix-web to v4.8.0' (#65) from renovate/actix-web-4.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #65
2024-06-25 11:51:49 +05:30
4a38a01c34 Merge pull request 'fix(deps): update rust crate actix-http to v3.8.0' (#64) from renovate/actix-http-3.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #64
2024-06-25 11:51:45 +05:30
73d1428e96 Merge pull request 'chore(deps): update dependency sass to v1.77.6' (#63) from renovate/sass-1.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #63
2024-06-25 11:51:42 +05:30
Renovate Bot
d1ee9d9e0a fix(deps): update rust crate serde_json to v1.0.118
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-25 05:04:04 +00:00
Renovate Bot
977fc623f8 chore(deps): update node.js to v20.15.0
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-24 22:33:28 +00:00
Renovate Bot
55a37ae7f8 fix(deps): update rust crate lazy_static to v1.5.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-21 23:08:31 +00:00
Renovate Bot
5f7085b128 fix(deps): update rust crate actix-web to v4.8.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-20 01:04:27 +00:00
Renovate Bot
9020f65b0a fix(deps): update rust crate actix-http to v3.8.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-19 23:34:32 +00:00
Renovate Bot
9fe5f7445c chore(deps): update dependency sass to v1.77.6
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-18 13:38:05 +00:00
53f237d721 Merge pull request 'fix(deps): update rust crate derive_more to v0.99.18' (#62) from renovate/derive_more-0.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #62
2024-06-15 21:07:27 +05:30
Renovate Bot
59e9217cc4 fix(deps): update rust crate derive_more to v0.99.18
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-15 13:04:49 +00:00
ce80f36370 Merge pull request 'fix(deps): update rust crate git2 to 0.19.0' (#61) from renovate/git2-0.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #61
2024-06-14 20:40:01 +05:30
Renovate Bot
fbc38be770 fix(deps): update rust crate git2 to 0.19.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-14 01:07:18 +00:00
4f09e3af0a Merge pull request 'chore(deps): update dependency sass to v1.77.5' (#60) from renovate/sass-1.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #60
2024-06-12 14:59:50 +05:30
Renovate Bot
0d163a0932 chore(deps): update dependency sass to v1.77.5
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-12 00:03:43 +00:00
5b4a34d19e Merge pull request 'fix(deps): update rust crate url to v2.5.1' (#59) from renovate/url-2.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #59
2024-06-11 13:20:29 +05:30
Renovate Bot
9ba2143bac fix(deps): update rust crate url to v2.5.1
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-11 07:35:30 +00:00
888e951dae Merge pull request 'fix(deps): update rust crate clap to v4' (#57) from renovate/clap-4.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #57
2024-06-11 12:55:00 +05:30
Renovate Bot
15ba66c937 fix(deps): update rust crate clap to v4
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-11 06:33:12 +00:00
996eefaee4 Merge pull request 'fix(deps): update rust crate rust-embed to v8' (#58) from renovate/rust-embed-8.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #58
2024-06-11 11:52:07 +05:30
905c2ddc87 Merge pull request 'chore(deps): update node.js to v20' (#56) from renovate/node-20.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #56
2024-06-11 11:51:59 +05:30
ecb1805b1a Merge pull request 'fix(deps): update rust crate tracing-actix-web to 0.7.0' (#55) from renovate/tracing-actix-web-0.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #55
2024-06-11 11:51:53 +05:30
231560c476 Merge pull request 'fix(deps): update rust crate config to 0.14' (#44) from renovate/config-0.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #44
2024-06-11 11:51:48 +05:30
Renovate Bot
a96fd31060 fix(deps): update rust crate tracing-actix-web to 0.7.0
Some checks failed
renovate/artifacts Artifact file update failure
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 18:32:47 +00:00
Renovate Bot
23014cb5a0 fix(deps): update rust crate config to 0.14
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 18:32:42 +00:00
0930ed9e93 Merge pull request 'fix(deps): update rust crate tokio to v1.38.0' (#53) from renovate/tokio-1.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #53
2024-06-10 23:53:40 +05:30
5fa364fdc1 Merge pull request 'fix(deps): update rust crate toml to 0.8.0' (#54) from renovate/toml-0.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #54
2024-06-10 23:44:16 +05:30
a05062e128 Merge pull request 'fix(deps): update rust crate reqwest to 0.12.0' (#49) from renovate/reqwest-0.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #49
2024-06-10 23:43:28 +05:30
Renovate Bot
54072ff64b fix(deps): update rust crate rust-embed to v8
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 18:03:23 +00:00
Renovate Bot
d187d14e73 chore(deps): update node.js to v20
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 18:03:05 +00:00
7cadf192cf Merge pull request 'fix(deps): update rust crate tera to v1.20.0' (#52) from renovate/tera-1.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #52
2024-06-10 23:27:26 +05:30
6719c652a2 Merge pull request 'fix(deps): update rust crate pretty_env_logger to 0.5' (#48) from renovate/pretty_env_logger-0.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #48
2024-06-10 23:27:02 +05:30
c1027102f5 Merge pull request 'fix(deps): update rust crate git2 to 0.18.0' (#45) from renovate/git2-0.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #45
2024-06-10 23:18:58 +05:30
Renovate Bot
ccd0d03074 fix(deps): update rust crate tokio to v1.38.0
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 17:32:58 +00:00
Renovate Bot
ea90f07f45 fix(deps): update rust crate reqwest to 0.12.0
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 17:32:54 +00:00
7410e7f1fd Merge pull request 'fix(deps): update rust crate actix-web to v4.7.0' (#43) from renovate/actix-web-4.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #43
2024-06-10 23:01:45 +05:30
Renovate Bot
1873179bec fix(deps): update rust crate toml to 0.8.0
Some checks failed
renovate/artifacts Artifact file update failure
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 17:10:33 +00:00
Renovate Bot
e43174575d fix(deps): update rust crate tera to v1.20.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 17:10:23 +00:00
Renovate Bot
755177fb2e fix(deps): update rust crate pretty_env_logger to 0.5
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 17:10:20 +00:00
Renovate Bot
6f203771d0 fix(deps): update rust crate git2 to 0.18.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 17:03:59 +00:00
e17a9881dc Merge pull request 'fix(deps): update rust crate rust-embed to v6.8.1' (#50) from renovate/rust-embed-6.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #50
2024-06-10 22:33:53 +05:30
Renovate Bot
b271d8abcd fix(deps): update rust crate actix-web to v4.7.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 17:03:51 +00:00
78e2de32a6 Merge pull request 'fix(deps): update rust crate num_enum to 0.7.0' (#47) from renovate/num_enum-0.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #47
2024-06-10 22:33:43 +05:30
a18f9601ef Merge pull request 'fix(deps): update rust crate num_cpus to v1.16.0' (#46) from renovate/num_cpus-1.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #46
2024-06-10 22:33:39 +05:30
5454f36bc8 Merge pull request 'fix(deps): update rust crate actix-http to v3.7.0' (#40) from renovate/actix-http-3.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #40
2024-06-10 22:33:22 +05:30
Renovate Bot
b1ba1cf8f5 fix(deps): update rust crate rust-embed to v6.8.1
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 15:33:47 +00:00
Renovate Bot
e8d2113170 fix(deps): update rust crate num_enum to 0.7.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 15:33:19 +00:00
Renovate Bot
4df6187e40 fix(deps): update rust crate num_cpus to v1.16.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 15:33:07 +00:00
Renovate Bot
477d8b4b00 fix(deps): update rust crate actix-http to v3.7.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 15:32:47 +00:00
c6baccaa72 Merge pull request 'fix(deps): update rust crate actix-rt to v2.10.0' (#42) from renovate/actix-rt-2.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #42
2024-06-10 20:52:29 +05:30
805bc43cbb Merge pull request 'chore(deps): update rust crate mktemp to 0.5.0' (#39) from renovate/mktemp-0.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #39
2024-06-10 20:52:21 +05:30
58af924b13 Merge pull request 'chore(deps): update node.js to v16.20.2' (#38) from renovate/node-16.x into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #38
2024-06-10 20:52:17 +05:30
1ffb5ac804 Merge pull request 'fix(deps): update rust crate tracing to v0.1.40' (#27) from renovate/tokio-tracing-monorepo into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #27
2024-06-10 20:52:13 +05:30
ceefe08ac8 Merge pull request 'fix(deps): update rust crate serde_yaml to v0.9.34' (#25) from renovate/serde_yaml-0.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #25
2024-06-10 20:52:09 +05:30
d82315f8fa Merge pull request 'fix(deps): update rust crate serde_json to v1.0.117' (#24) from renovate/serde_json-1.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #24
2024-06-10 20:51:52 +05:30
134d05f601 Merge pull request 'fix(deps): update rust crate serde to v1.0.203' (#23) from renovate/serde-monorepo into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #23
2024-06-10 20:51:48 +05:30
Renovate Bot
14a4d12741 fix(deps): update rust crate actix-rt to v2.10.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 14:04:56 +00:00
Renovate Bot
b9c2e16d3a chore(deps): update rust crate mktemp to 0.5.0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 14:04:38 +00:00
Renovate Bot
6afb2b64d3 chore(deps): update node.js to v16.20.2
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 14:04:24 +00:00
Renovate Bot
8645cb5746 fix(deps): update rust crate tracing to v0.1.40
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 14:04:22 +00:00
Renovate Bot
2c343bb903 fix(deps): update rust crate serde_yaml to v0.9.34
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 14:04:13 +00:00
Renovate Bot
5e33521ace fix(deps): update rust crate serde_json to v1.0.117
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 14:04:02 +00:00
Renovate Bot
a539210956 fix(deps): update rust crate serde to v1.0.203
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
2024-06-10 14:03:55 +00:00
f5cf322c3c Merge pull request 'chore(deps): update dependency sass to v1.77.4' (#29) from renovate/sass-1.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #29
2024-06-10 19:04:04 +05:30
7c12bea932 Merge pull request 'fix(deps): update rust crate urlencoding to v2.1.3' (#28) from renovate/urlencoding-2.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #28
2024-06-10 19:04:01 +05:30
79eedaf491 Merge pull request 'fix(deps): update rust crate sha2 to v0.10.8' (#26) from renovate/sha2-0.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #26
2024-06-10 19:03:53 +05:30
eec3724290 Merge pull request 'fix(deps): update rust crate mime to v0.3.17' (#22) from renovate/mime-0.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #22
2024-06-10 19:03:31 +05:30
4ee3e5d85b Merge pull request 'fix(deps): update rust crate clap to v3.2.25' (#21) from renovate/clap-3.x-lockfile into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #21
2024-06-10 19:03:27 +05:30
bdb7fe731e Merge pull request 'chore(deps): update rust crate futures to v0.3.30' (#20) from renovate/rust-futures-monorepo into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #20
2024-06-10 19:03:24 +05:30
Renovate Bot
efc4e82841 chore(deps): update dependency sass to v1.77.4
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 10:33:36 +00:00
Renovate Bot
4f7289695b fix(deps): update rust crate urlencoding to v2.1.3
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 10:33:24 +00:00
Renovate Bot
67f0814c04 fix(deps): update rust crate sha2 to v0.10.8
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 10:33:15 +00:00
Renovate Bot
39fab145a3 fix(deps): update rust crate mime to v0.3.17
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 10:32:54 +00:00
Renovate Bot
781c6275bd fix(deps): update rust crate clap to v3.2.25
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 10:32:51 +00:00
Renovate Bot
d2885ddb4d chore(deps): update rust crate futures to v0.3.30
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-06-10 10:32:48 +00:00
09d2deeb71 Merge pull request 'ci-init-conductor' (#37) from ci-init-conductor into master
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #37
2024-06-10 15:44:20 +05:30
67fa2c7381
fix: isolate test db
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
2024-06-10 15:36:00 +05:30
02e3e3f371
fix: CI: start conductor service container 2024-06-10 15:05:15 +05:30
b559bc56b1 Merge pull request 'chore: Configure Renovate' (#19) from renovate/configure into master
Reviewed-on: #19
2024-06-04 10:13:37 +05:30
Renovate Bot
6a87745694 Add renovate.json 2024-06-03 03:02:07 +00:00
b2eeb5b9fd
chore: lints
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-12-28 16:10:35 +05:30
946a51e3ad
feat: s/gitea/forgejo/ 2022-12-28 16:08:24 +05:30
e4a8a6f5e4
fix: many-to-one repository mapping.
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
DESCRIPTION
    A repository can have multiple deployments, this caused problems
    when linking webhooks to repositories. This patch links a webhook to
    all available deployments from the repository.
2022-12-28 14:07:09 +05:30
d919bad570
feat: test webhooks
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-12-28 13:36:30 +05:30
0c6199494b
feat: install gitea webhook security deps and load gitea webhook module
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-12-28 04:39:13 +05:30
745b1eb0d5
feat: define gitea webhook routes 2022-12-28 04:38:57 +05:30
8b19a8cac5
chore: reuse app context's http client in conductor obj 2022-12-28 04:38:24 +05:30
3d11bfdcfc
feat: add gitea webhook template list REST API view 2022-12-28 04:37:42 +05:30
0e5db5c7a9
feat: add gitea webhook template inspect web view 2022-12-28 04:37:09 +05:30
b6d53c9937
feat: add gitea webhook template list web view 2022-12-28 04:36:54 +05:30
e97712312f
fix: web: favicon alt-text crowding 2022-12-28 04:36:39 +05:30
70e4650876
feat: add gitea webhook template and web view 2022-12-28 04:35:57 +05:30
e423ccc0ee
feat: REST API: list all webhooks created by user 2022-12-28 03:42:44 +05:30
5d4977f421
feat: db: list all webhooks created by user 2022-12-28 03:42:00 +05:30
201032fd07
feat: REST API: add and view webhooks 2022-12-28 03:22:23 +05:30
bce25be282
feat: db: get webhook with owner's username 2022-12-28 03:21:42 +05:30
51e3924d71
feat: db: get site details from repository URL 2022-12-27 20:15:15 +05:30
f26075b881
feat: register new gitea webhooks 2022-12-20 07:11:21 +05:30
b93373e96b
fix: CI: build release profile bin and publish
Some checks are pending
ci/woodpecker/push/woodpecker Pipeline is pending
2022-12-19 15:15:18 +05:30
4b1535848f
fix: rm cmd in publisher
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 14:16:46 +05:30
f205543c02
fix: CI: don't purge publisher img
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 13:52:30 +05:30
cfc3f81989
feat: CI: bin publish
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 13:34:42 +05:30
88aa76c55b
feat: bin publisher docker img. Get bin from realaravinth/librepages 2022-12-19 13:34:29 +05:30
ee23632e90
fix: bulid with DATABASE_URL unset and apply migrations
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 12:50:06 +05:30
98e3a9d810
fix: switch to global env vars
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 12:43:13 +05:30
631849fceb
fix: override DATABASE_URL _after_ URL is constructed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 12:35:10 +05:30
e1c475d05a
debug: CI: switch to local env vars for passing DATABASE_URL
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 12:31:12 +05:30
a0144bcf9b
debug: CI: explicitly supply DATABASE_URL
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 12:00:53 +05:30
7db1fa3d3b
debug: db: url
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 11:49:42 +05:30
fdf31ecfd2
debug: CI: switch name back to database and print URI 2022-12-19 10:57:30 +05:30
0a05fb945f
debug: CI: rm db port from url
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 10:48:45 +05:30
fb967e554b
debug: CI: pass DB url as string
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 10:42:45 +05:30
b249696776
debug: CI: use different hostname for postgres container
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 10:34:51 +05:30
55e4c95d6c
fix: checkin sqlx offline compilation data
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 10:24:51 +05:30
56c1a5373e
fix: CI: unset DATABASE_URL while fetching deps 2022-12-19 09:49:18 +05:30
f021e6fa87
fix: update sqlx offline compilation data
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 09:14:35 +05:30
97b59a7576
fix: CI: sed command
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 09:04:38 +05:30
409b2be66d
fix: CI: rm release build step, use binary from docker img
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 08:51:52 +05:30
abe3cf1dac
fix: CI: use the right image to publish bins 2022-12-19 08:51:40 +05:30
87f39721c9
fix: CI: write sed output to config file & rm init conductor from make dev-env
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 08:45:27 +05:30
61fe325db0
fix: CI: source code uri
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 08:41:34 +05:30
f919dcb691
fix: CI: fix conductor type
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 08:38:06 +05:30
04e3ab398d
fix: CI: booleans
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 08:36:01 +05:30
20e326fb51
fix: CI: port is a number
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 08:34:25 +05:30
df3ed747b0
fix: CI: add librepages-conductor img
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-12-19 08:33:48 +05:30
4250a62165
feat: add CI build status badge 2022-12-19 08:27:28 +05:30
321ff0beb8
fix: cache-buster link 2022-12-19 06:37:11 +05:30
7f58f58651
chore: rename pages -> librepages 2022-12-19 06:32:51 +05:30
0f44135f73
fix: CI: use github.com/mcaptcha/website for testing 2022-12-15 01:13:24 +05:30
5350b22ffe
feat: CI: configure and run conductor instance while testing 2022-12-15 01:01:59 +05:30
8a2ada891e
feat: run conductor instance while testing 2022-12-15 01:01:53 +05:30
be3af0e1fa
feat: relay site events to conductor 2022-12-15 01:00:15 +05:30
b7be2811d9
feat: talk to conductor 2022-12-15 00:59:52 +05:30
59b619f6fd
feat: accept conductor configuration 2022-12-15 00:59:35 +05:30
5c0f6fd84d
feat: use librepages/libconfig for handling deployment configurations 2022-12-09 14:24:02 +05:30
538bc41113
feat: fire and test deployment deletion event when deployment is deleted 2022-12-06 06:30:56 +05:30
3594d4e23b
feat: tombstone deployments instead of deleting them.
It is probably worthwhile storing deleted deployment('s events) for a
bit, before completely wiping them clean. Tombstone allows us to do
that.
2022-12-06 06:29:56 +05:30
ee6af46ccf
todo: erect deployment deletion tomstone 2022-12-05 19:15:49 +05:30
f111b5c8bf
feat: delete deployment from web UI
closes: #13
2022-12-05 17:40:38 +05:30
398f08c07a
feat: view site details, deploy secret and latest events
closes: #10
2022-12-05 15:48:16 +05:30
5917e5e29f
feat: DB: get site from deploy secret 2022-12-05 15:45:52 +05:30
7e17f9de0a
feat: add show and hide icons 2022-12-05 15:45:04 +05:30
7bf28f0f93
feat: use latest update event DB method when rendering dash home 2022-12-03 17:46:39 +05:30
c5ed6bf6c2
feat: add generic method to get latest event of any registered type and
get latest update event
2022-12-03 17:45:06 +05:30
d30d4e29b8
chore: rm debugging statement 2022-12-03 17:45:01 +05:30
bc7153a060
feat: add website from web UI
closes: #4 (comment)
2022-12-03 16:40:53 +05:30
ef55697879
fix: dashboard home title 2022-12-03 16:39:33 +05:30
1f1b21baac
feat: add public ID to deployments 2022-12-03 16:30:33 +05:30
f56ca02d39
chore: lints 2022-12-03 16:12:19 +05:30
9236451628
fix: link homepage in navbar 2022-12-03 15:47:46 +05:30
330e835094
fix: test dashboard homepage and fix template vars in dash home 2022-12-03 15:31:40 +05:30
6660602ab6
fix: redirect to dashboard homepage if user is authenticated 2022-12-03 14:57:08 +05:30
cdeabb06aa
feat: dashboard homepage. List existing deployments with add site btn 2022-12-03 14:56:17 +05:30
cbcd7bad7b
fix: rm loggedin_user link in authenticated nav bar component 2022-12-03 14:54:23 +05:30
7dca981ee3
fix: style: broken fullscreen component 2022-12-03 14:54:12 +05:30
eae0a568e7
fix: duplicate title 2022-12-03 14:53:55 +05:30
21bea52323
fix: revert back to using github.com for testing 2022-12-03 14:53:12 +05:30
0f77f81f84
fix: use localhost for dev
actix_identity doesn't work otherwise
2022-12-03 14:52:45 +05:30
2d9e952040
fix: load identity middleware 2022-12-03 14:03:24 +05:30
1015ccbf4d
chore: refactor Event to be deserializ-able 2022-11-27 22:01:36 +05:30
8a25459985
fix: duplicate home page. Redirect to login page, if user is
unauthenticated and redirect to dashboard homepage if user is
authenticated
2022-11-27 21:25:57 +05:30
26fdc1db9f
chore: use common repo URL, as specified in src/tests.rs 2022-11-27 21:07:05 +05:30
54c0323105
chore: mv deploy and meta API endpoints to src/api/v1 2022-11-27 21:06:42 +05:30
20c3ee1f11
feat: test for unique event names and return event IDs on update API calls 2022-11-15 20:51:34 +05:30
f89b3e6d4c
feat: log site deploy ,update and delete events in db 2022-11-15 20:24:13 +05:30
1e0fa7279f
chore: apply clippy lints 2022-11-15 18:09:34 +05:30
b07f076634
feat: read config from repository on every deploy and deployment update 2022-11-12 15:51:53 +05:30
2d9d511bb8
feat: read configuration from repositories
ref: #8
2022-11-12 15:51:34 +05:30
ccb0ac9d09
feat: test util: accept custom filename and content in write_file_util 2022-11-12 15:50:55 +05:30
3c3ff0f8a7
feat: report 404 when file not found in Git repo 2022-11-12 14:27:05 +05:30
3a961bc524
feat: add tracing log identifier to each HTTP route handler 2022-11-11 15:37:33 +05:30
0b2db58483
feat: replace log crate with tracing 2022-11-11 14:56:36 +05:30
83 changed files with 5948 additions and 1412 deletions

View file

@ -1,4 +1,4 @@
/target
**/target/
tarpaulin-report.html
.env
cobertura.xml

View file

@ -68,6 +68,9 @@ jobs:
- name: download deps
run: make dev-env
env:
LPCONDUCTOR_CREDS_USERNAME: "librepages_api"
LPCONDUCTOR_CREDS_PASSWORD: "longrandomlygeneratedpassword"
- name: Apply migrations
run: make migrate

View file

@ -55,6 +55,9 @@ jobs:
- name: download deps
run: make dev-env
env:
LPCONDUCTOR_CREDS_USERNAME: "librepages_api"
LPCONDUCTOR_CREDS_PASSWORD: "longrandomlygeneratedpassword"
- name: configure GPG key
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'realaravinth/librepages'

88
.woodpecker.yml Normal file
View file

@ -0,0 +1,88 @@
steps:
librepages-conductor:
image: realaravinth/librepages-conductor
detach: true
environment:
- LPCONDUCTOR__SOURCE_CODE=https://git.batsense.net/LibrePages/conductor
- LPCONDUCTOR_SERVER__PROXY_HAS_TLS=false
- LPCONDUCTOR_DEBUG=false
- LPCONDUCTOR_CONDUCTOR=dummy
- LPCONDUCTOR_SERVER_DOMAIN=librepages.test
- LPCONDUCTOR_SERVER_IP=0.0.0.0
- LPCONDUCTOR_SERVER_PROXY_HAS_TLS=false
- LPCONDUCTOR_SERVER_PORT=7000
- LPCONDUCTOR_SOURCE_CODE=https://example.org
- LPCONDUCTOR_CREDS_USERNAME=librepages_api
- LPCONDUCTOR_CREDS_TOKEN=longrandomlygeneratedpassword
- PORT=5000
- LPCONDUCTOR_CREDS_PASSWORD=longrandomlygeneratedpassword
commands:
- conductor serve
backend:
image: rust
environment:
- DATABASE_URL=postgres://postgres:password@database:5432/postgres
commands:
- curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&\
- apt update && apt-get -y --no-install-recommends install nodejs tar gpg curl wget
- rustup component add rustfmt
- rustup component add clippy
# rewrite conducotr configuration
- sed -i 's%url = "http:\/\/localhost:5000"%url = "http:\/\/librepages-conductor:5000"%' config/default.toml
- make dev-env
- make migrate
- make lint
- make test
- make release
build_docker_img:
image: plugins/docker
when:
event: [pull_request]
settings:
dry_run: true
repo: realaravinth/librepages
tags: latest
build_and_publish_docker_img:
image: plugins/docker
when:
event: [push, tag, deployment]
branch: master
settings:
username: realaravinth
password:
from_secret: DOCKER_TOKEN
repo: realaravinth/librepages
tags:
latest
# build_publisher_docker_img:
# image: plugins/docker
# when:
# event: [push, tag, deployment]
# settings:
# dry_run: true
# dockerfile: scripts/publish-bins-docker
# purge: false
# repo: realaravinth/librepages-publisher
# tags: latest
#
publish_bins:
image: rust
when:
event: [push, tag, deployment]
branch: master
commands:
- apt update
- apt-get -y --no-install-recommends install gpg tar curl wget
- echo -n "$RELEASE_BOT_GPG_SIGNING_KEY" | gpg --batch --import --pinentry-mode loopback
- scripts/bin-publish.sh publish master latest $DUMBSERVE_PASSWORD
secrets: [RELEASE_BOT_GPG_SIGNING_KEY, DUMBSERVE_PASSWORD, GPG_PASSWORD]
services:
database:
image: postgres
environment:
- POSTGRES_PASSWORD=password

2332
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,12 +1,12 @@
[package]
name = "pages"
name = "librepages"
version = "0.1.0"
edition = "2021"
build = "build.rs"
homepage = "https://github.com/realaravinth/pages"
repository = "https://github.com/realaravinth/pages"
documentation = "https://github.con/realaravinth/pages"
readme = "https://github.com/realaravinth/pages/blob/master/README.md"
homepage = "https://git.batsense.net/LibrePages/librepages"
repository = "https://git.batsense.net/LibrePages/librepages"
documentation = "https://git.batsense.net/LibrePages/librepages"
readme = "https://git.batsense.net/LibrePages/librepages/blob/master/README.md"
license = "AGPLv3 or later version"
authors = ["realaravinth <realaravinth@batsense.net>"]
@ -19,21 +19,21 @@ actix-identity = "0.4.0"
actix-rt = "2"
actix-web-codegen-const-routes = { version = "0.1.0", tag = "0.1.0", git = "https://github.com/realaravinth/actix-web-codegen-const-routes" }
argon2-creds = { branch = "master", git = "https://github.com/realaravinth/argon2-creds"}
sqlx = { version = "0.6.1", features = [ "runtime-actix-rustls", "postgres", "time", "offline", "json"] }
clap = { version = "3.2.20", features = ["derive"]}
sqlx = { version = "0.6.2", features = ["runtime-actix-rustls", "postgres", "time", "offline", "json", "uuid"] }
clap = { version = "4.0.0", features = ["derive"]}
libconfig = { version = "0.1.0", git = "https://git.batsense.net/librepages/libconfig" }
libconductor = { version = "0.1.0", git = "https://git.batsense.net/librepages/conductor/" }
config = "0.13"
git2 = "0.14.2"
config = "0.14"
git2 = "0.19.0"
serde = { version = "1", features = ["derive", "rc"]}
serde_json = "1"
pretty_env_logger = "0.4"
log = "0.4"
pretty_env_logger = "0.5"
lazy_static = "1.4"
url = "2.2"
url = { version = "2.2", features = ["serde"] }
urlencoding = "2.1.0"
derive_more = "0.99"
@ -41,13 +41,21 @@ derive_more = "0.99"
num_cpus = "1.13"
tokio = { version = "1", features=["sync"]}
num_enum = "0.5.7"
num_enum = "0.7.0"
mime_guess = "2.0.4"
mime = "0.3.16"
rust-embed = "6.3.0"
rust-embed = "8.0.0"
rand = "0.8.5"
tracing = { version = "0.1.37", features = ["log"]}
tracing-actix-web = "0.7.0"
toml = "0.8.0"
serde_yaml = "0.9.14"
uuid = { version = "1.2.2", features = ["serde"] }
reqwest = { version = "0.12.0", features = ["json"] }
sha2 = "0.10.6"
hmac = "0.12.1"
hex= "0.4.3"
[dependencies.cache-buster]
git = "https://github.com/realaravinth/cache-buster"
@ -65,7 +73,7 @@ version = "0.2"
[dev-dependencies]
futures = "0.3.24"
mktemp = "0.4.1"
mktemp = "0.5.0"
[workspace]

View file

@ -1,4 +1,4 @@
FROM node:16.9.1 as frontend
FROM node:20.17.0 as frontend
COPY package.json package-lock.json /src/
WORKDIR /src
RUN npm install
@ -19,11 +19,11 @@ RUN cd utils/cache-bust && cargo run
RUN cargo build --release
FROM debian:bullseye-slim
#RUN useradd -ms /bin/bash -u 1000 pages
#RUN mkdir -p /var/www/pages && chown pages /var/www/pages
#RUN useradd -ms /bin/bash -u 1000 librepages
#RUN mkdir -p /var/www/librepages && chown librepages /var/www/librepages
RUN apt-get update && apt-get install -y ca-certificates
COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
COPY --from=rust /src/target/release/pages /usr/local/bin/
COPY --from=rust /src/target/release/librepages /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

View file

@ -30,14 +30,14 @@ doc: ## Prepare documentation
docker: ## Build docker images
docker build \
-t realaravinth/pages:master \
-t realaravinth/pages:latest \
-t realaravinth/pages:0.1.0 .
-t realaravinth/librepages:master \
-t realaravinth/librepages:latest \
-t realaravinth/librepages:0.1.0 .
docker-publish: docker ## Build and publish docker images
docker push realaravinth/pages:master
docker push realaravinth/pages:latest
docker push realaravinth/pages:0.1.0
docker push realaravinth/librepages:master
docker push realaravinth/librepages:latest
docker push realaravinth/librepages:0.1.0
lint: ## Lint codebase
cargo fmt -v --all -- --emit files
@ -46,7 +46,7 @@ lint: ## Lint codebase
migrate: ## run migrations
$(call cache_bust)
unset DATABASE_URL && cargo build
cargo run -- migrate
DATABASE_URL=${DATABASE_URL} cargo run -- migrate
release: ## Release build
$(call cache_bust)

View file

@ -5,10 +5,8 @@
**Auto-deploy static websites from git repositories**
</p>
[![status-badge](https://ci.batsense.net/api/badges/LibrePages/librepages/status.svg)](https://ci.batsense.net/LibrePages/librepages)
[![Build](https://github.com/realaravinth/pages/actions/workflows/linux.yml/badge.svg)](https://github.com/realaravinth/pages/actions/workflows/linux.yml)
[![dependency status](https://deps.rs/repo/github/realaravinth/pages/status.svg)](https://deps.rs/repo/github/realaravinth/pages)
[![codecov](https://codecov.io/gh/realaravinth/pages/branch/master/graph/badge.svg)](https://codecov.io/gh/realaravinth/pages)
</div>

View file

@ -18,7 +18,7 @@ use std::process::Command;
fn main() {
let output = Command::new("git")
.args(&["rev-parse", "HEAD"])
.args(["rev-parse", "HEAD"])
.output()
.expect("error in git command, is git installed?");
let git_hash = String::from_utf8(output.stdout).unwrap();

View file

@ -1,8 +1,11 @@
debug = true
allow_registration = true
# source code of your copy of pages server.
source_code = "https://github.com/realaravinth/pages"
source_code = "https://git.batsense.net/LibrePages/pages"
support_email = "support@librepages.example.org"
conductors = [
{ username = "librepages_api", api_key = "longrandomlygeneratedpassword", url = "http://localhost:5000"}
]
[server]
# The port at which you want Pages to listen to
@ -13,10 +16,9 @@ ip= "0.0.0.0"
# Minimum of two threads are advisable for top async performance but can work
# with one also.
workers = 2
domain = "demo.librepages.org"
domain = "localhost"
cookie_secret = "94b2b2732626fdb7736229a7c777cb451e6304c147c4549f30"
[page]
base_path = "/tmp/librepages-defualt-config/"
base_domain = "librepages.test" # domain where customer pages will be deployed.

View file

@ -3,10 +3,10 @@
The process is tedious, most of this will be automated with a script in
the future.
## 1. Create new user for running `pages`:
## 1. Create new user for running `librepages`:
```bash
sudo useradd -b /srv -m -s /usr/bin/zsh pages
sudo useradd -b /srv -m -s /usr/bin/zsh librepages
```
## 2. Install Runtime dependencies
@ -19,11 +19,11 @@ On Debian-based systems, run:
sudo apt install nginx
```
## 3. Build `Pages`
## 3. Build `librepages`
### i. Install Build Dependencies
To build `pages`, you need the following dependencies:
To build `librepages`, you need the following dependencies:
1. [Git](https://packages.debian.org/bullseye/git)
2. [pkg-config](https://packages.debian.org/bullseye/pkg-config)
@ -71,23 +71,23 @@ Install binary and copy demo configuration file into default configuration
lookup path(`/etc/static-pages/config.toml`)
```bash
sudo cp ./target/release/pages /usr/local/bin/ && \
sudo cp ./target/release/librepages /usr/local/bin/ && \
sudo mkdir /etc/static-pages && \
sudo cp config/default.toml /etc/static-pages/config.toml
```
## 4. Systemd service configuration:
### i. Copy the following to `/etc/systemd/system/pages.service`:
### i. Copy the following to `/etc/systemd/system/librepages.service`:
```systemd
[Unit]
Description=pages: Auto-deploy static websites from git repositories
Description=librepages: Auto-deploy static websites from git repositories
[Service]
Type=simple
User=pages
ExecStart=/usr/local/bin/pages
User=librepages
ExecStart=/usr/local/bin/librepages
Restart=on-failure
RestartSec=1
MemoryDenyWriteExecute=true
@ -107,13 +107,13 @@ WantedBy=multi-user.target
```bash
sudo systemctl daemon-reload && \
sudo systemctl enable pages && \ # Auto startup during boot
sudo systemctl start pages
sudo systemctl enable librepages && \ # Auto startup during boot
sudo systemctl start librepages
```
## 5. Optionally configure Nginx to reverse proxy requests to Pages
## 5. Optionally configure Nginx to reverse proxy requests to LibrePages
**NOTE: This sections includes instructions to reverse proxy requests to
Pages API, not the websites managed by Pages.**
LibrePages API, not the websites managed by librepages.**
See [here](../../config/pages-nginx-config) for sample Nginx configuration.
See [here](../../config/librepages-nginx-config) for sample Nginx configuration.

View file

@ -3,8 +3,11 @@ CREATE TABLE IF NOT EXISTS librepages_sites (
repo_url VARCHAR(3000) NOT NULL,
branch TEXT NOT NULL,
hostname VARCHAR(3000) NOT NULL UNIQUE,
pub_id uuid NOT NULL UNIQUE,
ID SERIAL PRIMARY KEY NOT NULL,
deleted BOOLEAN DEFAULT FALSE,
owned_by INTEGER NOT NULL references librepages_users(ID) ON DELETE CASCADE
);
CREATE UNIQUE INDEX librepages_sites_site_secret ON librepages_sites(site_secret);
CREATE UNIQUE INDEX librepages_sites_site_pub_id ON librepages_sites(pub_id);

View file

@ -0,0 +1,14 @@
CREATE TABLE IF NOT EXISTS librepages_deploy_event_type (
name VARCHAR(30) NOT NULL UNIQUE,
ID SERIAL PRIMARY KEY NOT NULL
);
CREATE UNIQUE INDEX librepages_deploy_event_name_index ON librepages_deploy_event_type(name);
CREATE TABLE IF NOT EXISTS librepages_site_deploy_events (
site INTEGER NOT NULL references librepages_sites(ID) ON DELETE CASCADE,
event_type INTEGER NOT NULL references librepages_deploy_event_type(ID),
time timestamptz NOT NULL,
pub_id uuid NOT NULL UNIQUE,
ID SERIAL PRIMARY KEY NOT NULL
);

View file

@ -0,0 +1,15 @@
CREATE TABLE IF NOT EXISTS librepages_forgejo_webhooks (
forgejo_webhook_secret VARCHAR(40) NOT NULL UNIQUE,
forgejo_url VARCHAR(3000) NOT NULL,
auth_token VARCHAR(40) NOT NULL UNIQUE,
ID SERIAL PRIMARY KEY NOT NULL,
owned_by INTEGER NOT NULL references librepages_users(ID) ON DELETE CASCADE
);
CREATE UNIQUE INDEX librepages_forgejo_webhook_auth_token_index ON librepages_forgejo_webhooks(auth_token);
CREATE TABLE IF NOT EXISTS librepages_forgejo_webhook_site_mapping (
site_id INTEGER NOT NULL references librepages_sites(ID) ON DELETE CASCADE,
forgejo_webhook_id INTEGER NOT NULL references librepages_forgejo_webhooks(ID) ON DELETE CASCADE,
UNIQUE(site_id, forgejo_webhook_id)
);

331
package-lock.json generated
View file

@ -12,103 +12,19 @@
"sass": "^1.54.9"
}
},
"node_modules/anymatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
"integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
"dev": true,
"dependencies": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/binary-extensions": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"dependencies": {
"fill-range": "^7.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
"dev": true,
"funding": [
{
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
],
"dependencies": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
},
"engines": {
"node": ">= 8.10.0"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.0.tgz",
"integrity": "sha512-mxIojEAQcuEvT/lyXq+jf/3cO/KoA6z4CeNDGGevTybECPOMFCnQy3OPahluUkbqgPNGw5Bi78UC7Po6Lhy+NA==",
"dev": true,
"dependencies": {
"to-regex-range": "^5.0.1"
"readdirp": "^4.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
"dependencies": {
"is-glob": "^4.0.1"
"node": ">= 14.16.0"
},
"engines": {
"node": ">= 6"
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/immutable": {
@ -117,88 +33,26 @@
"integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==",
"dev": true
},
"node_modules/is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dev": true,
"dependencies": {
"binary-extensions": "^2.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
"node_modules/readdirp": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.1.tgz",
"integrity": "sha512-GkMg9uOTpIWWKbSsgwb5fA4EavTR+SG/PMPoAY8hkhHfEEY0/vqljY+XHqtDf2cr2IJtoNRDbrrEpZUiZCkYRw==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-glob": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dev": true,
"dependencies": {
"is-extglob": "^2.1.1"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"engines": {
"node": ">=0.12.0"
}
},
"node_modules/normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
"engines": {
"node": ">=8.6"
"node": ">= 14.16.0"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"dev": true,
"dependencies": {
"picomatch": "^2.2.1"
},
"engines": {
"node": ">=8.10.0"
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/sass": {
"version": "1.54.9",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.54.9.tgz",
"integrity": "sha512-xb1hjASzEH+0L0WI9oFjqhRi51t/gagWnxLiwUNMltA0Ab6jIDkAacgKiGYKM9Jhy109osM7woEEai6SXeJo5Q==",
"version": "1.79.3",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.79.3.tgz",
"integrity": "sha512-m7dZxh0W9EZ3cw50Me5GOuYm/tVAJAn91SUnohLRo9cXBixGUOdvmryN+dXpwR831bhoY3Zv7rEFt85PUwTmzA==",
"dev": true,
"dependencies": {
"chokidar": ">=3.0.0 <4.0.0",
"chokidar": "^4.0.0",
"immutable": "^4.0.0",
"source-map-js": ">=0.6.2 <2.0.0"
},
@ -206,7 +60,7 @@
"sass": "sass.js"
},
"engines": {
"node": ">=12.0.0"
"node": ">=14.0.0"
}
},
"node_modules/source-map-js": {
@ -217,85 +71,16 @@
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"dependencies": {
"is-number": "^7.0.0"
},
"engines": {
"node": ">=8.0"
}
}
},
"dependencies": {
"anymatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
"integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
"dev": true,
"requires": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
}
},
"binary-extensions": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"dev": true
},
"braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"requires": {
"fill-range": "^7.0.1"
}
},
"chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.0.tgz",
"integrity": "sha512-mxIojEAQcuEvT/lyXq+jf/3cO/KoA6z4CeNDGGevTybECPOMFCnQy3OPahluUkbqgPNGw5Bi78UC7Po6Lhy+NA==",
"dev": true,
"requires": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"fsevents": "~2.3.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
}
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"requires": {
"to-regex-range": "^5.0.1"
}
},
"fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"optional": true
},
"glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
"requires": {
"is-glob": "^4.0.1"
"readdirp": "^4.0.1"
}
},
"immutable": {
@ -304,64 +89,19 @@
"integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==",
"dev": true
},
"is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dev": true,
"requires": {
"binary-extensions": "^2.0.0"
}
},
"is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
"dev": true
},
"is-glob": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dev": true,
"requires": {
"is-extglob": "^2.1.1"
}
},
"is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
"normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
"dev": true
},
"picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true
},
"readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"dev": true,
"requires": {
"picomatch": "^2.2.1"
}
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.1.tgz",
"integrity": "sha512-GkMg9uOTpIWWKbSsgwb5fA4EavTR+SG/PMPoAY8hkhHfEEY0/vqljY+XHqtDf2cr2IJtoNRDbrrEpZUiZCkYRw==",
"dev": true
},
"sass": {
"version": "1.54.9",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.54.9.tgz",
"integrity": "sha512-xb1hjASzEH+0L0WI9oFjqhRi51t/gagWnxLiwUNMltA0Ab6jIDkAacgKiGYKM9Jhy109osM7woEEai6SXeJo5Q==",
"version": "1.79.3",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.79.3.tgz",
"integrity": "sha512-m7dZxh0W9EZ3cw50Me5GOuYm/tVAJAn91SUnohLRo9cXBixGUOdvmryN+dXpwR831bhoY3Zv7rEFt85PUwTmzA==",
"dev": true,
"requires": {
"chokidar": ">=3.0.0 <4.0.0",
"chokidar": "^4.0.0",
"immutable": "^4.0.0",
"source-map-js": ">=0.6.2 <2.0.0"
}
@ -371,15 +111,6 @@
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
"dev": true
},
"to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"requires": {
"is-number": "^7.0.0"
}
}
}
}

21
renovate.json Normal file
View file

@ -0,0 +1,21 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
":dependencyDashboard"
],
"labels": [
"renovate-bot"
],
"prHourlyLimit": 0,
"timezone": "Asia/kolkata",
"prCreation": "immediate",
"vulnerabilityAlerts": {
"enabled": true,
"labels": [
"renovate-bot",
"renovate-security",
"security"
]
}
}

View file

@ -33,14 +33,15 @@ FILENAME="$NAME-$2-linux-amd64"
TARBALL=$FILENAME.tar.gz
TARGET_DIR="$TMP_DIR/$FILENAME/"
mkdir -p $TARGET_DIR
DOCKER_IMG="realaravinth/pages:$3"
DOCKER_IMG="realaravinth/librepages:$3"
get_bin(){
echo "[*] Grabbing binary"
container_id=$(docker create $DOCKER_IMG)
docker cp $container_id:/usr/local/bin/pages $TARGET_DIR/
docker rm -v $container_id
#container_id=$(docker create $DOCKER_IMG)
#docker cp $container_id:/usr/local/bin/pages $TARGET_DIR/
#docker rm -v $container_id
cp target/release/librepages $TARGET_DIR
}
copy() {

23
scripts/conductor.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
readonly NAME=librepages-conductor
docker rm -f $NAME
docker create --name $NAME -p 5000:5000 \
-e LPCONDUCTOR__SOURCE_CODE="https://git.batsense.net/LibrePages/conductor" \
-e LPCONDUCTOR_SERVER__PROXY_HAS_TLS=false \
-e LPCONDUCTOR_DEBUG="false" \
-e LPCONDUCTOR_CONDUCTOR="dummy" \
-e LPCONDUCTOR_SERVER_URL_PREFIX="" \
-e LPCONDUCTOR_SERVER_DOMAIN="librepages.test" \
-e LPCONDUCTOR_SERVER_IP="0.0.0.0" \
-e LPCONDUCTOR_SERVER_PROXY_HAS_TLS="false" \
-e LPCONDUCTOR_SERVER_PORT=7000 \
-e LPCONDUCTOR_SOURCE_CODE="https://example.org" \
-e LPCONDUCTOR_CREDS_USERNAME=$LPCONDUCTOR_CREDS_USERNAME \
-e LPCONDUCTOR_CREDS_PASSWORD=$LPCONDUCTOR_CREDS_PASSWORD \
-e PORT="5000"\
realaravinth/librepages-conductor conductor serve
docker start $NAME

View file

@ -15,4 +15,4 @@ else
useradd --uid $USER_ID -b /home -m -s /bin/bash $LIBREPAGES_USER
fi
su $LIBREPAGES_USER -c 'pages'
su $LIBREPAGES_USER -c 'librepages'

View file

@ -0,0 +1,14 @@
FROM realaravinth/librepages:latest as base
RUN echo foo
FROM debian:bullseye-slim
RUN apt update
RUN apt-get -y --no-install-recommends install gpg tar curl wget
WORKDIR /src
COPY --from=base /usr/local/bin/librepages .
COPY . .
ARG RELEASE_BOT_GPG_SIGNING_KEY
RUN echo -n "$RELEASE_BOT_GPG_SIGNING_KEY"
RUN echo -n "$RELEASE_BOT_GPG_SIGNING_KEY" | gpg --batch --import --pinentry-mode loopback
env GPG_PASSWORD=$GPG_PASSWORD
RUN /src/scripts/bin-publish.sh publish master latest $DUMBSERVE_PASSWORD

View file

@ -1,33 +1,52 @@
{
"db": "PostgreSQL",
"1ac91b492001493430c686d9cd7d6be03ada4b4c431d7bc112ef2105eba0e82d": {
"10d30dade86d79210203bdbce4b6db5d2aa446b0f88ca834771ecbbe11be51fb": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Left": [
"Text",
"Text"
]
}
},
"query": "UPDATE librepages_sites SET deleted = true\n WHERE hostname = ($1)\n AND owned_by = ( SELECT ID FROM librepages_users WHERE name = $2);\n "
},
"12391b10cf16a807322c49c9cc7e0a015f26b445beacf4cdd4e7714f36b4adf6": {
"describe": {
"columns": [
{
"name": "repo_url",
"name": "site_secret",
"ordinal": 0,
"type_info": "Varchar"
},
{
"name": "branch",
"name": "repo_url",
"ordinal": 1,
"type_info": "Varchar"
},
{
"name": "branch",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "hostname",
"ordinal": 2,
"ordinal": 3,
"type_info": "Varchar"
},
{
"name": "owned_by",
"ordinal": 3,
"type_info": "Int4"
"name": "pub_id",
"ordinal": 4,
"type_info": "Uuid"
}
],
"nullable": [
false,
false,
false,
false,
false
],
"parameters": {
@ -36,7 +55,22 @@
]
}
},
"query": "SELECT repo_url, branch, hostname, owned_by\n FROM librepages_sites\n WHERE site_secret = $1\n "
"query": "SELECT site_secret, repo_url, branch, hostname, pub_id\n FROM librepages_sites\n WHERE deleted = false\n AND owned_by = (SELECT ID FROM librepages_users WHERE name = $1 );\n "
},
"14cdc724af64942e93994f97e9eafc8272d15605eff7aab9e5177d01f2bf6118": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Left": [
"Text",
"Timestamptz",
"Text",
"Uuid"
]
}
},
"query": "INSERT INTO librepages_site_deploy_events\n (event_type, time, site, pub_id) VALUES (\n (SELECT iD from librepages_deploy_event_type WHERE name = $1),\n $2,\n (SELECT ID from librepages_sites WHERE hostname = $3),\n $4\n );\n "
},
"1be33ea4fe0e6079c88768ff912b824f4b0250193f2d086046c1fd0da125ae0c": {
"describe": {
@ -77,30 +111,63 @@
},
"query": "UPDATE librepages_users set name = $1\n WHERE name = $2"
},
"3705b8869aab99d749c08d9c9633931f0b74216957b6a2881bd56a33c33a8c47": {
"39854fcbfb0247377c6c5ca70c2c0fa7804548848bf56f881eea2f8242e7a09d": {
"describe": {
"columns": [
{
"name": "exists",
"name": "name",
"ordinal": 0,
"type_info": "Bool"
"type_info": "Varchar"
},
{
"name": "time",
"ordinal": 1,
"type_info": "Timestamptz"
},
{
"name": "pub_id",
"ordinal": 2,
"type_info": "Uuid"
}
],
"nullable": [
null
false,
false,
false
],
"parameters": {
"Left": [
"Text"
"Text",
"Uuid"
]
}
},
"query": "SELECT EXISTS (SELECT 1 from librepages_sites WHERE hostname = $1)"
"query": "SELECT\n librepages_deploy_event_type.name,\n librepages_site_deploy_events.time,\n librepages_site_deploy_events.pub_id\n FROM\n librepages_site_deploy_events\n INNER JOIN librepages_deploy_event_type ON\n librepages_deploy_event_type.ID = librepages_site_deploy_events.event_type\n WHERE\n librepages_site_deploy_events.site = (\n SELECT ID FROM librepages_sites WHERE hostname = $1\n )\n AND\n librepages_site_deploy_events.pub_id = $2\n "
},
"416b9f0412f0d7ee05d4a350839c5a6d1e06c1d7f8942744f6d806ddc47084c2": {
"3ecc3a4c89b1289368ef9d9c97204330f74138a0da614ef2174c59a687119595": {
"describe": {
"columns": [],
"nullable": [],
"columns": [
{
"name": "forgejo_url",
"ordinal": 0,
"type_info": "Varchar"
},
{
"name": "auth_token",
"ordinal": 1,
"type_info": "Varchar"
},
{
"name": "forgejo_webhook_secret",
"ordinal": 2,
"type_info": "Varchar"
}
],
"nullable": [
false,
false,
false
],
"parameters": {
"Left": [
"Text",
@ -108,7 +175,122 @@
]
}
},
"query": "DELETE FROM librepages_sites\n WHERE hostname = ($1)\n AND owned_by = ( SELECT ID FROM librepages_users WHERE name = $2);\n "
"query": "SELECT\n forgejo_url, auth_token, forgejo_webhook_secret\n FROM\n librepages_forgejo_webhooks\n WHERE\n auth_token = $1\n AND\n owned_by = (SELECT ID FROM librepages_users WHERE name = $2);\n "
},
"432fe829719ce8110f768b4a611724bb34191ac224d2143ff4c81548da75c103": {
"describe": {
"columns": [
{
"name": "repo_url",
"ordinal": 0,
"type_info": "Varchar"
},
{
"name": "branch",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "hostname",
"ordinal": 2,
"type_info": "Varchar"
},
{
"name": "owned_by",
"ordinal": 3,
"type_info": "Int4"
},
{
"name": "site_secret",
"ordinal": 4,
"type_info": "Varchar"
}
],
"nullable": [
false,
false,
false,
false,
false
],
"parameters": {
"Left": [
"Uuid",
"Text"
]
}
},
"query": "SELECT repo_url, branch, hostname, owned_by, site_secret\n FROM librepages_sites\n WHERE pub_id = $1\n AND\n owned_by = (SELECT ID from librepages_users WHERE name = $2)\n AND\n deleted = false;\n "
},
"4445ff3226af3b5a24b255c5bb012c99b222cc7bd6dda80f232809ed273fc712": {
"describe": {
"columns": [
{
"name": "repo_url",
"ordinal": 0,
"type_info": "Varchar"
},
{
"name": "site_secret",
"ordinal": 1,
"type_info": "Varchar"
},
{
"name": "branch",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "hostname",
"ordinal": 3,
"type_info": "Varchar"
},
{
"name": "owned_by",
"ordinal": 4,
"type_info": "Int4"
},
{
"name": "pub_id",
"ordinal": 5,
"type_info": "Uuid"
}
],
"nullable": [
false,
false,
false,
false,
false,
false
],
"parameters": {
"Left": [
"Text"
]
}
},
"query": "SELECT repo_url, site_secret, branch, hostname, owned_by, pub_id\n FROM librepages_sites\n WHERE repo_url = $1\n AND deleted = false;\n "
},
"4cddf1049783251bfc79090055724e894a2be9451302f7691ce2f4240f1ee3ad": {
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Int4"
}
],
"nullable": [
false
],
"parameters": {
"Left": [
"Text"
]
}
},
"query": "SELECT ID FROM librepages_sites WHERE repo_url = $1"
},
"53f3c21c06c8d1c218537dfa9183fd0604aaf28200d8aa12e97db4ac317df39e": {
"describe": {
@ -130,6 +312,50 @@
},
"query": "SELECT name FROM librepages_users WHERE ID = $1"
},
"54f1ad328c83997d5e80686665d4cfef58d3529d24cb6caaa7ff301479e5d735": {
"describe": {
"columns": [
{
"name": "repo_url",
"ordinal": 0,
"type_info": "Varchar"
},
{
"name": "branch",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "hostname",
"ordinal": 2,
"type_info": "Varchar"
},
{
"name": "owned_by",
"ordinal": 3,
"type_info": "Int4"
},
{
"name": "pub_id",
"ordinal": 4,
"type_info": "Uuid"
}
],
"nullable": [
false,
false,
false,
false,
false
],
"parameters": {
"Left": [
"Text"
]
}
},
"query": "SELECT repo_url, branch, hostname, owned_by, pub_id\n FROM librepages_sites\n WHERE site_secret = $1\n AND deleted = false;\n "
},
"5c5d774bde06c0ab83c3616a56a28f12dfd9c546cbaac9f246d3b350c587823e": {
"describe": {
"columns": [],
@ -142,21 +368,50 @@
},
"query": "DELETE FROM librepages_users WHERE name = ($1)"
},
"67311c6196639edd153b7b7dd56a37703b67abe750b88f5afdcf0d3d779432e7": {
"65f6181364cd8c6ed4eae3f62b5ae771a27e8da6e698c235ca77d4cec784d04b": {
"describe": {
"columns": [],
"nullable": [],
"columns": [
{
"name": "site_secret",
"ordinal": 0,
"type_info": "Varchar"
},
{
"name": "repo_url",
"ordinal": 1,
"type_info": "Varchar"
},
{
"name": "branch",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "hostname",
"ordinal": 3,
"type_info": "Varchar"
},
{
"name": "pub_id",
"ordinal": 4,
"type_info": "Uuid"
}
],
"nullable": [
false,
false,
false,
false,
false
],
"parameters": {
"Left": [
"Varchar",
"Varchar",
"Text",
"Varchar",
"Text"
]
}
},
"query": "\n INSERT INTO librepages_sites\n (site_secret, repo_url, branch, hostname, owned_by)\n VALUES ($1, $2, $3, $4, ( SELECT ID FROM librepages_users WHERE name = $5 ));\n "
"query": "SELECT site_secret, repo_url, branch, hostname, pub_id\n FROM librepages_sites\n WHERE deleted = false\n AND owned_by = (SELECT ID FROM librepages_users WHERE name = $1 )\n AND hostname = $2;\n "
},
"6a557f851d4f47383b864085093beb0954e79779f21b655978f07e285281e0ac": {
"describe": {
@ -171,6 +426,53 @@
},
"query": "UPDATE librepages_users set email = $1\n WHERE name = $2"
},
"6db98c6ae90b8eb98ace1a5acfa3c8af2b6ed7d51c6debda12637f5d7b076c15": {
"describe": {
"columns": [
{
"name": "exists",
"ordinal": 0,
"type_info": "Bool"
}
],
"nullable": [
null
],
"parameters": {
"Left": [
"Text"
]
}
},
"query": "SELECT EXISTS (SELECT 1 from librepages_sites WHERE hostname = $1 AND deleted = false)"
},
"77612c85be99e6de2e4a6e3105ebaeb470d6cc57b2999b673a085da41c035f9e": {
"describe": {
"columns": [
{
"name": "time",
"ordinal": 0,
"type_info": "Timestamptz"
},
{
"name": "pub_id",
"ordinal": 1,
"type_info": "Uuid"
}
],
"nullable": [
false,
false
],
"parameters": {
"Left": [
"Text",
"Text"
]
}
},
"query": "SELECT\n time,\n pub_id\n FROM\n librepages_site_deploy_events\n WHERE\n site = (SELECT ID FROM librepages_sites WHERE hostname = $1)\n AND\n event_type = (SELECT ID FROM librepages_deploy_event_type WHERE name = $2)\n AND\n time = (\n SELECT MAX(time) \n FROM\n librepages_site_deploy_events\n WHERE\n site = (SELECT ID FROM librepages_sites WHERE hostname = $1)\n )\n "
},
"8735b654bc261571e6a5908d55a8217474c76bdff7f3cbcc71500a0fe13249db": {
"describe": {
"columns": [
@ -191,6 +493,41 @@
},
"query": "SELECT EXISTS (SELECT 1 from librepages_users WHERE email = $1)"
},
"8bf4e01b8c38d035fe6bdbfbe8ad9cb35e3fc2fd11107bae92880d157ed11379": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Left": [
"Varchar",
"Varchar",
"Varchar",
"Text"
]
}
},
"query": "INSERT INTO librepages_forgejo_webhooks\n (forgejo_url , auth_token, forgejo_webhook_secret, owned_by) VALUES ($1, $2, $3, \n (SELECT ID FROM librepages_users WHERE name = $4)\n )"
},
"90907d6cb4ca3b485f7b583584fb5821a950362679d061e490545c76634c211e": {
"describe": {
"columns": [
{
"name": "exists",
"ordinal": 0,
"type_info": "Bool"
}
],
"nullable": [
null
],
"parameters": {
"Left": [
"Text"
]
}
},
"query": "SELECT EXISTS (SELECT 1 from librepages_sites WHERE repo_url = $1)"
},
"924e756de5544cece865a10a7e136ecc6126e3a603947264cc7899387c18c819": {
"describe": {
"columns": [],
@ -204,32 +541,26 @@
},
"query": "UPDATE librepages_users set password = $1\n WHERE name = $2"
},
"9fd163d10860ad4519f9398582aaa0615d6d7b784e844ee71038f77dcd069eed": {
"9710a01bc4c5c5cda2db27d14baca3d7a6ceffa66c7d539da6fda7947c222e71": {
"describe": {
"columns": [
{
"name": "site_secret",
"name": "forgejo_url",
"ordinal": 0,
"type_info": "Varchar"
},
{
"name": "repo_url",
"name": "auth_token",
"ordinal": 1,
"type_info": "Varchar"
},
{
"name": "branch",
"name": "forgejo_webhook_secret",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "hostname",
"ordinal": 3,
"type_info": "Varchar"
}
],
"nullable": [
false,
false,
false,
false
@ -240,46 +571,39 @@
]
}
},
"query": "SELECT site_secret, repo_url, branch, hostname\n FROM librepages_sites\n WHERE owned_by = (SELECT ID FROM librepages_users WHERE name = $1 );\n "
"query": "SELECT\n forgejo_url, auth_token, forgejo_webhook_secret\n FROM\n librepages_forgejo_webhooks\n WHERE\n owned_by = (SELECT ID FROM librepages_users WHERE name = $1);\n "
},
"aad26d1f932001cbe49b147348aa528eca5101ec6ef83cb034e1ccd0dbd17878": {
"a6284ede1dbf340942dd97afb75865ba0a41009a145254117b03002bd9afa588": {
"describe": {
"columns": [
{
"name": "site_secret",
"name": "forgejo_url",
"ordinal": 0,
"type_info": "Varchar"
},
{
"name": "repo_url",
"name": "auth_token",
"ordinal": 1,
"type_info": "Varchar"
},
{
"name": "branch",
"name": "forgejo_webhook_secret",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "hostname",
"ordinal": 3,
"type_info": "Varchar"
}
],
"nullable": [
false,
false,
false,
false
],
"parameters": {
"Left": [
"Text",
"Text"
]
}
},
"query": "SELECT site_secret, repo_url, branch, hostname\n FROM librepages_sites\n WHERE owned_by = (SELECT ID FROM librepages_users WHERE name = $1 )\n AND hostname = $2;\n "
"query": "SELECT forgejo_url, auth_token, forgejo_webhook_secret\n FROM librepages_forgejo_webhooks\n WHERE auth_token = $1\n "
},
"b48c77db6e663d97df44bf9ec2ee92fd3e02f2dcbcdbd1d491e09fab2da68494": {
"describe": {
@ -307,6 +631,37 @@
},
"query": "SELECT name, password FROM librepages_users WHERE email = ($1)"
},
"b7e51e976a4a80a78df8dbfed1f195af212023d00faee88ab2d09326896bd653": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Left": [
"Text",
"Int4",
"Text"
]
}
},
"query": "INSERT INTO librepages_forgejo_webhook_site_mapping\n (site_id, forgejo_webhook_id) VALUES (\n (SELECT ID FROM librepages_sites WHERE repo_url = $1 AND ID = $2),\n (SELECT ID FROM librepages_forgejo_webhooks WHERE auth_token = $3)\n ) ON CONFLICT (site_id, forgejo_webhook_id) DO NOTHING;"
},
"b8b1b3c5fa205b071f577b2ce9993ddfc7c99ada26aea48aa1c201c8c3c7fcf6": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Left": [
"Varchar",
"Varchar",
"Text",
"Varchar",
"Uuid",
"Text"
]
}
},
"query": "\n INSERT INTO librepages_sites\n (site_secret, repo_url, branch, hostname, pub_id, owned_by)\n VALUES ($1, $2, $3, $4, $5, ( SELECT ID FROM librepages_users WHERE name = $6 ));\n "
},
"bdd4d2a1b0b97ebf8ed61cfd120b40146fbf3ea9afb5cd0e03c9d29860b6a26b": {
"describe": {
"columns": [
@ -347,6 +702,70 @@
},
"query": "SELECT email FROM librepages_users WHERE name = $1"
},
"d2327c1bcb40e18518c2112413a19a9b26eb0f54f83c53e968c9752d70c8dd4e": {
"describe": {
"columns": [
{
"name": "name",
"ordinal": 0,
"type_info": "Varchar"
},
{
"name": "time",
"ordinal": 1,
"type_info": "Timestamptz"
},
{
"name": "pub_id",
"ordinal": 2,
"type_info": "Uuid"
}
],
"nullable": [
false,
false,
false
],
"parameters": {
"Left": [
"Text"
]
}
},
"query": "SELECT\n librepages_deploy_event_type.name,\n librepages_site_deploy_events.time,\n librepages_site_deploy_events.pub_id\n FROM\n librepages_site_deploy_events\n INNER JOIN librepages_deploy_event_type ON\n librepages_deploy_event_type.ID = librepages_site_deploy_events.event_type\n WHERE\n librepages_site_deploy_events.site = (\n SELECT ID FROM librepages_sites WHERE hostname = $1\n );\n "
},
"e4adf1bc9175eeb9d61b495653bb452039cc38818c8792acdc6a1c732b6f4554": {
"describe": {
"columns": [
{
"name": "exists",
"ordinal": 0,
"type_info": "Bool"
}
],
"nullable": [
null
],
"parameters": {
"Left": [
"Text"
]
}
},
"query": "SELECT EXISTS (SELECT 1 from librepages_deploy_event_type WHERE name = $1)"
},
"f651da8f411b7977cb87dd8d4bd5d167661d7ef1d865747e76219453d386d593": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Left": [
"Varchar"
]
}
},
"query": "INSERT INTO librepages_deploy_event_type\n (name) VALUES ($1) ON CONFLICT (name) DO NOTHING;"
},
"faa4170a309f19a4abf1ca3f8dd3c0526945aa00f028ebf8bd7063825d448f5b": {
"describe": {
"columns": [],

View file

@ -58,6 +58,7 @@ pub struct Username {
path = "crate::V1_API_ROUTES.account.update_username",
wrap = "super::get_auth_middleware()"
)]
#[tracing::instrument(name = "Update username", skip(ctx, payload, id))]
async fn set_username(
id: Identity,
payload: web::Json<Username>,
@ -74,6 +75,7 @@ async fn set_username(
}
#[actix_web_codegen_const_routes::post(path = "crate::V1_API_ROUTES.account.username_exists")]
#[tracing::instrument(name = "Check if username exists", skip(ctx, payload))]
async fn username_exists(
payload: web::Json<AccountCheckPayload>,
ctx: AppCtx,
@ -82,6 +84,7 @@ async fn username_exists(
}
#[actix_web_codegen_const_routes::post(path = "crate::V1_API_ROUTES.account.email_exists")]
#[tracing::instrument(name = "Check if email exists", skip(ctx, payload))]
pub async fn email_exists(
payload: web::Json<AccountCheckPayload>,
ctx: AppCtx,
@ -94,6 +97,7 @@ pub async fn email_exists(
path = "crate::V1_API_ROUTES.account.update_email",
wrap = "super::get_auth_middleware()"
)]
#[tracing::instrument(name = "Update email", skip(ctx, payload, id))]
async fn set_email(
id: Identity,
payload: web::Json<Email>,
@ -108,6 +112,7 @@ async fn set_email(
path = "crate::V1_API_ROUTES.account.delete",
wrap = "super::get_auth_middleware()"
)]
#[tracing::instrument(name = "Delete account", skip(ctx, payload, id))]
async fn delete_account(
id: Identity,
payload: web::Json<Password>,
@ -124,6 +129,7 @@ async fn delete_account(
path = "crate::V1_API_ROUTES.account.update_password",
wrap = "super::get_auth_middleware()"
)]
#[tracing::instrument(name = "Update user password", skip(ctx, payload, id))]
async fn update_user_password(
id: Identity,
ctx: AppCtx,

View file

@ -30,12 +30,14 @@ pub fn services(cfg: &mut web::ServiceConfig) {
cfg.service(signout);
}
#[actix_web_codegen_const_routes::post(path = "crate::V1_API_ROUTES.auth.register")]
#[tracing::instrument(name = "Register new user", skip(ctx, payload))]
async fn register(payload: web::Json<Register>, ctx: AppCtx) -> ServiceResult<impl Responder> {
ctx.register(&payload).await?;
Ok(HttpResponse::Ok())
}
#[actix_web_codegen_const_routes::post(path = "crate::V1_API_ROUTES.auth.login")]
#[tracing::instrument(name = "Login", skip(ctx, payload, id, query))]
async fn login(
id: Identity,
payload: web::Json<Login>,
@ -59,6 +61,7 @@ async fn login(
path = "crate::V1_API_ROUTES.auth.logout",
wrap = "super::get_auth_middleware()"
)]
#[tracing::instrument(name = "Sign out", skip(id))]
async fn signout(id: Identity) -> impl Responder {
use actix_auth_middleware::GetLoginRoute;

282
src/api/v1/forgejo.rs Normal file
View file

@ -0,0 +1,282 @@
/*
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use actix_identity::Identity;
use actix_web::{web, HttpRequest, HttpResponse, Responder};
use serde::{Deserialize, Serialize};
use tracing::info;
use url::Url;
use super::get_auth_middleware;
use crate::{errors::*, AppCtx};
pub mod routes {
use crate::ctx::Ctx;
pub struct Forgejo {
pub add_webhook: &'static str,
pub view_webhook: &'static str,
pub list_webhooks: &'static str,
pub webhook: &'static str,
}
impl Forgejo {
pub const fn new() -> Self {
Self {
add_webhook: "/api/v1/forgejo/webhook/add",
list_webhooks: "/api/v1/forgejo/webhook/add",
view_webhook: "/api/v1/forgejo/webhook/view/{auth_token}",
webhook: "/api/v1/forgejo/webhook/event/new",
}
}
pub fn get_view(&self, auth_token: &str) -> String {
self.view_webhook.replace("{auth_token}", auth_token)
}
pub fn get_webhook_url(&self, ctx: &Ctx, auth_token: &str) -> String {
format!(
"https://{}{}?auth={auth_token}",
&ctx.settings.server.domain, self.webhook
)
}
}
}
#[derive(Serialize, Deserialize)]
pub struct AddWebhook {
pub forgejo_url: Url,
}
#[actix_web_codegen_const_routes::post(
path = "crate::V1_API_ROUTES.forgejo.add_webhook",
wrap = "get_auth_middleware()"
)]
#[tracing::instrument(name = "Add webhook" skip(id, ctx, payload))]
async fn add_webhook(
ctx: AppCtx,
id: Identity,
payload: web::Json<AddWebhook>,
) -> ServiceResult<impl Responder> {
info!(
"Adding webhook for Forgejo instance: {}",
payload.forgejo_url.as_str()
);
let owner = id.identity().unwrap();
let payload = payload.into_inner();
let hook = ctx.db.new_webhook(payload.forgejo_url, &owner).await?;
Ok(HttpResponse::Ok().json(hook))
}
#[actix_web_codegen_const_routes::get(
path = "crate::V1_API_ROUTES.forgejo.list_webhooks",
wrap = "get_auth_middleware()"
)]
#[tracing::instrument(name = "Delete webhook" skip(id, ctx))]
async fn list_webhooks(ctx: AppCtx, id: Identity) -> ServiceResult<impl Responder> {
let owner = id.identity().unwrap();
info!("Getting all webhooks created by {}", owner);
let hooks = ctx.db.list_all_webhooks_with_owner(&owner).await?;
Ok(HttpResponse::Ok().json(hooks))
}
#[actix_web_codegen_const_routes::get(
path = "crate::V1_API_ROUTES.forgejo.view_webhook",
wrap = "get_auth_middleware()"
)]
#[tracing::instrument(name = "Delete webhook" skip(id, ctx, path))]
async fn view_webhook(
ctx: AppCtx,
id: Identity,
path: web::Path<String>,
) -> ServiceResult<impl Responder> {
let path = path.into_inner();
let owner = id.identity().unwrap();
info!("Gitting webhook webhook for Forgejo instance: {}", path,);
let hook = ctx.db.get_webhook_with_owner(&path, &owner).await?;
Ok(HttpResponse::Ok().json(hook))
}
#[derive(Serialize, Deserialize)]
struct Auth {
auth: String,
}
#[actix_web_codegen_const_routes::post(path = "crate::V1_API_ROUTES.forgejo.webhook")]
#[tracing::instrument(name = "Update ", skip(body, ctx, req, q))]
async fn webhook(
ctx: AppCtx,
body: web::Bytes,
req: HttpRequest,
q: web::Query<Auth>,
) -> ServiceResult<impl Responder> {
ctx.process_webhook(&body, &req, &q.auth).await?;
Ok(HttpResponse::Ok())
}
pub fn services(cfg: &mut web::ServiceConfig) {
cfg.service(add_webhook);
cfg.service(view_webhook);
cfg.service(list_webhooks);
cfg.service(webhook);
}
#[cfg(test)]
mod tests {
use actix_web::{error::ResponseError, http::StatusCode, test};
use hmac::Mac;
use crate::ctx::api::v1::forgejo::{HmacSha256, WebhookPayload};
use crate::db::ForgejoWebhook;
use crate::tests;
use crate::*;
use super::*;
#[actix_rt::test]
async fn test_api_forgejo_webhook() {
const NAME: &str = "apiforgejowebhookuser";
const PASSWORD: &str = "longpasswordasdfa2";
const EMAIL: &str = "apiforgejowebhookuser@a.com";
let (_dir, ctx) = tests::get_ctx().await;
let _ = ctx.delete_user(NAME, PASSWORD).await;
let (_, signin_resp) = ctx.register_and_signin(NAME, EMAIL, PASSWORD).await;
let page = ctx.add_test_site(NAME.into()).await;
let cookies = get_cookie!(signin_resp);
let app = get_app!(ctx).await;
let payload = AddWebhook {
forgejo_url: Url::parse("https://git.batnsense.net").unwrap(),
};
let add_webhook_resp = test::call_service(
&app,
post_request!(&payload, V1_API_ROUTES.forgejo.add_webhook)
.cookie(cookies.clone())
.to_request(),
)
.await;
check_status!(add_webhook_resp, StatusCode::OK);
let response: ForgejoWebhook = actix_web::test::read_body_json(add_webhook_resp).await;
assert_eq!(response.forgejo_url, payload.forgejo_url);
let view_webhook_resp = get_request!(
&app,
&V1_API_ROUTES.forgejo.get_view(&response.auth_token),
cookies.clone()
);
check_status!(view_webhook_resp, StatusCode::OK);
let hook: ForgejoWebhook = actix_web::test::read_body_json(view_webhook_resp).await;
assert_eq!(hook, response);
let list_all_webhooks_resp =
get_request!(&app, V1_API_ROUTES.forgejo.list_webhooks, cookies.clone());
check_status!(list_all_webhooks_resp, StatusCode::OK);
let hooks: Vec<ForgejoWebhook> =
actix_web::test::read_body_json(list_all_webhooks_resp).await;
assert_eq!(vec![hook.clone()], hooks);
let webhook_url = format!("{}?auth={}", V1_API_ROUTES.forgejo.webhook, hook.auth_token);
// test webhook
let mut webhook_payload = WebhookPayload::default();
webhook_payload.reference = format!("refs/origin/{}", page.branch);
webhook_payload.repository.html_url = page.repo;
let body = serde_json::to_string(&webhook_payload).unwrap();
let body = body.as_bytes();
let mut mac = HmacSha256::new_from_slice(hook.forgejo_webhook_secret.as_bytes())
.expect("HMAC can take key of any size");
mac.update(body);
let res = mac.finalize();
let sig = res.into_bytes();
let sig = hex::encode(&sig[..]);
let post_to_webhook_resp = test::call_service(
&app,
post_request!(&webhook_payload, &webhook_url)
.insert_header(("X-Gitea-Delivery", "foobar213randomuuid"))
.insert_header(("X-Gitea-Signature", sig.clone()))
.insert_header(("X-Gitea-Event", "push"))
.cookie(cookies.clone())
.to_request(),
)
.await;
check_status!(post_to_webhook_resp, StatusCode::OK);
// no webhook
let fake_webhook_url = format!(
"{}?auth={}",
V1_API_ROUTES.forgejo.webhook, hook.forgejo_webhook_secret
);
let body = serde_json::to_string(&webhook_payload).unwrap();
let body = body.as_bytes();
let mut mac =
HmacSha256::new_from_slice(b"nosecret").expect("HMAC can take key of any size");
mac.update(body);
let res = mac.finalize();
let fake_sig = res.into_bytes();
let fake_sig = hex::encode(&fake_sig[..]);
let post_to_no_exist_webhook_resp = test::call_service(
&app,
post_request!(&webhook_payload, &fake_webhook_url)
.insert_header(("X-Gitea-Delivery", "foobar213randomuuid"))
.insert_header(("X-Gitea-Signature", fake_sig))
.insert_header(("X-Gitea-Event", "push"))
.cookie(cookies.clone())
.to_request(),
)
.await;
let err = ServiceError::WebhookNotFound;
assert_eq!(post_to_no_exist_webhook_resp.status(), err.status_code());
let resp_err: ErrorToResponse =
actix_web::test::read_body_json(post_to_no_exist_webhook_resp).await;
assert_eq!(resp_err.error, err.to_string());
// no website
let mut webhook_payload = WebhookPayload::default();
webhook_payload.reference = format!("refs/origin/{}", page.branch);
webhook_payload.repository.html_url = "https://no-exist-git.example.org".into();
let body = serde_json::to_string(&webhook_payload).unwrap();
let body = body.as_bytes();
let mut mac = HmacSha256::new_from_slice(hook.forgejo_webhook_secret.as_bytes())
.expect("HMAC can take key of any size");
mac.update(body);
let res = mac.finalize();
let sig = res.into_bytes();
let sig = hex::encode(&sig[..]);
let post_to_no_website_webhook_resp = test::call_service(
&app,
post_request!(&webhook_payload, &webhook_url)
.insert_header(("X-Gitea-Delivery", "foobar213randomuuid"))
.insert_header(("X-Gitea-Signature", sig.clone()))
.insert_header(("X-Gitea-Event", "push"))
.cookie(cookies.clone())
.to_request(),
)
.await;
let err = ServiceError::WebsiteNotFound;
assert_eq!(post_to_no_website_webhook_resp.status(), err.status_code());
let resp_err: ErrorToResponse =
actix_web::test::read_body_json(post_to_no_website_webhook_resp).await;
assert_eq!(resp_err.error, err.to_string());
}
}

View file

@ -44,6 +44,7 @@ pub mod routes {
/// emits build details of the binary
#[actix_web_codegen_const_routes::get(path = "crate::V1_API_ROUTES.meta.build_details")]
#[tracing::instrument(name = "Fetch Build Details", skip(ctx))]
async fn build_details(ctx: AppCtx) -> impl Responder {
let build = BuildDetails {
version: VERSION,
@ -61,6 +62,7 @@ pub struct Health {
/// checks all components of the system
#[actix_web_codegen_const_routes::get(path = "crate::V1_API_ROUTES.meta.health")]
#[tracing::instrument(name = "Fetch health", skip(ctx))]
async fn health(ctx: crate::AppCtx) -> impl Responder {
let res = Health {
db: ctx.db.ping().await,

View file

@ -20,6 +20,9 @@ use serde::Deserialize;
pub mod account;
pub mod auth;
pub mod forgejo;
pub mod meta;
pub mod pages;
pub mod routes;
pub use routes::ROUTES;
@ -27,8 +30,9 @@ pub use routes::ROUTES;
pub fn services(cfg: &mut ServiceConfig) {
auth::services(cfg);
account::services(cfg);
crate::meta::services(cfg);
crate::deploy::services(cfg);
meta::services(cfg);
forgejo::services(cfg);
pages::services(cfg);
}
#[derive(Deserialize)]

View file

@ -16,7 +16,7 @@
*/
use actix_web::{web, HttpResponse, Responder};
use serde::{Deserialize, Serialize};
use tokio::sync::oneshot;
use uuid::Uuid;
use crate::errors::*;
use crate::page::Page;
@ -44,12 +44,19 @@ pub struct DeployEvent {
pub branch: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DeployEventResp {
pub id: Uuid,
}
#[actix_web_codegen_const_routes::post(path = "crate::V1_API_ROUTES.deploy.update")]
#[tracing::instrument(name = "Update webpages", skip(payload, ctx))]
async fn update(payload: web::Json<DeployEvent>, ctx: AppCtx) -> ServiceResult<impl Responder> {
let payload = payload.into_inner();
ctx.update_site(&payload.secret, Some(payload.branch))
let id = ctx
.update_site(&payload.secret, Some(payload.branch))
.await?;
Ok(HttpResponse::Ok())
Ok(HttpResponse::Ok().json(DeployEventResp { id }))
}
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
@ -81,12 +88,12 @@ impl DeployInfo {
}
#[actix_web_codegen_const_routes::post(path = "crate::V1_API_ROUTES.deploy.info")]
#[tracing::instrument(name = "Get webpage deploy info", skip(payload, ctx))]
async fn deploy_info(
payload: web::Json<DeploySecret>,
ctx: AppCtx,
) -> ServiceResult<impl Responder> {
if let Ok(page) = ctx.db.get_site_from_secret(&payload.secret).await {
// if let Some(page) = find_page(&payload.secret, &ctx) {
let resp = DeployInfo::from_page(&Page::from_site(&ctx.settings, page))?;
Ok(HttpResponse::Ok().json(resp))
} else {
@ -131,6 +138,10 @@ mod tests {
)
.await;
check_status!(resp, StatusCode::OK);
let event_id: DeployEventResp = actix_web::test::read_body_json(resp).await;
let update_event = ctx.db.get_event(&page.domain, &event_id.id).await.unwrap();
assert_eq!(&update_event.site, &page.domain);
assert_eq!(update_event.id, event_id.id);
payload.secret = page.branch.clone();

View file

@ -17,10 +17,12 @@
//! V1 API Routes
use actix_auth_middleware::GetLoginRoute;
use crate::deploy::routes::Deploy;
use crate::meta::routes::Meta;
use crate::serve::routes::Serve;
use super::forgejo::routes::Forgejo;
use super::meta::routes::Meta;
use super::pages::routes::Deploy;
/// constant [Routes](Routes) instance
pub const ROUTES: Routes = Routes::new();
@ -91,6 +93,7 @@ pub struct Routes {
pub account: Account,
/// Meta routes
pub meta: Meta,
pub forgejo: Forgejo,
pub deploy: Deploy,
pub serve: Serve,
}
@ -102,6 +105,7 @@ impl Routes {
auth: Auth::new(),
account: Account::new(),
meta: Meta::new(),
forgejo: Forgejo::new(),
deploy: Deploy::new(),
serve: Serve::new(),
}

96
src/conductor.rs Normal file
View file

@ -0,0 +1,96 @@
/*
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use reqwest::Client;
use libconductor::EventType;
use libconfig::Config;
use tracing::info;
use crate::errors::ServiceResult;
use crate::{page::Page, settings::Settings};
#[derive(Clone)]
pub struct Conductor {
client: Client,
pub settings: Settings,
}
impl Conductor {
pub fn new(settings: Settings, client: Option<Client>) -> Self {
let client = if let Some(client) = client {
client
} else {
Client::new()
};
Self { client, settings }
}
async fn tx(&self, e: &EventType) -> ServiceResult<()> {
for c in self.settings.conductors.iter() {
info!("Tx event to {}", c.url);
let mut event_url = c.url.clone();
event_url.set_path("/api/v1/events/new");
self.client
.post(event_url)
.basic_auth(&c.username, Some(&c.api_key))
.json(e)
.send()
.await
.unwrap();
}
Ok(())
}
pub async fn new_site(&self, page: Page) -> ServiceResult<()> {
let msg = EventType::NewSite {
hostname: page.domain,
branch: page.branch,
path: page.path,
};
self.tx(&msg).await
}
pub async fn tx_config(&self, config: Config) -> ServiceResult<()> {
self.tx(&EventType::Config { data: config }).await
}
pub async fn delete_site(&self, hostname: String) -> ServiceResult<()> {
self.tx(&EventType::DeleteSite { hostname }).await
}
}
#[cfg(test)]
mod tests {
use super::*;
use uuid::Uuid;
#[actix_rt::test]
pub async fn test_conductor() {
let settings = Settings::new().unwrap();
let c = Conductor::new(settings.clone(), None);
c.delete_site("example.org".into()).await.unwrap();
let page = Page {
secret: "foo".into(),
repo: "foo".into(),
path: "foo".into(),
branch: "foo".into(),
domain: "foo".into(),
pub_id: Uuid::new_v4(),
};
c.new_site(page).await.unwrap();
}
}

204
src/ctx/api/v1/forgejo.rs Normal file
View file

@ -0,0 +1,204 @@
/*
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use actix_web::web;
use actix_web::HttpRequest;
use hmac::{Hmac, Mac};
use serde::{Deserialize, Serialize};
use sha2::Sha256;
use tracing::{info, warn};
use url::Url;
use crate::ctx::Ctx;
use crate::errors::ServiceError;
use crate::errors::ServiceResult;
pub type HmacSha256 = Hmac<Sha256>;
#[derive(Serialize, Deserialize, Debug, Default, Clone, Eq, PartialEq)]
pub struct CommitPerson {
pub name: String,
pub email: String,
pub username: String,
}
#[derive(Serialize, Deserialize, Default, Debug, Clone, Eq, PartialEq)]
pub struct Commit {
pub id: String,
pub message: String,
pub url: String,
pub author: CommitPerson,
pub committer: CommitPerson,
pub verification: serde_json::Value,
pub timestamp: String,
pub added: serde_json::Value,
pub removed: serde_json::Value,
pub modified: serde_json::Value,
}
#[derive(Serialize, Deserialize, Debug, Default, Clone, Eq, PartialEq)]
pub struct Person {
pub id: usize,
pub login: String,
pub full_name: String,
pub email: String,
pub avatar_url: String,
pub language: String,
pub is_admin: bool,
pub last_login: String,
pub created: String,
pub restricted: bool,
pub active: bool,
pub prohibit_login: bool,
pub location: String,
pub website: String,
pub description: String,
pub visibility: String,
pub followers_count: usize,
pub following_count: usize,
pub starred_repos_count: usize,
pub username: String,
}
#[derive(Serialize, Deserialize, Debug, Default, Clone, Eq, PartialEq)]
pub struct Permissions {
pub admin: bool,
pub push: bool,
pub pull: bool,
}
#[derive(Serialize, Deserialize, Debug, Default, Clone, Eq, PartialEq)]
pub struct InternalTracker {
pub enable_time_tracker: bool,
pub allow_only_contributors_to_track_time: bool,
pub enable_issue_dependencies: bool,
}
#[derive(Serialize, Deserialize, Debug, Default, Clone, Eq, PartialEq)]
pub struct Repository {
pub id: usize,
pub owner: Person,
pub name: String,
pub full_name: String,
pub description: String,
pub empty: bool,
pub private: bool,
pub fork: bool,
pub template: bool,
pub parent: Option<serde_json::Value>,
pub mirror: bool,
pub size: usize,
pub html_url: String,
pub ssh_url: String,
pub clone_url: String,
pub original_url: String,
pub website: String,
pub stars_count: usize,
pub forks_count: usize,
pub watchers_count: usize,
pub open_issues_count: usize,
pub open_pr_counter: usize,
pub release_counter: usize,
pub default_branch: String,
pub archived: bool,
pub created_at: String,
pub updated_at: String,
pub permissions: Permissions,
pub has_issues: bool,
pub internal_tracker: InternalTracker,
pub has_wiki: bool,
pub has_pull_requests: bool,
pub has_projects: bool,
pub ignore_whitespace_conflicts: bool,
pub allow_merge_commits: bool,
pub allow_rebase: bool,
pub allow_rebase_explicit: bool,
pub allow_squash_merge: bool,
pub default_merge_style: String,
pub avatar_url: String,
pub internal: bool,
pub mirror_interval: String,
pub mirror_updated: String,
pub repo_transfer: Option<serde_json::Value>,
}
#[derive(Serialize, Deserialize, Debug, Default, Clone, Eq, PartialEq)]
pub struct WebhookPayload {
#[serde(rename(serialize = "ref", deserialize = "ref"))]
pub reference: String,
pub before: String,
pub after: String,
pub compare_url: String,
pub repository: Repository,
pub pusher: Person,
pub sender: Person,
}
impl Ctx {
pub async fn process_webhook(
&self,
body: &web::Bytes,
req: &HttpRequest,
auth_token: &str,
) -> ServiceResult<()> {
let headers = req.headers();
let _uuid = headers.get("X-Gitea-Delivery").unwrap();
let sig = headers.get("X-Gitea-Signature").unwrap();
let sig = hex::decode(sig).unwrap();
let event_type = headers.get("X-Gitea-Event").unwrap();
let payload: WebhookPayload = serde_json::from_slice(body).unwrap();
let hook = self.db.get_webhook(auth_token).await?;
for url in [
&payload.repository.html_url,
&payload.repository.ssh_url,
&payload.repository.clone_url,
] {
if self.db.site_with_repository_exists(url).await? {
let mut mac = HmacSha256::new_from_slice(hook.forgejo_webhook_secret.as_bytes())?;
mac.update(body);
mac.verify_slice(&sig[..])?;
let site = self.db.get_site_from_repo_url(url).await?;
self.db
.webhook_link_site(auth_token, &Url::parse(&site.repo_url)?)
.await?;
if payload.reference.contains(&site.branch) {
info!(
"[webhook][forgejo/gitea] received update {:?} from {url} repository on deployed branch",
event_type
);
self.update_site(&site.site_secret, Some(site.branch))
.await?;
} else {
info!(
"[webhook][forgejo/gitea] received update {:?} from {url} repository on non-deployed branch {}",
event_type,
payload.reference
);
}
return Ok(());
}
}
warn!(
"[webhook][forgejo/gitea] stray update from {} repository",
payload.repository.html_url
);
Err(ServiceError::WebsiteNotFound)
}
}

View file

@ -16,6 +16,7 @@
*/
pub mod account;
pub mod auth;
pub mod forgejo;
pub mod pages;
#[cfg(test)]

View file

@ -16,15 +16,20 @@
*/
use actix_web::web;
use serde::{Deserialize, Serialize};
use tokio::fs;
use tokio::sync::oneshot;
use uuid::Uuid;
use crate::ctx::Ctx;
use crate::db;
use crate::db::Site;
use crate::errors::*;
use crate::page::Page;
use crate::page_config;
use crate::settings::Settings;
use crate::subdomains::get_random_subdomain;
use crate::utils::get_random;
use crate::utils::get_website_path;
#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
/// Data required to add site
@ -38,12 +43,14 @@ impl AddSite {
fn to_site(self, s: &Settings) -> Site {
let site_secret = get_random(32);
let hostname = get_random_subdomain(s);
let pub_id = Uuid::new_v4();
Site {
site_secret,
repo_url: self.repo_url,
branch: self.branch,
hostname,
owner: self.owner,
pub_id,
}
}
}
@ -54,24 +61,60 @@ impl Ctx {
self.db.add_site(&db_site).await?;
let page = Page::from_site(&self.settings, db_site);
page.update(&page.branch)?;
self.db
.log_event(&page.domain, &db::EVENT_TYPE_CREATE)
.await?;
self.conductor.new_site(page.clone()).await?;
if let Some(config) = page_config::load(&page.path, &page.branch) {
self.conductor.tx_config(config).await?;
unimplemented!("Parse and store custom domains in DB");
}
Ok(page)
}
pub async fn update_site(&self, secret: &str, branch: Option<String>) -> ServiceResult<()> {
pub async fn update_site(&self, secret: &str, branch: Option<String>) -> ServiceResult<Uuid> {
if let Ok(db_site) = self.db.get_site_from_secret(secret).await {
let page = Page::from_site(&self.settings, db_site);
let (tx, rx) = oneshot::channel();
let page = page.clone();
web::block(move || {
if let Some(branch) = branch {
tx.send(page.update(&branch)).unwrap();
} else {
tx.send(page.update(&page.branch)).unwrap();
}
})
.await
.unwrap();
{
let page = page.clone();
web::block(move || {
if let Some(branch) = branch {
tx.send(page.update(&branch)).unwrap();
} else {
tx.send(page.update(&page.branch)).unwrap();
}
})
.await
.unwrap();
}
rx.await.unwrap()?;
if let Some(config) = page_config::load(&page.path, &page.branch) {
self.conductor.tx_config(config).await?;
unimplemented!("Parse and store custom domains in DB");
}
self.db
.log_event(&page.domain, &db::EVENT_TYPE_UPDATE)
.await
} else {
Err(ServiceError::WebsiteNotFound)
}
}
pub async fn delete_site(&self, owner: String, site_id: Uuid) -> ServiceResult<()> {
if let Ok(db_site) = self.db.get_site_from_pub_id(site_id, owner).await {
let path = get_website_path(&self.settings, &db_site.hostname);
self.db
.log_event(&db_site.hostname, &db::EVENT_TYPE_DELETE)
.await?;
fs::remove_dir_all(&path).await?;
self.db
.delete_site(&db_site.owner, &db_site.hostname)
.await?;
self.conductor.delete_site(db_site.hostname).await?;
Ok(())
} else {
Err(ServiceError::WebsiteNotFound)

View file

@ -20,17 +20,23 @@ use std::thread;
use crate::db::*;
use crate::settings::Settings;
use argon2_creds::{Config as ArgonConfig, ConfigBuilder as ArgonConfigBuilder, PasswordPolicy};
use reqwest::Client;
use tracing::info;
pub mod api;
use crate::conductor::Conductor;
pub type ArcCtx = Arc<Ctx>;
#[derive(Clone)]
pub struct Ctx {
pub settings: Settings,
pub db: Database,
pub conductor: Conductor,
/// credential-procession policy
pub creds: ArgonConfig,
client: Client,
}
impl Ctx {
@ -48,12 +54,14 @@ impl Ctx {
pub async fn new(settings: Settings) -> Arc<Self> {
let creds = Self::get_creds();
let c = creds.clone();
let client = Client::default();
let conductor = Conductor::new(settings.clone(), Some(client.clone()));
#[allow(unused_variables)]
let init = thread::spawn(move || {
log::info!("Initializing credential manager");
info!("Initializing credential manager");
c.init();
log::info!("Initialized credential manager");
info!("Initialized credential manager");
});
let db = get_db(&settings).await;
@ -62,8 +70,10 @@ impl Ctx {
Arc::new(Self {
settings,
client,
db,
creds,
conductor,
})
}
}

631
src/db.rs
View file

@ -16,15 +16,18 @@
*/
use std::str::FromStr;
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use sqlx::postgres::PgPoolOptions;
use sqlx::types::time::OffsetDateTime;
//use sqlx::types::Json;
use sqlx::ConnectOptions;
use sqlx::PgPool;
use url::quirks::hostname;
use tracing::error;
use url::Url;
use uuid::Uuid;
use crate::errors::*;
use crate::utils;
/// Connect to databse
pub enum ConnectionOptions {
@ -47,6 +50,7 @@ impl ConnectionOptions {
async fn connect(self) -> ServiceResult<Database> {
let pool = match self {
Self::Fresh(fresh) => {
tracing::info!("DATABASE URL: {}", fresh.url);
let mut connect_options =
sqlx::postgres::PgConnectOptions::from_str(&fresh.url).unwrap();
if fresh.disable_logging {
@ -81,6 +85,7 @@ impl Database {
.await
.unwrap();
//.map_err(|e| ServiceError::ServiceError(Box::new(e)))?;
self.create_event_type().await?;
Ok(())
}
@ -254,13 +259,14 @@ impl Database {
sqlx::query!(
"
INSERT INTO librepages_sites
(site_secret, repo_url, branch, hostname, owned_by)
VALUES ($1, $2, $3, $4, ( SELECT ID FROM librepages_users WHERE name = $5 ));
(site_secret, repo_url, branch, hostname, pub_id, owned_by)
VALUES ($1, $2, $3, $4, $5, ( SELECT ID FROM librepages_users WHERE name = $6 ));
",
msg.site_secret,
msg.repo_url,
msg.branch,
msg.hostname,
msg.pub_id,
msg.owner,
)
.execute(&self.pool)
@ -270,19 +276,106 @@ impl Database {
Ok(())
}
pub async fn get_site_from_repo_url(&self, repo_url: &str) -> ServiceResult<Site> {
struct S {
repo_url: String,
branch: String,
hostname: String,
owned_by: i32,
site_secret: String,
pub_id: Uuid,
}
let site = sqlx::query_as!(
S,
"SELECT repo_url, site_secret, branch, hostname, owned_by, pub_id
FROM librepages_sites
WHERE repo_url = $1
AND deleted = false;
",
repo_url,
)
.fetch_one(&self.pool)
.await
.map_err(|e| map_row_not_found_err(e, ServiceError::WebsiteNotFound))?;
struct Owner {
name: String,
}
let owner = sqlx::query_as!(
Owner,
"SELECT name FROM librepages_users WHERE ID = $1",
site.owned_by
)
.fetch_one(&self.pool)
.await
.map_err(|e| map_row_not_found_err(e, ServiceError::WebsiteNotFound))?;
let site = Site {
site_secret: site.site_secret,
branch: site.branch,
hostname: site.hostname,
owner: owner.name,
repo_url: site.repo_url,
pub_id: site.pub_id,
};
Ok(site)
}
pub async fn get_site_from_pub_id(&self, pub_id: Uuid, owner: String) -> ServiceResult<Site> {
struct S {
repo_url: String,
branch: String,
hostname: String,
owned_by: i32,
site_secret: String,
}
let site = sqlx::query_as!(
S,
"SELECT repo_url, branch, hostname, owned_by, site_secret
FROM librepages_sites
WHERE pub_id = $1
AND
owned_by = (SELECT ID from librepages_users WHERE name = $2)
AND
deleted = false;
",
&pub_id,
&owner,
)
.fetch_one(&self.pool)
.await
.map_err(|e| map_row_not_found_err(e, ServiceError::WebsiteNotFound))?;
let site = Site {
site_secret: site.site_secret,
branch: site.branch,
hostname: site.hostname,
owner,
repo_url: site.repo_url,
pub_id,
};
Ok(site)
}
pub async fn get_site_from_secret(&self, site_secret: &str) -> ServiceResult<Site> {
struct S {
repo_url: String,
branch: String,
hostname: String,
owned_by: i32,
pub_id: Uuid,
}
let site = sqlx::query_as!(
S,
"SELECT repo_url, branch, hostname, owned_by
"SELECT repo_url, branch, hostname, owned_by, pub_id
FROM librepages_sites
WHERE site_secret = $1
AND deleted = false;
",
site_secret,
)
@ -308,6 +401,7 @@ impl Database {
hostname: site.hostname,
owner: owner.name,
repo_url: site.repo_url,
pub_id: site.pub_id,
};
Ok(site)
@ -316,9 +410,10 @@ impl Database {
pub async fn get_site(&self, owner: &str, hostname: &str) -> ServiceResult<Site> {
let site = sqlx::query_as!(
InnerSite,
"SELECT site_secret, repo_url, branch, hostname
"SELECT site_secret, repo_url, branch, hostname, pub_id
FROM librepages_sites
WHERE owned_by = (SELECT ID FROM librepages_users WHERE name = $1 )
WHERE deleted = false
AND owned_by = (SELECT ID FROM librepages_users WHERE name = $1 )
AND hostname = $2;
",
owner,
@ -336,9 +431,10 @@ impl Database {
pub async fn list_all_sites(&self, owner: &str) -> ServiceResult<Vec<Site>> {
let mut sites = sqlx::query_as!(
InnerSite,
"SELECT site_secret, repo_url, branch, hostname
"SELECT site_secret, repo_url, branch, hostname, pub_id
FROM librepages_sites
WHERE owned_by = (SELECT ID FROM librepages_users WHERE name = $1 );
WHERE deleted = false
AND owned_by = (SELECT ID FROM librepages_users WHERE name = $1 );
",
owner,
)
@ -353,7 +449,7 @@ impl Database {
pub async fn delete_site(&self, owner: &str, hostname: &str) -> ServiceResult<()> {
sqlx::query!(
"DELETE FROM librepages_sites
"UPDATE librepages_sites SET deleted = true
WHERE hostname = ($1)
AND owned_by = ( SELECT ID FROM librepages_users WHERE name = $2);
",
@ -369,7 +465,7 @@ impl Database {
/// check if hostname exists
pub async fn hostname_exists(&self, hostname: &str) -> ServiceResult<bool> {
let res = sqlx::query!(
"SELECT EXISTS (SELECT 1 from librepages_sites WHERE hostname = $1)",
"SELECT EXISTS (SELECT 1 from librepages_sites WHERE hostname = $1 AND deleted = false)",
hostname,
)
.fetch_one(&self.pool)
@ -383,12 +479,350 @@ impl Database {
Ok(resp)
}
/// check if site with repository exists
pub async fn site_with_repository_exists(&self, url: &str) -> ServiceResult<bool> {
let res = sqlx::query!(
"SELECT EXISTS (SELECT 1 from librepages_sites WHERE repo_url = $1)",
url,
)
.fetch_one(&self.pool)
.await
.map_err(map_register_err)?;
let mut resp = false;
if let Some(x) = res.exists {
resp = x;
}
Ok(resp)
}
/// check if event type exists
async fn event_type_exists(&self, event: &Event) -> ServiceResult<bool> {
let res = sqlx::query!(
"SELECT EXISTS (SELECT 1 from librepages_deploy_event_type WHERE name = $1)",
event.name,
)
.fetch_one(&self.pool)
.await
.map_err(map_register_err)?;
let mut resp = false;
if let Some(x) = res.exists {
resp = x;
}
Ok(resp)
}
async fn create_event_type(&self) -> ServiceResult<()> {
for e in &*EVENTS {
if !self.event_type_exists(e).await? {
sqlx::query!(
"INSERT INTO librepages_deploy_event_type
(name) VALUES ($1) ON CONFLICT (name) DO NOTHING;",
e.name
)
.execute(&self.pool)
.await
.map_err(map_register_err)?;
}
}
Ok(())
}
pub async fn log_event(&self, hostname: &str, event: &Event) -> ServiceResult<Uuid> {
let now = now_unix_time_stamp();
let uuid = Uuid::new_v4();
sqlx::query!(
"INSERT INTO librepages_site_deploy_events
(event_type, time, site, pub_id) VALUES (
(SELECT iD from librepages_deploy_event_type WHERE name = $1),
$2,
(SELECT ID from librepages_sites WHERE hostname = $3),
$4
);
",
event.name,
&now,
hostname,
uuid,
)
.execute(&self.pool)
.await
.map_err(map_register_err)?;
Ok(uuid)
}
pub async fn get_event(
&self,
hostname: &str,
event_id: &Uuid,
) -> ServiceResult<LibrePagesEvent> {
let event = sqlx::query_as!(
InnerLibrepagesEvent,
"SELECT
librepages_deploy_event_type.name,
librepages_site_deploy_events.time,
librepages_site_deploy_events.pub_id
FROM
librepages_site_deploy_events
INNER JOIN librepages_deploy_event_type ON
librepages_deploy_event_type.ID = librepages_site_deploy_events.event_type
WHERE
librepages_site_deploy_events.site = (
SELECT ID FROM librepages_sites WHERE hostname = $1
)
AND
librepages_site_deploy_events.pub_id = $2
",
hostname,
event_id,
)
.fetch_one(&self.pool)
.await
.map_err(|e| map_row_not_found_err(e, ServiceError::AccountNotFound))?;
Ok(LibrePagesEvent {
id: event.pub_id,
time: event.time,
event_type: Event::from_str(&event.name).unwrap(),
site: hostname.to_owned(),
})
}
pub async fn get_latest_update_event(
&self,
hostname: &str,
) -> ServiceResult<Option<LibrePagesEvent>> {
self.get_latest_event_of_type(hostname, &EVENT_TYPE_UPDATE)
.await
}
async fn get_latest_event_of_type(
&self,
hostname: &str,
event_type: &Event,
) -> ServiceResult<Option<LibrePagesEvent>> {
struct InnerLibrepagesEventNameless {
time: OffsetDateTime,
pub_id: Uuid,
}
let event = sqlx::query_as!(
InnerLibrepagesEventNameless,
"SELECT
time,
pub_id
FROM
librepages_site_deploy_events
WHERE
site = (SELECT ID FROM librepages_sites WHERE hostname = $1)
AND
event_type = (SELECT ID FROM librepages_deploy_event_type WHERE name = $2)
AND
time = (
SELECT MAX(time)
FROM
librepages_site_deploy_events
WHERE
site = (SELECT ID FROM librepages_sites WHERE hostname = $1)
)
",
hostname,
event_type.name
)
.fetch_one(&self.pool)
.await;
match event {
Ok(event) => Ok(Some(LibrePagesEvent {
id: event.pub_id,
time: event.time,
event_type: event_type.clone(),
site: hostname.to_owned(),
})),
Err(sqlx::Error::RowNotFound) => Ok(None),
Err(e) => Err(map_register_err(e)),
}
// map_row_not_found_err(e, ServiceError::AccountNotFound))?;
}
pub async fn list_all_site_events(
&self,
hostname: &str,
) -> ServiceResult<Vec<LibrePagesEvent>> {
let mut inner_events = sqlx::query_as!(
InnerLibrepagesEvent,
"SELECT
librepages_deploy_event_type.name,
librepages_site_deploy_events.time,
librepages_site_deploy_events.pub_id
FROM
librepages_site_deploy_events
INNER JOIN librepages_deploy_event_type ON
librepages_deploy_event_type.ID = librepages_site_deploy_events.event_type
WHERE
librepages_site_deploy_events.site = (
SELECT ID FROM librepages_sites WHERE hostname = $1
);
",
hostname,
)
.fetch_all(&self.pool)
.await
.map_err(|e| map_row_not_found_err(e, ServiceError::AccountNotFound))?;
let mut events = Vec::with_capacity(inner_events.len());
for e in inner_events.drain(0..) {
events.push(LibrePagesEvent {
id: e.pub_id,
time: e.time,
event_type: Event::from_str(&e.name).unwrap(),
site: hostname.to_owned(),
})
}
Ok(events)
}
/// register a new webhook
pub async fn new_webhook(
&self,
forgejo_url: Url,
owner: &str,
) -> ServiceResult<ForgejoWebhook> {
let hook = ForgejoWebhook::new(forgejo_url);
sqlx::query!(
"INSERT INTO librepages_forgejo_webhooks
(forgejo_url , auth_token, forgejo_webhook_secret, owned_by) VALUES ($1, $2, $3,
(SELECT ID FROM librepages_users WHERE name = $4)
)",
hook.forgejo_url.as_str(),
&hook.auth_token,
&hook.forgejo_webhook_secret,
owner,
)
.execute(&self.pool)
.await
.map_err(|e| map_row_not_found_err(e, ServiceError::AccountNotFound))?;
Ok(hook)
}
pub async fn list_all_webhooks_with_owner(
&self,
owner: &str,
) -> ServiceResult<Vec<ForgejoWebhook>> {
let mut db_hooks = sqlx::query_as!(
InnerForgejoWebhook,
"SELECT
forgejo_url, auth_token, forgejo_webhook_secret
FROM
librepages_forgejo_webhooks
WHERE
owned_by = (SELECT ID FROM librepages_users WHERE name = $1);
",
owner
)
.fetch_all(&self.pool)
.await
.map_err(|e| map_row_not_found_err(e, ServiceError::WebhookNotFound))?;
let mut hooks = Vec::with_capacity(db_hooks.len());
for hook in db_hooks.drain(0..) {
hooks.push(hook.to_webhook()?)
}
Ok(hooks)
}
pub async fn get_webhook_with_owner(
&self,
auth_token: &str,
owner: &str,
) -> ServiceResult<ForgejoWebhook> {
let h = sqlx::query_as!(
InnerForgejoWebhook,
"SELECT
forgejo_url, auth_token, forgejo_webhook_secret
FROM
librepages_forgejo_webhooks
WHERE
auth_token = $1
AND
owned_by = (SELECT ID FROM librepages_users WHERE name = $2);
",
auth_token,
owner
)
.fetch_one(&self.pool)
.await
.map_err(|e| map_row_not_found_err(e, ServiceError::WebhookNotFound))?;
h.to_webhook()
}
pub async fn get_webhook(&self, auth_token: &str) -> ServiceResult<ForgejoWebhook> {
let h = sqlx::query_as!(
InnerForgejoWebhook,
"SELECT forgejo_url, auth_token, forgejo_webhook_secret
FROM librepages_forgejo_webhooks
WHERE auth_token = $1
",
auth_token,
)
.fetch_one(&self.pool)
.await
.map_err(|e| map_row_not_found_err(e, ServiceError::WebhookNotFound))?;
h.to_webhook()
}
/// register a webhook against a site
pub async fn webhook_link_site(&self, auth_token: &str, repo_url: &Url) -> ServiceResult<()> {
struct Site {
id: i32,
}
let sites = sqlx::query_as!(
Site,
"SELECT ID FROM librepages_sites WHERE repo_url = $1",
repo_url.as_str()
)
.fetch_all(&self.pool)
.await
.map_err(|e| map_row_not_found_err(e, ServiceError::WebsiteNotFound))?;
for site in sites {
sqlx::query!(
"INSERT INTO librepages_forgejo_webhook_site_mapping
(site_id, forgejo_webhook_id) VALUES (
(SELECT ID FROM librepages_sites WHERE repo_url = $1 AND ID = $2),
(SELECT ID FROM librepages_forgejo_webhooks WHERE auth_token = $3)
) ON CONFLICT (site_id, forgejo_webhook_id) DO NOTHING;",
repo_url.as_str(),
site.id,
auth_token
)
.execute(&self.pool)
.await
//.unwrap();
.map_err(|e| map_row_not_found_err(e, ServiceError::WebhookNotFound))?;
}
Ok(())
}
}
struct InnerSite {
site_secret: String,
repo_url: String,
branch: String,
hostname: String,
pub_id: Uuid,
}
impl InnerSite {
@ -398,6 +832,7 @@ impl InnerSite {
repo_url: self.repo_url,
branch: self.branch,
hostname: self.hostname,
pub_id: self.pub_id,
owner,
}
}
@ -408,6 +843,7 @@ impl InnerSite {
pub struct Site {
pub site_secret: String,
pub repo_url: String,
pub pub_id: Uuid,
pub branch: String,
pub hostname: String,
pub owner: String,
@ -451,6 +887,78 @@ pub struct NameHash {
pub hash: String,
}
#[derive(Deserialize, Serialize, Clone, Debug, Eq, PartialEq)]
pub struct Event {
pub name: String,
}
impl Event {
fn new(name: String) -> Self {
Self { name }
}
pub fn from_str(name: &str) -> Option<Event> {
(*EVENTS).into_iter().find(|e| e.name == name).cloned()
}
}
lazy_static! {
pub static ref EVENT_TYPE_CREATE: Event = Event::new("site.event.create".into());
pub static ref EVENT_TYPE_UPDATE: Event = Event::new("site.event.update".into());
pub static ref EVENT_TYPE_DELETE: Event = Event::new("site.event.delete".into());
pub static ref EVENTS: [&'static Event; 3] = [
&*EVENT_TYPE_CREATE,
&*EVENT_TYPE_DELETE,
&*EVENT_TYPE_UPDATE
];
}
struct InnerLibrepagesEvent {
name: String,
time: OffsetDateTime,
pub_id: Uuid,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct LibrePagesEvent {
pub event_type: Event,
pub time: OffsetDateTime,
pub site: String,
pub id: Uuid,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct ForgejoWebhook {
pub forgejo_url: Url,
pub forgejo_webhook_secret: String,
pub auth_token: String,
}
impl ForgejoWebhook {
fn new(forgejo_url: Url) -> Self {
Self {
forgejo_url,
forgejo_webhook_secret: utils::get_random(40),
auth_token: utils::get_random(40),
}
}
}
struct InnerForgejoWebhook {
forgejo_url: String,
auth_token: String,
forgejo_webhook_secret: String,
}
impl InnerForgejoWebhook {
fn to_webhook(self) -> ServiceResult<ForgejoWebhook> {
Ok(ForgejoWebhook {
forgejo_url: Url::parse(&self.forgejo_url)?,
auth_token: self.auth_token,
forgejo_webhook_secret: self.forgejo_webhook_secret,
})
}
}
fn now_unix_time_stamp() -> OffsetDateTime {
OffsetDateTime::now_utc()
}
@ -490,7 +998,7 @@ fn map_register_err(e: sqlx::Error) -> ServiceError {
} else if msg.contains("librepages_users_email_key") {
ServiceError::EmailTaken
} else {
log::error!("{}", msg);
error!("{}", msg);
ServiceError::InternalServerError
}
} else {
@ -503,9 +1011,17 @@ fn map_register_err(e: sqlx::Error) -> ServiceError {
#[cfg(test)]
mod tests {
use std::collections::HashSet;
use super::*;
use crate::settings::Settings;
#[test]
fn event_names_are_unique() {
let mut uniq = HashSet::new();
assert!(EVENTS.into_iter().all(move |x| uniq.insert(x.name.clone())));
}
#[actix_rt::test]
async fn db_works() {
let settings = Settings::new().unwrap();
@ -637,6 +1153,13 @@ mod tests {
const PASSWORD: &str = "pasdfasdfasdfadf";
db.migrate().await.unwrap();
// check if events are created
for e in &*EVENTS {
println!("Testing event type exists {}", e.name);
assert!(db.event_type_exists(e).await.unwrap());
}
let p = super::Register {
username: NAME,
email: EMAIL,
@ -655,20 +1178,29 @@ mod tests {
let site = Site {
site_secret: "foobar".into(),
repo_url: "https://git.batsense.net/LibrePages/librepages.git".into(),
repo_url: "https://git.test_db_sites.example.org/LibrePages/librepages.git".into(),
branch: "librepages".into(),
hostname: "db_works.tests.librepages.librepages.org".into(),
pub_id: Uuid::new_v4(),
owner: p.username.into(),
};
// test if hostname exists. Should be false
assert!(!db.hostname_exists(&site.hostname).await.unwrap());
assert!(!db
.site_with_repository_exists(&site.repo_url)
.await
.unwrap());
// testing adding site
db.add_site(&site).await.unwrap();
// test if hostname exists. Should be true
assert!(db.hostname_exists(&site.hostname).await.unwrap());
assert!(db
.site_with_repository_exists(&site.repo_url)
.await
.unwrap());
// get site
let db_site = db.get_site(p.username, &site.hostname).await.unwrap();
@ -680,11 +1212,84 @@ mod tests {
db.get_site_from_secret(&site.site_secret).await.unwrap()
);
// get site by repo_url
assert_eq!(
db_site,
db.get_site_from_repo_url(&site.repo_url).await.unwrap()
);
// list all sites owned by user
let db_sites = db.list_all_sites(p.username).await.unwrap();
assert_eq!(db_sites.len(), 1);
assert_eq!(db_sites, vec![site.clone()]);
// add event to site
let event_id = db
.log_event(&site.hostname, &EVENT_TYPE_CREATE)
.await
.unwrap();
let event = db.get_event(&site.hostname, &event_id).await.unwrap();
assert_eq!(event.id, event_id);
assert_eq!(event.event_type, *EVENT_TYPE_CREATE);
assert_eq!(event.site, site.hostname);
assert_eq!(
db.list_all_site_events(&site.hostname).await.unwrap(),
vec![event]
);
// when no update event exist, None is returned
assert!(db
.get_latest_update_event(&site.hostname)
.await
.unwrap()
.is_none());
// add multiple update events, see if latest is returned
db.log_event(&site.hostname, &EVENT_TYPE_UPDATE)
.await
.unwrap();
let latest_update_event_id = db
.log_event(&site.hostname, &EVENT_TYPE_UPDATE)
.await
.unwrap();
let latest_update_event_id_from_db = db
.get_latest_update_event(&site.hostname)
.await
.unwrap()
.unwrap();
assert_eq!(
latest_update_event_id_from_db.event_type,
*EVENT_TYPE_UPDATE
);
assert_eq!(latest_update_event_id_from_db.id, latest_update_event_id);
// add webhook
let forgejo_url = Url::parse("https://example.org").unwrap();
let hook = db.new_webhook(forgejo_url, NAME).await.unwrap();
assert_eq!(hook, db.get_webhook(&hook.auth_token).await.unwrap());
assert_eq!(
vec![hook.clone()],
db.list_all_webhooks_with_owner(NAME).await.unwrap()
);
assert_eq!(
hook,
db.get_webhook_with_owner(&hook.auth_token, NAME)
.await
.unwrap()
);
assert_eq!(
db.get_webhook(&hook.forgejo_webhook_secret).await.err(),
Some(ServiceError::WebhookNotFound)
);
db.webhook_link_site(&hook.auth_token, &Url::parse(&site.repo_url).unwrap())
.await
.unwrap();
db.webhook_link_site(&hook.auth_token, &Url::parse(&site.repo_url).unwrap())
.await
.unwrap();
// delete site
db.delete_site(p.username, &site.hostname).await.unwrap();

View file

@ -28,6 +28,8 @@ use argon2_creds::errors::CredsError;
use config::ConfigError as ConfigErrorInner;
use derive_more::{Display, Error};
use git2::Error as GitError;
use hmac::digest::InvalidLength;
use hmac::digest::MacError;
use serde::{Deserialize, Serialize};
use url::ParseError;
@ -86,6 +88,10 @@ pub enum ServiceError {
/// website not found
WebsiteNotFound,
#[display(fmt = "File not found")]
/// File not found
FileNotFound,
/// when the a path configured for a page is already taken
#[display(
fmt = "Path already used for another website. lhs: {:?} rhs: {:?}",
@ -174,6 +180,24 @@ pub enum ServiceError {
#[display(fmt = "Passwords don't match")]
/// passwords don't match
PasswordsDontMatch,
/// Webhook not found
#[display(fmt = "Webhook not found")]
WebhookNotFound,
}
impl From<InvalidLength> for ServiceError {
#[cfg(not(tarpaulin_include))]
fn from(_: InvalidLength) -> ServiceError {
ServiceError::InternalServerError
}
}
impl From<MacError> for ServiceError {
#[cfg(not(tarpaulin_include))]
fn from(_: MacError) -> ServiceError {
ServiceError::WebhookNotFound
}
}
impl From<ParseError> for ServiceError {
@ -236,6 +260,7 @@ impl ResponseError for ServiceError {
ServiceError::EmailTaken => StatusCode::BAD_REQUEST,
ServiceError::UsernameTaken => StatusCode::BAD_REQUEST,
ServiceError::AccountNotFound => StatusCode::NOT_FOUND,
ServiceError::FileNotFound => StatusCode::NOT_FOUND,
ServiceError::ProfanityError => StatusCode::BAD_REQUEST, //BADREQUEST,
ServiceError::BlacklistError => StatusCode::BAD_REQUEST, //BADREQUEST,
@ -247,6 +272,7 @@ impl ResponseError for ServiceError {
ServiceError::ClosedForRegistration => StatusCode::FORBIDDEN, //FORBIDDEN,
ServiceError::NotAnEmail => StatusCode::BAD_REQUEST, //BADREQUEST,
ServiceError::WrongPassword => StatusCode::UNAUTHORIZED, //UNAUTHORIZED,
ServiceError::WebhookNotFound => StatusCode::NOT_FOUND, //NOT FOUND,
}
}
}

View file

@ -173,8 +173,6 @@ fn read_file_inner(
}
let inner = |repo: &git2::Repository, tree: &git2::Tree| -> ServiceResult<FileInfo> {
// let head = repo.head().unwrap();
// let tree = head.peel_to_tree().unwrap();
let mut path = path;
if path == "/" {
let content = get_index_file(tree.id(), repo);
@ -187,8 +185,14 @@ fn read_file_inner(
if path.starts_with('/') {
path = path.trim_start_matches('/');
}
let entry = tree.get_path(Path::new(path)).unwrap();
//FileType::Dir(items)
fn file_not_found(e: git2::Error) -> ServiceError {
if e.code() == ErrorCode::NotFound && e.class() == ErrorClass::Tree {
return ServiceError::FileNotFound;
}
e.into()
}
let entry = tree.get_path(Path::new(path)).map_err(file_not_found)?;
let mode: GitFileMode = entry.clone().into();
if let Some(name) = entry.name() {
@ -212,17 +216,17 @@ fn read_file_inner(
}
};
//let repo = git2::Repository::open(repo_path).unwrap();
inner(repo, tree)
}
#[cfg(test)]
pub mod tests {
use super::*;
use mktemp::Temp;
const FILE_CONTENT: &str = "foobar";
fn write_file_util(path: &str) {
pub fn write_file_util(repo_path: &str, file_name: &str, content: Option<&str>) {
// TODO change updated in DB
let inner = |repo: &mut Repository| -> ServiceResult<()> {
let mut tree_builder = match repo.head() {
@ -233,10 +237,14 @@ pub mod tests {
let odb = repo.odb().unwrap();
let obj = odb
.write(ObjectType::Blob, FILE_CONTENT.as_bytes())
.unwrap();
tree_builder.insert("README.txt", obj, 0o100644).unwrap();
let content = if content.is_some() {
content.as_ref().unwrap()
} else {
FILE_CONTENT
};
let obj = odb.write(ObjectType::Blob, content.as_bytes()).unwrap();
tree_builder.insert(file_name, obj, 0o100644).unwrap();
let tree_hash = tree_builder.write().unwrap();
let author = Signature::now("librepages", "admin@librepages.org").unwrap();
let committer = Signature::now("librepages", "admin@librepages.org").unwrap();
@ -268,26 +276,34 @@ pub mod tests {
Ok(())
};
if Repository::open(path).is_err() {
let _ = Repository::init(path);
if Repository::open(repo_path).is_err() {
let _ = Repository::init(repo_path);
}
let mut repo = Repository::open(path).unwrap();
let mut repo = Repository::open(repo_path).unwrap();
let _ = inner(&mut repo);
}
#[test]
fn test_git_write_read_works() {
const PATH: &str = "/tmp/librepges/test_git_write_read_works";
const FILENAME: &str = "README.txt";
write_file_util(PATH);
let resp = read_file(&Path::new(PATH).into(), "README.txt").unwrap();
assert_eq!(resp.filename, "README.txt");
let tmp_dir = Temp::new_dir().unwrap();
let path = tmp_dir.to_str().unwrap();
write_file_util(path, FILENAME, None);
let resp = read_file(&Path::new(path).into(), FILENAME).unwrap();
assert_eq!(resp.filename, FILENAME);
assert_eq!(resp.content.bytes(), FILE_CONTENT.as_bytes());
assert_eq!(resp.mime.first().unwrap(), "text/plain");
let resp = read_preview_file(&Path::new(PATH).into(), "master", "README.txt").unwrap();
assert_eq!(resp.filename, "README.txt");
let resp = read_preview_file(&Path::new(path).into(), "master", FILENAME).unwrap();
assert_eq!(resp.filename, FILENAME);
assert_eq!(resp.content.bytes(), FILE_CONTENT.as_bytes());
assert_eq!(resp.mime.first().unwrap(), "text/plain");
assert_eq!(
read_preview_file(&Path::new(path).into(), "master", "file-does-not-exist.txt"),
Err(ServiceError::FileNotFound)
);
}
}

View file

@ -22,17 +22,18 @@ use actix_web::{
web::JsonConfig, App, HttpServer,
};
use clap::{Parser, Subcommand};
use log::info;
use static_assets::FileMap;
use tracing::info;
use tracing_actix_web::TracingLogger;
mod api;
mod conductor;
mod ctx;
mod db;
mod deploy;
mod errors;
mod git;
mod meta;
mod page;
mod page_config;
mod pages;
mod preview;
mod serve;
@ -80,10 +81,11 @@ enum Commands {
#[actix_web::main]
#[cfg(not(tarpaulin_include))]
async fn main() -> std::io::Result<()> {
env::set_var("RUST_LOG", "info");
if env::var("RUST_LOG").is_err() {
env::set_var("RUST_LOG", "info");
}
pretty_env_logger::init();
let cli = Cli::parse();
info!(
@ -107,14 +109,16 @@ async fn main() -> std::io::Result<()> {
async fn serve(settings: Settings, ctx: AppCtx) -> std::io::Result<()> {
let ip = settings.server.get_ip();
let workers = settings.server.workers.unwrap_or_else(num_cpus::get);
info!("Starting server on: http://{}", ip);
HttpServer::new(move || {
App::new()
.wrap(actix_middleware::Logger::default())
.wrap(TracingLogger::default())
.wrap(actix_middleware::Compress::default())
.app_data(ctx.clone())
.app_data(get_json_err())
.wrap(get_identity_service(&(settings.clone())))
.wrap(
actix_middleware::DefaultHeaders::new()
.add(("Permissions-Policy", "interest-cohort=()")),
@ -124,7 +128,7 @@ async fn serve(settings: Settings, ctx: AppCtx) -> std::io::Result<()> {
))
.configure(services)
})
.workers(settings.server.workers.unwrap_or_else(num_cpus::get))
.workers(workers)
.bind(ip)
.unwrap()
.run()

View file

@ -14,16 +14,19 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use git2::{build::CheckoutBuilder, BranchType, Direction, Oid, Remote, Repository};
#[cfg(not(test))]
use log::info;
#[cfg(test)]
use std::println as info;
#[cfg(test)]
use std::println as error;
#[cfg(test)]
use std::println as debug;
use git2::{build::CheckoutBuilder, BranchType, Direction, Oid, Remote, Repository};
use serde::Deserialize;
use serde::Serialize;
#[cfg(not(test))]
use tracing::{debug, error, info};
use uuid::Uuid;
use crate::db::Site;
use crate::errors::*;
@ -37,6 +40,7 @@ pub struct Page {
pub path: String,
pub branch: String,
pub domain: String,
pub pub_id: Uuid,
}
impl Page {
@ -50,6 +54,7 @@ impl Page {
.to_owned(),
domain: s.hostname,
branch: s.branch,
pub_id: s.pub_id,
}
}
pub fn open_repo(&self) -> ServiceResult<Repository> {
@ -95,7 +100,7 @@ impl Page {
branch: &str,
) -> ServiceResult<git2::AnnotatedCommit<'a>> {
let mut remote = repo.find_remote("origin")?;
log::info!("Fetching {} for repo", remote.name().unwrap());
info!("Fetching {} for repo", remote.name().unwrap());
remote.fetch(&[branch], None, None)?;
let fetch_head = repo.find_reference("FETCH_HEAD")?;
Ok(repo.reference_to_annotated_commit(&fetch_head)?)
@ -112,20 +117,19 @@ impl Page {
// 2. Do the appropriate merge
if analysis.0.is_fast_forward() {
//log::debug!("Doing a fast forward");
log::debug!("Doing a fast forward");
debug!("Doing a fast forward");
// do a fast forward
let refname = format!("refs/heads/{}", branch);
match repo.find_reference(&refname) {
Ok(mut r) => {
log::debug!("fast forwarding");
debug!("fast forwarding");
Self::fast_forward(repo, &mut r, &fetch_commit).unwrap();
}
Err(_) => {
// The branch doesn't exist so just set the reference to the
// commit directly. Usually this is because you are pulling
// into an empty repository.
log::error!("Error in find ref");
error!("Error in find ref");
repo.reference(
&refname,
fetch_commit.id(),
@ -151,7 +155,7 @@ impl Page {
.unwrap();
Self::normal_merge(repo, &head_commit, &fetch_commit).unwrap();
} else {
log::info!("Nothing to do...");
info!("Nothing to do...");
}
Ok(())
}
@ -178,7 +182,7 @@ impl Page {
) -> Result<(), git2::Error> {
let local_tree = repo.find_commit(local.id())?.tree().unwrap();
let remote_tree = repo.find_commit(remote.id())?.tree().unwrap();
println!("{} {}", local.id(), remote.id());
debug!("{} {}", local.id(), remote.id());
let ancestor = repo
.find_commit(repo.merge_base(local.id(), remote.id()).unwrap())
.unwrap()
@ -189,7 +193,7 @@ impl Page {
.unwrap();
if idx.has_conflicts() {
log::debug!("Merge conflicts detected...");
debug!("Merge conflicts detected...");
repo.checkout_index(Some(&mut idx), None)?;
return Ok(());
}
@ -223,7 +227,7 @@ impl Page {
None => String::from_utf8_lossy(lb.name_bytes()).to_string(),
};
let msg = format!("Fast-Forward: Setting {} to id: {}", name, rc.id());
log::debug!("{}", msg);
debug!("{}", msg);
lb.set_target(rc.id(), &msg)?;
repo.set_head(&name)?;
repo.checkout_head(Some(git2::build::CheckoutBuilder::default().force()))?;
@ -264,16 +268,19 @@ mod tests {
use git2::Repository;
use mktemp::Temp;
use crate::tests;
#[actix_rt::test]
async fn pages_works() {
let tmp_dir = Temp::new_dir().unwrap();
assert!(tmp_dir.exists(), "tmp directory successully created");
let mut page = Page {
secret: String::default(),
repo: "https://github.com/mcaptcha/website".to_owned(),
repo: tests::REPO_URL.into(),
path: tmp_dir.to_str().unwrap().to_string(),
branch: "gh-pages".to_string(),
branch: tests::BRANCH.to_string(),
domain: "mcaptcha.org".into(),
pub_id: Uuid::new_v4(),
};
assert!(

165
src/page_config.rs Normal file
View file

@ -0,0 +1,165 @@
/*
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use std::path::Path;
use libconfig::Config;
use serde::{Deserialize, Serialize};
use crate::git::{ContentType, GitFileMode};
#[derive(Deserialize, Debug, Serialize, PartialEq, Eq)]
struct Policy<'a> {
rel_path: &'a str,
format: SupportedFormat,
}
impl<'a> Policy<'a> {
const fn new(rel_path: &'a str, format: SupportedFormat) -> Self {
Self { rel_path, format }
}
}
#[derive(Deserialize, Debug, Serialize, PartialEq, Eq)]
enum SupportedFormat {
Json,
Yaml,
Toml,
}
pub fn load<P: AsRef<Path>>(repo_path: &P, branch: &str) -> Option<Config> {
const POLICIES: [Policy; 2] = [
Policy::new("librepages.toml", SupportedFormat::Toml),
Policy::new("librepages.json", SupportedFormat::Json),
];
if let Some(policy) = discover(repo_path, branch, &POLICIES) {
// let path = p.repo.as_ref().join(policy.rel_path);
//let contents = fs::read_to_string(path).await.unwrap();
let file =
crate::git::read_preview_file(&repo_path.as_ref().into(), branch, policy.rel_path)
.unwrap();
if let ContentType::Text(contents) = file.content {
let res = match policy.format {
SupportedFormat::Json => load_json(&contents),
SupportedFormat::Yaml => load_yaml(&contents),
SupportedFormat::Toml => load_toml(&contents),
};
return Some(res);
};
}
None
}
fn discover<'a, P: AsRef<Path>>(
repo_path: &P,
branch: &str,
policies: &'a [Policy<'a>],
) -> Option<&'a Policy<'a>> {
let repo = git2::Repository::open(repo_path).unwrap();
let branch = repo.find_branch(branch, git2::BranchType::Local).unwrap();
// let tree = head.peel_to_tree().unwrap();
let branch = branch.into_reference();
let tree = branch.peel_to_tree().unwrap();
for p in policies.iter() {
let file_exists = tree.iter().any(|x| {
if let Some(name) = x.name() {
if policies.iter().any(|p| p.rel_path == name) {
let mode: GitFileMode = x.into();
matches!(mode, GitFileMode::Executable | GitFileMode::Regular)
} else {
false
}
} else {
false
}
});
if file_exists {
return Some(p);
}
}
None
}
fn load_toml(c: &str) -> Config {
toml::from_str(c).unwrap()
}
fn load_yaml(c: &str) -> Config {
serde_yaml::from_str(c).unwrap()
}
fn load_json(c: &str) -> Config {
serde_json::from_str(c).unwrap()
}
#[cfg(test)]
mod tests {
use super::*;
use crate::git::tests::write_file_util;
use mktemp::Temp;
use libconfig::*;
#[actix_rt::test]
async fn page_config_test() {
let tmp_dir = Temp::new_dir().unwrap();
let repo_path = tmp_dir.join("page_config_test");
let content = std::fs::read_to_string(
&Path::new("./tests/cases/contains-everything/toml/librepages.toml")
.canonicalize()
.unwrap(),
)
.unwrap();
write_file_util(
repo_path.to_str().unwrap(),
"librepages.toml",
Some(&content),
);
let config = load(&repo_path, "master").unwrap();
assert!(config.forms.as_ref().unwrap().enable);
assert!(config.image_compression.as_ref().unwrap().enable);
assert_eq!(config.source.production_branch, "librepages");
assert_eq!(config.source.staging.as_ref().unwrap(), "beta");
assert_eq!(
config.redirects.as_ref().unwrap(),
&vec![
Redirects {
from: "/from1".into(),
to: "/to1".into()
},
Redirects {
from: "/from2".into(),
to: "/to2".into()
},
]
);
assert_eq!(
config.domains.as_ref().unwrap(),
&vec!["example.org".to_string(), "example.com".to_string(),]
);
}
}

View file

@ -61,6 +61,7 @@ impl Login {
}
#[actix_web_codegen_const_routes::get(path = "PAGES.auth.login")]
#[tracing::instrument(name = "Serve login page", skip(ctx))]
pub async fn get_login(ctx: AppCtx) -> impl Responder {
let login = Login::page(&ctx.settings);
let html = ContentType::html();
@ -73,6 +74,7 @@ pub fn services(cfg: &mut web::ServiceConfig) {
}
#[actix_web_codegen_const_routes::post(path = "PAGES.auth.login")]
#[tracing::instrument(name = "Web UI Login", skip(id, payload, query, ctx))]
pub async fn login_submit(
id: Identity,
payload: web::Form<LoginPayload>,
@ -91,7 +93,7 @@ pub async fn login_submit(
.finish())
} else {
Ok(HttpResponse::Found()
.insert_header((http::header::LOCATION, PAGES.home))
.insert_header((http::header::LOCATION, PAGES.dash.home))
.finish())
}
}

View file

@ -42,13 +42,13 @@ pub fn services(cfg: &mut web::ServiceConfig) {
path = "PAGES.auth.logout",
wrap = "super::get_auth_middleware()"
)]
#[tracing::instrument(name = "Sign out", skip(id))]
async fn signout(id: Identity) -> impl Responder {
use actix_auth_middleware::GetLoginRoute;
if id.identity().is_some() {
id.forget();
}
println!("received signout");
HttpResponse::Found()
.append_header((http::header::LOCATION, PAGES.get_login_route(None)))
.finish()

View file

@ -58,6 +58,7 @@ impl Register {
}
#[actix_web_codegen_const_routes::get(path = "PAGES.auth.register")]
#[tracing::instrument(name = "Serve registration page", skip(ctx))]
pub async fn get_register(ctx: AppCtx) -> impl Responder {
let login = Register::page(&ctx.settings);
let html = ContentType::html();
@ -70,6 +71,7 @@ pub fn services(cfg: &mut web::ServiceConfig) {
}
#[actix_web_codegen_const_routes::post(path = "PAGES.auth.register")]
#[tracing::instrument(name = "Process web UI registration", skip(ctx))]
pub async fn register_submit(
payload: web::Form<RegisterPayload>,
ctx: AppCtx,

View file

@ -71,7 +71,7 @@ async fn auth_works(ctx: ArcCtx) {
.await;
assert_eq!(resp.status(), StatusCode::FOUND);
let headers = resp.headers();
assert_eq!(headers.get(header::LOCATION).unwrap(), PAGES.home);
assert_eq!(headers.get(header::LOCATION).unwrap(), PAGES.dash.home);
let cookies = get_cookie!(resp);
// redirect after signin

View file

@ -0,0 +1,193 @@
/*
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use std::cell::RefCell;
use actix_identity::Identity;
use actix_web::http::header::ContentType;
use tera::Context;
use tracing::info;
use super::get_auth_middleware;
use crate::api::v1::forgejo::AddWebhook;
use crate::pages::errors::*;
use crate::settings::Settings;
use crate::AppCtx;
pub use super::*;
pub const DASH_FORGEJO_WEBHOOK_ADD: TemplateFile =
TemplateFile::new("dash_forgejo_webhook_add", "pages/dash/forgejo/add.html");
pub struct Add {
ctx: RefCell<Context>,
}
impl CtxError for Add {
fn with_error(&self, e: &ReadableError) -> String {
self.ctx.borrow_mut().insert(ERROR_KEY, e);
self.render()
}
}
impl Add {
pub fn new(settings: &Settings) -> Self {
let ctx = RefCell::new(context(settings));
Self { ctx }
}
pub fn render(&self) -> String {
TEMPLATES
.render(DASH_FORGEJO_WEBHOOK_ADD.name, &self.ctx.borrow())
.unwrap()
}
}
#[actix_web_codegen_const_routes::get(
path = "PAGES.dash.forgejo_webhook.add",
wrap = "get_auth_middleware()"
)]
#[tracing::instrument(name = "Dashboard add forgejo webhook webpage", skip(ctx))]
pub async fn get_add_forgejo_webhook(ctx: AppCtx) -> PageResult<impl Responder, Add> {
let add = Add::new(&ctx.settings).render();
let html = ContentType::html();
Ok(HttpResponse::Ok().content_type(html).body(add))
}
#[actix_web_codegen_const_routes::post(
path = "PAGES.dash.forgejo_webhook.add",
wrap = "get_auth_middleware()"
)]
#[tracing::instrument(
name = "Post Dashboard add Forgejo webhook webpage",
skip(ctx, id, payload)
)]
pub async fn post_add_forgejo_webhook(
ctx: AppCtx,
id: Identity,
payload: web::Form<AddWebhook>,
) -> PageResult<impl Responder, Add> {
let owner = id.identity().unwrap();
let payload = payload.into_inner();
info!(
"Adding webhook for Forgejo instance: {}",
payload.forgejo_url.as_str()
);
let hook = ctx
.db
.new_webhook(payload.forgejo_url, &owner)
.await
.map_err(|e| PageError::new(Add::new(&ctx.settings), e))?;
Ok(HttpResponse::Found()
.append_header((
http::header::LOCATION,
PAGES.dash.forgejo_webhook.get_view(&hook.auth_token),
))
.finish())
}
pub fn services(cfg: &mut web::ServiceConfig) {
cfg.service(get_add_forgejo_webhook);
cfg.service(post_add_forgejo_webhook);
}
#[cfg(test)]
mod tests {
use actix_web::http::StatusCode;
use actix_web::test;
use url::Url;
use crate::api::v1::forgejo::AddWebhook;
use crate::ctx::ArcCtx;
use crate::tests;
use crate::*;
use super::PAGES;
#[actix_rt::test]
async fn postgres_dashboadr_add_forgejo_webhook_works() {
let (_, ctx) = tests::get_ctx().await;
dashboadr_add_forgejo_webhook_works(ctx.clone()).await;
}
async fn dashboadr_add_forgejo_webhook_works(ctx: ArcCtx) {
const NAME: &str = "testdashwebhookforgejoadduser";
const EMAIL: &str = "testdashwebhookforgejoadduser@foo.com";
const PASSWORD: &str = "longpassword";
let _ = ctx.delete_user(NAME, PASSWORD).await;
let (_, signin_resp) = ctx.register_and_signin(NAME, EMAIL, PASSWORD).await;
let cookies = get_cookie!(signin_resp);
let app = get_app!(ctx.clone()).await;
let resp = get_request!(&app, PAGES.dash.forgejo_webhook.add, cookies.clone());
assert_eq!(resp.status(), StatusCode::OK);
let res = String::from_utf8(test::read_body(resp).await.to_vec()).unwrap();
assert!(res.contains("Add Forgejo Webhook"));
let payload = AddWebhook {
forgejo_url: Url::parse("https://git.batsense.net").unwrap(),
};
let add_webhook = test::call_service(
&app,
post_request!(&payload, PAGES.dash.forgejo_webhook.add, FORM)
.cookie(cookies.clone())
.to_request(),
)
.await;
assert_eq!(add_webhook.status(), StatusCode::FOUND);
let mut hooks = ctx.db.list_all_webhooks_with_owner(NAME).await.unwrap();
let hook = hooks.pop().unwrap();
// let mut event = ctx.db.list(&site.hostname).await.unwrap();
// let event = event.pop().unwrap();
let headers = add_webhook.headers();
let view_webhook_url = PAGES.dash.forgejo_webhook.get_view(&hook.auth_token);
assert_eq!(
headers.get(actix_web::http::header::LOCATION).unwrap(),
&view_webhook_url
);
// list webhooks
let resp = get_request!(&app, PAGES.dash.forgejo_webhook.list, cookies.clone());
assert_eq!(resp.status(), StatusCode::OK);
let res = String::from_utf8(test::read_body(resp).await.to_vec()).unwrap();
assert!(res.contains(hook.forgejo_url.as_str()));
// view webhook
let resp = get_request!(&app, &view_webhook_url, cookies.clone());
assert_eq!(resp.status(), StatusCode::OK);
let res = String::from_utf8(test::read_body(resp).await.to_vec()).unwrap();
assert!(res.contains("****"));
assert!(res.contains(
&crate::V1_API_ROUTES
.forgejo
.get_webhook_url(&ctx, &hook.auth_token)
));
let show_forgejo_webhook_secret =
format!("{view_webhook_url}?show_forgejo_webhook_secret=true");
let resp = get_request!(&app, &show_forgejo_webhook_secret, cookies.clone());
assert_eq!(resp.status(), StatusCode::OK);
let res = String::from_utf8(test::read_body(resp).await.to_vec()).unwrap();
assert!(res.contains(&hook.forgejo_webhook_secret));
}
}

View file

@ -0,0 +1,93 @@
/*
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use std::cell::RefCell;
use actix_identity::Identity;
use actix_web::http::header::ContentType;
use tera::Context;
use super::get_auth_middleware;
use crate::errors::ServiceResult;
use crate::pages::errors::*;
use crate::settings::Settings;
use crate::AppCtx;
pub use super::*;
pub const DASH_FORGEJO_WEBHOOK_LIST: TemplateFile =
TemplateFile::new("dash_forgejo_webhook_list", "pages/dash/forgejo/list.html");
pub struct List {
ctx: RefCell<Context>,
}
impl CtxError for List {
fn with_error(&self, e: &ReadableError) -> String {
self.ctx.borrow_mut().insert(ERROR_KEY, e);
self.render()
}
}
impl List {
pub fn new(settings: &Settings, hooks: Option<&[TemplateForgejoWebhook]>) -> Self {
let ctx = RefCell::new(context(settings));
if let Some(hooks) = hooks {
ctx.borrow_mut().insert(PAYLOAD_KEY, hooks);
}
Self { ctx }
}
pub fn render(&self) -> String {
TEMPLATES
.render(DASH_FORGEJO_WEBHOOK_LIST.name, &self.ctx.borrow())
.unwrap()
}
}
async fn get_webhook_data(
ctx: &AppCtx,
id: &Identity,
) -> ServiceResult<Vec<TemplateForgejoWebhook>> {
let db_hooks = ctx
.db
.list_all_webhooks_with_owner(&id.identity().unwrap())
.await?;
let mut hooks = Vec::with_capacity(db_hooks.len());
for hook in db_hooks {
hooks.push(TemplateForgejoWebhook::new(ctx, hook));
}
Ok(hooks)
}
#[actix_web_codegen_const_routes::get(
path = "PAGES.dash.forgejo_webhook.list",
wrap = "get_auth_middleware()"
)]
#[tracing::instrument(name = "List all Forgejo webhooks", skip(ctx, id))]
pub async fn list_hooks(ctx: AppCtx, id: Identity) -> PageResult<impl Responder, List> {
let sites = get_webhook_data(&ctx, &id)
.await
.map_err(|e| PageError::new(List::new(&ctx.settings, None), e))?;
let home = List::new(&ctx.settings, Some(&sites)).render();
let html = ContentType::html();
Ok(HttpResponse::Ok().content_type(html).body(home))
}
pub fn services(cfg: &mut web::ServiceConfig) {
cfg.service(list_hooks);
}

View file

@ -0,0 +1,69 @@
/*
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use actix_web::*;
use serde::{Deserialize, Serialize};
use super::get_auth_middleware;
pub use super::home::TemplateSite;
pub use super::{context, Footer, TemplateFile, PAGES, PAYLOAD_KEY, TEMPLATES};
use crate::ctx::Ctx;
use crate::db::ForgejoWebhook;
pub mod add;
pub mod list;
pub mod view;
pub fn register_templates(t: &mut tera::Tera) {
add::DASH_FORGEJO_WEBHOOK_ADD
.register(t)
.expect(add::DASH_FORGEJO_WEBHOOK_ADD.name);
list::DASH_FORGEJO_WEBHOOK_LIST
.register(t)
.expect(list::DASH_FORGEJO_WEBHOOK_LIST.name);
view::DASH_FORGEJO_WEBHOOK_VIEW
.register(t)
.expect(view::DASH_FORGEJO_WEBHOOK_VIEW.name);
}
pub fn services(cfg: &mut web::ServiceConfig) {
add::services(cfg);
list::services(cfg);
view::services(cfg);
}
#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
pub struct TemplateForgejoWebhook {
pub webhook: ForgejoWebhook,
pub view: String,
pub url: String,
}
impl TemplateForgejoWebhook {
pub fn new(ctx: &Ctx, hook: ForgejoWebhook) -> Self {
let view = PAGES.dash.forgejo_webhook.get_view(&hook.auth_token);
let url = crate::V1_API_ROUTES
.forgejo
.get_webhook_url(ctx, &hook.auth_token);
Self {
webhook: hook,
view,
url,
}
}
}

View file

@ -0,0 +1,108 @@
/*
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use std::cell::RefCell;
use actix_identity::Identity;
use actix_web::http::header::ContentType;
use serde::{Deserialize, Serialize};
use tera::Context;
use super::get_auth_middleware;
use crate::pages::errors::*;
use crate::settings::Settings;
use crate::AppCtx;
pub use super::*;
pub const DASH_FORGEJO_WEBHOOK_VIEW: TemplateFile =
TemplateFile::new("dash_forgejo_webhook_view", "pages/dash/forgejo/view.html");
const SHOW_FORGEJO_WEBHOOK_SECRET_KEY: &str = "show_forgejo_webhook_secret";
pub struct View {
ctx: RefCell<Context>,
}
impl CtxError for View {
fn with_error(&self, e: &ReadableError) -> String {
self.ctx.borrow_mut().insert(ERROR_KEY, e);
self.render()
}
}
impl View {
pub fn new(settings: &Settings, payload: Option<TemplateForgejoWebhook>) -> Self {
let ctx = RefCell::new(context(settings));
if let Some(payload) = payload {
ctx.borrow_mut().insert(PAYLOAD_KEY, &payload);
}
Self { ctx }
}
pub fn show_forgejo_webhook_secret(&mut self) {
self.ctx
.borrow_mut()
.insert(SHOW_FORGEJO_WEBHOOK_SECRET_KEY, &true);
}
pub fn render(&self) -> String {
TEMPLATES
.render(DASH_FORGEJO_WEBHOOK_VIEW.name, &self.ctx.borrow())
.unwrap()
}
}
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]
pub struct ViewOptions {
show_forgejo_webhook_secret: Option<bool>,
}
#[actix_web_codegen_const_routes::get(
path = "PAGES.dash.forgejo_webhook.view",
wrap = "get_auth_middleware()"
)]
#[tracing::instrument(name = "Dashboard Forgejo webhook webpage", skip(ctx, id))]
pub async fn get_view_site(
ctx: AppCtx,
id: Identity,
path: web::Path<String>,
query: web::Query<ViewOptions>,
) -> PageResult<impl Responder, View> {
let auth_token = path.into_inner();
let owner = id.identity().unwrap();
let hook = ctx
.db
.get_webhook_with_owner(&auth_token, &owner)
.await
.map_err(|e| PageError::new(View::new(&ctx.settings, None), e))?;
let payload = TemplateForgejoWebhook::new(&ctx, hook);
let mut page = View::new(&ctx.settings, Some(payload));
if let Some(true) = query.show_forgejo_webhook_secret {
page.show_forgejo_webhook_secret();
}
let add = page.render();
let html = ContentType::html();
Ok(HttpResponse::Ok().content_type(html).body(add))
}
pub fn services(cfg: &mut web::ServiceConfig) {
cfg.service(get_view_site);
}

View file

@ -18,14 +18,18 @@ use std::cell::RefCell;
use actix_identity::Identity;
use actix_web::http::header::ContentType;
use serde::{Deserialize, Serialize};
use tera::Context;
use crate::api::v1::RedirectQuery;
use crate::ctx::api::v1::auth::Login as LoginPayload;
use super::get_auth_middleware;
use crate::db::Site;
use crate::errors::ServiceResult;
use crate::pages::errors::*;
use crate::settings::Settings;
use crate::AppCtx;
use super::TemplateSiteEvent;
pub use super::*;
pub const DASH_HOME: TemplateFile = TemplateFile::new("dash_home", "pages/dash/index.html");
@ -34,6 +38,24 @@ pub struct Home {
ctx: RefCell<Context>,
}
#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
pub struct TemplateSite {
pub site: Site,
pub view: String,
pub last_update: Option<TemplateSiteEvent>,
}
impl TemplateSite {
pub fn new(site: Site, last_update: Option<TemplateSiteEvent>) -> Self {
let view = PAGES.dash.site.get_view(site.pub_id);
Self {
site,
last_update,
view,
}
}
}
impl CtxError for Home {
fn with_error(&self, e: &ReadableError) -> String {
self.ctx.borrow_mut().insert(ERROR_KEY, e);
@ -42,10 +64,10 @@ impl CtxError for Home {
}
impl Home {
pub fn new(settings: &Settings, payload: Option<&LoginPayload>) -> Self {
pub fn new(settings: &Settings, sites: Option<&[TemplateSite]>) -> Self {
let ctx = RefCell::new(context(settings));
if let Some(payload) = payload {
ctx.borrow_mut().insert(PAYLOAD_KEY, payload);
if let Some(sites) = sites {
ctx.borrow_mut().insert(PAYLOAD_KEY, sites);
}
Self { ctx }
}
@ -55,20 +77,81 @@ impl Home {
.render(DASH_HOME.name, &self.ctx.borrow())
.unwrap()
}
pub fn page(s: &Settings) -> String {
let p = Self::new(s, None);
p.render()
}
}
#[actix_web_codegen_const_routes::get(path = "PAGES.dash.home")]
pub async fn get_home(ctx: AppCtx) -> impl Responder {
let home = Home::page(&ctx.settings);
async fn get_site_data(ctx: &AppCtx, id: &Identity) -> ServiceResult<Vec<TemplateSite>> {
let db_sites = ctx.db.list_all_sites(&id.identity().unwrap()).await?;
let mut sites = Vec::with_capacity(db_sites.len());
for site in db_sites {
// TODO: impl method on DB to get latest "update" event
let last_update = ctx
.db
.get_latest_update_event(&site.hostname)
.await?
.map(|e| e.into());
sites.push(TemplateSite::new(site, last_update));
}
Ok(sites)
}
#[actix_web_codegen_const_routes::get(path = "PAGES.dash.home", wrap = "get_auth_middleware()")]
#[tracing::instrument(name = "Dashboard homepage", skip(ctx, id))]
pub async fn get_home(ctx: AppCtx, id: Identity) -> PageResult<impl Responder, Home> {
let sites = get_site_data(&ctx, &id)
.await
.map_err(|e| PageError::new(Home::new(&ctx.settings, None), e))?;
let home = Home::new(&ctx.settings, Some(&sites)).render();
let html = ContentType::html();
HttpResponse::Ok().content_type(html).body(home)
Ok(HttpResponse::Ok().content_type(html).body(home))
}
pub fn services(cfg: &mut web::ServiceConfig) {
cfg.service(get_home);
}
#[cfg(test)]
mod tests {
use actix_web::http::StatusCode;
use actix_web::test;
use crate::ctx::ArcCtx;
use crate::tests;
use crate::*;
use super::PAGES;
#[actix_rt::test]
async fn postgres_dash_home_works() {
let (_, ctx) = tests::get_ctx().await;
dashboard_home_works(ctx.clone()).await;
}
async fn dashboard_home_works(ctx: ArcCtx) {
const NAME: &str = "testdashuser";
const EMAIL: &str = "testdashuser@foo.com";
const PASSWORD: &str = "longpassword";
let _ = ctx.delete_user(NAME, PASSWORD).await;
let (_, signin_resp) = ctx.register_and_signin(NAME, EMAIL, PASSWORD).await;
let cookies = get_cookie!(signin_resp);
let app = get_app!(ctx).await;
let resp = get_request!(&app, PAGES.dash.home, cookies.clone());
assert_eq!(resp.status(), StatusCode::OK);
let res = String::from_utf8(test::read_body(resp).await.to_vec()).unwrap();
println!("before adding site: {res}");
assert!(res.contains("Nothing to show"));
let page = ctx.add_test_site(NAME.into()).await;
let resp = get_request!(&app, PAGES.dash.home, cookies.clone());
assert_eq!(resp.status(), StatusCode::OK);
let res = String::from_utf8(test::read_body(resp).await.to_vec()).unwrap();
println!("after adding site: {res}");
assert!(!res.contains("Nothing here"));
assert!(res.contains(&page.domain));
assert!(res.contains(&page.repo));
let _ = ctx.delete_user(NAME, PASSWORD).await;
}
}

View file

@ -15,15 +15,46 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use actix_web::*;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
pub use super::get_auth_middleware;
pub use super::{context, Footer, TemplateFile, PAGES, PAYLOAD_KEY, TEMPLATES};
mod home;
use crate::db::Event;
use crate::db::LibrePagesEvent;
pub mod forgejo;
pub mod home;
pub mod sites;
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct TemplateSiteEvent {
pub event_type: Event,
pub time: i64,
pub site: String,
pub id: Uuid,
}
impl From<LibrePagesEvent> for TemplateSiteEvent {
fn from(e: LibrePagesEvent) -> Self {
Self {
event_type: e.event_type,
time: e.time.unix_timestamp(),
site: e.site,
id: e.id,
}
}
}
pub fn register_templates(t: &mut tera::Tera) {
home::DASH_HOME.register(t).expect(home::DASH_HOME.name);
sites::register_templates(t);
forgejo::register_templates(t);
}
pub fn services(cfg: &mut web::ServiceConfig) {
home::services(cfg);
sites::services(cfg);
forgejo::services(cfg);
}

230
src/pages/dash/sites/add.rs Normal file
View file

@ -0,0 +1,230 @@
/*
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use std::cell::RefCell;
use actix_identity::Identity;
use actix_web::http::header::ContentType;
use serde::{Deserialize, Serialize};
use tera::Context;
use super::get_auth_middleware;
use crate::ctx::api::v1::pages::AddSite;
use crate::pages::errors::*;
use crate::settings::Settings;
use crate::AppCtx;
pub use super::*;
pub const DASH_SITE_ADD: TemplateFile =
TemplateFile::new("dash_site_add", "pages/dash/sites/add.html");
pub struct Add {
ctx: RefCell<Context>,
}
impl CtxError for Add {
fn with_error(&self, e: &ReadableError) -> String {
self.ctx.borrow_mut().insert(ERROR_KEY, e);
self.render()
}
}
impl Add {
pub fn new(settings: &Settings) -> Self {
let ctx = RefCell::new(context(settings));
Self { ctx }
}
pub fn render(&self) -> String {
TEMPLATES
.render(DASH_SITE_ADD.name, &self.ctx.borrow())
.unwrap()
}
}
#[actix_web_codegen_const_routes::get(path = "PAGES.dash.site.add", wrap = "get_auth_middleware()")]
#[tracing::instrument(name = "Dashboard add site webpage", skip(ctx))]
pub async fn get_add_site(ctx: AppCtx) -> PageResult<impl Responder, Add> {
let add = Add::new(&ctx.settings).render();
let html = ContentType::html();
Ok(HttpResponse::Ok().content_type(html).body(add))
}
#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
/// Data required to add site
pub struct TemplateAddSite {
pub repo_url: String,
pub branch: String,
}
#[actix_web_codegen_const_routes::post(
path = "PAGES.dash.site.add",
wrap = "get_auth_middleware()"
)]
#[tracing::instrument(name = "Post Dashboard add site webpage", skip(ctx, id))]
pub async fn post_add_site(
ctx: AppCtx,
id: Identity,
payload: web::Form<TemplateAddSite>,
) -> PageResult<impl Responder, Add> {
let owner = id.identity().unwrap();
let payload = payload.into_inner();
let msg = AddSite {
branch: payload.branch,
repo_url: payload.repo_url,
owner,
};
let page = ctx
.add_site(msg)
.await
.map_err(|e| PageError::new(Add::new(&ctx.settings), e))?;
Ok(HttpResponse::Found()
.append_header((
http::header::LOCATION,
PAGES.dash.site.get_view(page.pub_id),
))
.finish())
}
pub fn services(cfg: &mut web::ServiceConfig) {
cfg.service(get_add_site);
cfg.service(post_add_site);
}
#[cfg(test)]
mod tests {
use actix_web::http::StatusCode;
use actix_web::test;
use crate::ctx::api::v1::auth::Password;
use crate::ctx::ArcCtx;
use crate::errors::ServiceError;
use crate::pages::dash::sites::add::TemplateAddSite;
use crate::tests;
use crate::*;
use super::PAGES;
#[actix_rt::test]
async fn postgres_dashboard_add_site_works() {
let (_, ctx) = tests::get_ctx().await;
dashboard_add_site_works(ctx.clone()).await;
}
async fn dashboard_add_site_works(ctx: ArcCtx) {
const NAME: &str = "testdashaddsiteuser";
const EMAIL: &str = "testdashaddsiteuser@foo.com";
const PASSWORD: &str = "longpassword";
let _ = ctx.delete_user(NAME, PASSWORD).await;
let (_, signin_resp) = ctx.register_and_signin(NAME, EMAIL, PASSWORD).await;
let cookies = get_cookie!(signin_resp);
let app = get_app!(ctx.clone()).await;
let resp = get_request!(&app, PAGES.dash.site.add, cookies.clone());
assert_eq!(resp.status(), StatusCode::OK);
let res = String::from_utf8(test::read_body(resp).await.to_vec()).unwrap();
assert!(res.contains("Add Site"));
let payload = TemplateAddSite {
repo_url: tests::REPO_URL.into(),
branch: tests::BRANCH.into(),
};
let add_site = test::call_service(
&app,
post_request!(&payload, PAGES.dash.site.add, FORM)
.cookie(cookies.clone())
.to_request(),
)
.await;
assert_eq!(add_site.status(), StatusCode::FOUND);
let mut site = ctx.db.list_all_sites(NAME).await.unwrap();
let site = site.pop().unwrap();
let mut event = ctx.db.list_all_site_events(&site.hostname).await.unwrap();
let event = event.pop().unwrap();
let headers = add_site.headers();
let view_site = &PAGES.dash.site.get_view(site.pub_id);
assert_eq!(
headers.get(actix_web::http::header::LOCATION).unwrap(),
view_site
);
// view site
let resp = get_request!(&app, view_site, cookies.clone());
assert_eq!(resp.status(), StatusCode::OK);
let res = String::from_utf8(test::read_body(resp).await.to_vec()).unwrap();
assert!(res.contains("****"));
assert!(res.contains(&site.hostname));
assert!(res.contains(&site.repo_url));
assert!(res.contains(&site.branch));
assert!(res.contains(&event.event_type.name));
assert!(res.contains(&event.id.to_string()));
let show_deploy_secret_route = format!("{view_site}?show_deploy_secret=true");
let resp = get_request!(&app, &show_deploy_secret_route, cookies.clone());
assert_eq!(resp.status(), StatusCode::OK);
let res = String::from_utf8(test::read_body(resp).await.to_vec()).unwrap();
assert!(res.contains(&site.site_secret));
// delete site
let delete_site = &PAGES.dash.site.get_delete(site.pub_id);
let resp = get_request!(&app, delete_site, cookies.clone());
assert_eq!(resp.status(), StatusCode::OK);
let res = String::from_utf8(test::read_body(resp).await.to_vec()).unwrap();
assert!(res.contains(&site.hostname));
let msg = Password {
password: PASSWORD.into(),
};
let resp = test::call_service(
&app,
post_request!(&msg, delete_site, FORM)
.cookie(cookies.clone())
.to_request(),
)
.await;
// delete_request!(&app, delete_site, cookies.clone(), &msg, FORM);
assert_eq!(resp.status(), StatusCode::FOUND);
let headers = resp.headers();
assert_eq!(
headers.get(actix_web::http::header::LOCATION).unwrap(),
PAGES.dash.home,
);
assert!(!utils::get_website_path(&ctx.settings, &site.hostname).exists());
assert_eq!(
ctx.db
.get_site_from_pub_id(site.pub_id, NAME.into())
.await
.err(),
Some(ServiceError::WebsiteNotFound)
);
let mut events = ctx.db.list_all_site_events(&site.hostname).await.unwrap();
let possible_delete = events.pop().unwrap();
assert_eq!(&possible_delete.event_type, &*crate::db::EVENT_TYPE_DELETE);
let _ = ctx.delete_user(NAME, PASSWORD).await;
}
}

View file

@ -0,0 +1,185 @@
/*
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use std::cell::RefCell;
use actix_identity::Identity;
use actix_web::http::header::ContentType;
use serde::{Deserialize, Serialize};
use tera::Context;
use uuid::Uuid;
use super::get_auth_middleware;
use crate::ctx::api::v1::auth::{Login, Password};
use crate::db::Site;
use crate::pages::dash::TemplateSiteEvent;
use crate::pages::errors::*;
use crate::settings::Settings;
use crate::AppCtx;
pub use super::*;
pub const DASH_SITE_DELETE: TemplateFile =
TemplateFile::new("dash_site_delete", "pages/dash/sites/delete.html");
const SHOW_DEPLOY_SECRET_KEY: &str = "show_deploy_secret";
pub struct Delete {
ctx: RefCell<Context>,
}
impl CtxError for Delete {
fn with_error(&self, e: &ReadableError) -> String {
self.ctx.borrow_mut().insert(ERROR_KEY, e);
self.render()
}
}
impl Delete {
pub fn new(settings: &Settings, payload: Option<TemplateSiteWithEvents>) -> Self {
let ctx = RefCell::new(context(settings));
if let Some(payload) = payload {
ctx.borrow_mut().insert(PAYLOAD_KEY, &payload);
}
Self { ctx }
}
pub fn show_deploy_secret(&mut self) {
self.ctx.borrow_mut().insert(SHOW_DEPLOY_SECRET_KEY, &true);
}
pub fn render(&self) -> String {
TEMPLATES
.render(DASH_SITE_DELETE.name, &self.ctx.borrow())
.unwrap()
}
}
#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
pub struct TemplateSiteWithEvents {
pub site: Site,
pub delete: String,
pub last_update: Option<TemplateSiteEvent>,
pub events: Vec<TemplateSiteEvent>,
}
impl TemplateSiteWithEvents {
pub fn new(
site: Site,
last_update: Option<TemplateSiteEvent>,
events: Vec<TemplateSiteEvent>,
) -> Self {
let delete = PAGES.dash.site.get_delete(site.pub_id);
Self {
site,
last_update,
delete,
events,
}
}
}
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]
pub struct DeleteOptions {
show_deploy_secret: Option<bool>,
}
#[actix_web_codegen_const_routes::get(
path = "PAGES.dash.site.delete",
wrap = "get_auth_middleware()"
)]
#[tracing::instrument(name = "Dashboard delete site webpage", skip(ctx, id))]
pub async fn get_delete_site(
ctx: AppCtx,
id: Identity,
path: web::Path<Uuid>,
query: web::Query<DeleteOptions>,
) -> PageResult<impl Responder, Delete> {
let site_id = path.into_inner();
let owner = id.identity().unwrap();
let site = ctx
.db
.get_site_from_pub_id(site_id, owner)
.await
.map_err(|e| PageError::new(Delete::new(&ctx.settings, None), e))?;
let last_update = ctx
.db
.get_latest_update_event(&site.hostname)
.await
.map_err(|e| PageError::new(Delete::new(&ctx.settings, None), e))?;
let last_update = last_update.map(|e| e.into());
let mut db_events = ctx
.db
.list_all_site_events(&site.hostname)
.await
.map_err(|e| PageError::new(Delete::new(&ctx.settings, None), e))?;
let mut events = Vec::with_capacity(db_events.len());
for e in db_events.drain(0..) {
events.push(e.into());
}
let payload = TemplateSiteWithEvents::new(site, last_update, events);
let mut page = Delete::new(&ctx.settings, Some(payload));
if let Some(true) = query.show_deploy_secret {
page.show_deploy_secret();
}
let add = page.render();
let html = ContentType::html();
Ok(HttpResponse::Ok().content_type(html).body(add))
}
#[actix_web_codegen_const_routes::post(
path = "PAGES.dash.site.delete",
wrap = "get_auth_middleware()"
)]
#[tracing::instrument(name = "Delete site from webpage", skip(ctx, id))]
pub async fn post_delete_site(
ctx: AppCtx,
id: Identity,
path: web::Path<Uuid>,
payload: web::Form<Password>,
) -> PageResult<impl Responder, Delete> {
let site_id = path.into_inner();
let owner = id.identity().unwrap();
let payload = payload.into_inner();
let msg = Login {
login: owner,
password: payload.password,
};
ctx.login(&msg)
.await
.map_err(|e| PageError::new(Delete::new(&ctx.settings, None), e))?;
ctx.delete_site(msg.login, site_id)
.await
.map_err(|e| PageError::new(Delete::new(&ctx.settings, None), e))?;
Ok(HttpResponse::Found()
.append_header((http::header::LOCATION, PAGES.dash.home))
.finish())
}
pub fn services(cfg: &mut web::ServiceConfig) {
cfg.service(get_delete_site);
cfg.service(post_delete_site);
}

View file

@ -0,0 +1,43 @@
/*
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use actix_web::*;
use super::get_auth_middleware;
pub use super::home::TemplateSite;
pub use super::{context, Footer, TemplateFile, PAGES, PAYLOAD_KEY, TEMPLATES};
pub mod add;
pub mod delete;
pub mod view;
pub fn register_templates(t: &mut tera::Tera) {
add::DASH_SITE_ADD
.register(t)
.expect(add::DASH_SITE_ADD.name);
view::DASH_SITE_VIEW
.register(t)
.expect(view::DASH_SITE_VIEW.name);
delete::DASH_SITE_DELETE
.register(t)
.expect(delete::DASH_SITE_DELETE.name);
}
pub fn services(cfg: &mut web::ServiceConfig) {
add::services(cfg);
view::services(cfg);
delete::services(cfg);
}

View file

@ -0,0 +1,154 @@
/*
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use std::cell::RefCell;
use actix_identity::Identity;
use actix_web::http::header::ContentType;
use serde::{Deserialize, Serialize};
use tera::Context;
use uuid::Uuid;
use super::get_auth_middleware;
use crate::db::Site;
use crate::pages::dash::TemplateSiteEvent;
use crate::pages::errors::*;
use crate::settings::Settings;
use crate::AppCtx;
pub use super::*;
pub const DASH_SITE_VIEW: TemplateFile =
TemplateFile::new("dash_site_view", "pages/dash/sites/view.html");
const SHOW_DEPLOY_SECRET_KEY: &str = "show_deploy_secret";
pub struct View {
ctx: RefCell<Context>,
}
impl CtxError for View {
fn with_error(&self, e: &ReadableError) -> String {
self.ctx.borrow_mut().insert(ERROR_KEY, e);
self.render()
}
}
impl View {
pub fn new(settings: &Settings, payload: Option<TemplateSiteWithEvents>) -> Self {
let ctx = RefCell::new(context(settings));
if let Some(payload) = payload {
ctx.borrow_mut().insert(PAYLOAD_KEY, &payload);
}
Self { ctx }
}
pub fn show_deploy_secret(&mut self) {
self.ctx.borrow_mut().insert(SHOW_DEPLOY_SECRET_KEY, &true);
}
pub fn render(&self) -> String {
TEMPLATES
.render(DASH_SITE_VIEW.name, &self.ctx.borrow())
.unwrap()
}
}
#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
pub struct TemplateSiteWithEvents {
pub site: Site,
pub view: String,
pub delete: String,
pub last_update: Option<TemplateSiteEvent>,
pub events: Vec<TemplateSiteEvent>,
}
impl TemplateSiteWithEvents {
pub fn new(
site: Site,
last_update: Option<TemplateSiteEvent>,
events: Vec<TemplateSiteEvent>,
) -> Self {
let view = PAGES.dash.site.get_view(site.pub_id);
let delete = PAGES.dash.site.get_delete(site.pub_id);
Self {
site,
last_update,
view,
delete,
events,
}
}
}
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]
pub struct ViewOptions {
show_deploy_secret: Option<bool>,
}
#[actix_web_codegen_const_routes::get(
path = "PAGES.dash.site.view",
wrap = "get_auth_middleware()"
)]
#[tracing::instrument(name = "Dashboard add site webpage", skip(ctx, id))]
pub async fn get_view_site(
ctx: AppCtx,
id: Identity,
path: web::Path<Uuid>,
query: web::Query<ViewOptions>,
) -> PageResult<impl Responder, View> {
let site_id = path.into_inner();
let owner = id.identity().unwrap();
let site = ctx
.db
.get_site_from_pub_id(site_id, owner)
.await
.map_err(|e| PageError::new(View::new(&ctx.settings, None), e))?;
let last_update = ctx
.db
.get_latest_update_event(&site.hostname)
.await
.map_err(|e| PageError::new(View::new(&ctx.settings, None), e))?;
let last_update = last_update.map(|e| e.into());
let mut db_events = ctx
.db
.list_all_site_events(&site.hostname)
.await
.map_err(|e| PageError::new(View::new(&ctx.settings, None), e))?;
let mut events = Vec::with_capacity(db_events.len());
for e in db_events.drain(0..) {
events.push(e.into());
}
let payload = TemplateSiteWithEvents::new(site, last_update, events);
let mut page = View::new(&ctx.settings, Some(payload));
if let Some(true) = query.show_deploy_secret {
page.show_deploy_secret();
}
let add = page.render();
let html = ContentType::html();
Ok(HttpResponse::Ok().content_type(html).body(add))
}
pub fn services(cfg: &mut web::ServiceConfig) {
cfg.service(get_view_site);
}

View file

@ -14,8 +14,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use std::cell::RefCell;
use actix_identity::Identity;
use actix_web::http::header;
use actix_web::*;
@ -24,10 +22,8 @@ use rust_embed::RustEmbed;
use serde::*;
use tera::*;
use crate::pages::errors::*;
use crate::settings::Settings;
use crate::static_assets::ASSETS;
use crate::AppCtx;
use crate::{GIT_COMMIT_HASH, VERSION};
pub mod auth;
@ -77,7 +73,6 @@ lazy_static! {
tera.autoescape_on(vec![".html", ".sql"]);
auth::register_templates(&mut tera);
dash::register_templates(&mut tera);
HOME.register(&mut tera).expect(HOME.name);
tera
};
}
@ -104,7 +99,7 @@ pub fn context(s: &Settings) -> Context {
ctx
}
pub fn auth_ctx(username: Option<&str>, s: &Settings) -> Context {
pub fn auth_ctx(_username: Option<&str>, s: &Settings) -> Context {
let mut ctx = Context::new();
let footer = Footer::new(s);
ctx.insert("footer", &footer);
@ -135,52 +130,20 @@ impl<'a> Footer<'a> {
}
}
pub const HOME: TemplateFile = TemplateFile::new("home", "pages/index.html");
pub struct Home {
ctx: RefCell<Context>,
}
impl CtxError for Home {
fn with_error(&self, e: &ReadableError) -> String {
self.ctx.borrow_mut().insert(ERROR_KEY, e);
self.render()
}
}
impl Home {
pub fn new(settings: &Settings) -> Self {
let ctx = RefCell::new(context(settings));
Self { ctx }
}
pub fn render(&self) -> String {
TEMPLATES.render(HOME.name, &self.ctx.borrow()).unwrap()
}
pub fn page(s: &Settings) -> String {
let p = Self::new(s);
p.render()
}
}
#[actix_web_codegen_const_routes::get(path = "PAGES.home")]
pub async fn home(ctx: AppCtx, id: Identity) -> impl Responder {
if id.identity().is_none() {
let home = Home::page(&ctx.settings);
let html = header::ContentType::html();
HttpResponse::Ok().content_type(html).body(home)
pub async fn home(id: &Identity) -> HttpResponse {
let location = if id.identity().is_some() {
PAGES.home
} else {
HttpResponse::Found()
.append_header((header::LOCATION, PAGES.dash.home))
.finish()
}
PAGES.dash.home
};
HttpResponse::Found()
.append_header((header::LOCATION, location))
.finish()
}
pub fn services(cfg: &mut web::ServiceConfig) {
auth::services(cfg);
dash::services(cfg);
cfg.service(home);
auth::services(cfg);
}
#[cfg(test)]
@ -202,7 +165,8 @@ mod tests {
auth::login::LOGIN,
auth::register::REGISTER,
errors::ERROR_TEMPLATE,
HOME,
super::dash::home::DASH_HOME,
super::dash::sites::add::DASH_SITE_ADD,
]
.iter()
{

View file

@ -16,6 +16,7 @@
*/
use actix_auth_middleware::{Authentication, GetLoginRoute};
use serde::*;
use uuid::Uuid;
/// constant [Pages](Pages) instance
pub const PAGES: Pages = Pages::new();
@ -35,7 +36,7 @@ impl Pages {
const fn new() -> Pages {
let auth = Auth::new();
let dash = Dash::new();
let home = "/";
let home = auth.login;
Pages { auth, home, dash }
}
}
@ -70,13 +71,81 @@ impl Auth {
pub struct Dash {
/// home route
pub home: &'static str,
pub site: DashSite,
pub forgejo_webhook: ForgejoWebhook,
}
impl Dash {
/// create new instance of Dash route
pub const fn new() -> Dash {
let home = "/dash";
Dash { home }
let site = DashSite::new();
let forgejo_webhook = ForgejoWebhook::new();
Dash {
home,
site,
forgejo_webhook,
}
}
}
#[derive(Serialize)]
/// Dashboard ForgejoWebhook routes
pub struct ForgejoWebhook {
/// add forgejo webhook route
pub add: &'static str,
/// view forgejo webhook route
pub view: &'static str,
/// list forgejo webhooks route
pub list: &'static str,
}
impl ForgejoWebhook {
/// create new instance of ForgejoWebhook route
pub const fn new() -> ForgejoWebhook {
let add = "/dash/forgejo/webhook/add";
let list = "/dash/forgejo/webhook/list";
let view = "/dash/forgejo/webhook/view/{auth_token}";
ForgejoWebhook { add, view, list }
}
pub fn get_view(&self, auth_token: &str) -> String {
self.view.replace("{auth_token}", auth_token)
}
}
#[derive(Serialize)]
/// Dashboard Site routes
pub struct DashSite {
/// add site route
pub add: &'static str,
/// view site route
pub view: &'static str,
/// delete site route
pub delete: &'static str,
}
impl DashSite {
/// create new instance of DashSite route
pub const fn new() -> DashSite {
let add = "/dash/site/add";
let view = "/dash/site/view/{deployment_pub_id}";
let delete = "/dash/site/delete/{deployment_pub_id}";
DashSite { add, view, delete }
}
pub fn get_view(&self, deployment_pub_id: Uuid) -> String {
self.view.replace(
"{deployment_pub_id}",
deployment_pub_id.to_string().as_ref(),
)
}
pub fn get_delete(&self, deployment_pub_id: Uuid) -> String {
self.delete.replace(
"{deployment_pub_id}",
deployment_pub_id.to_string().as_ref(),
)
}
}

View file

@ -38,9 +38,9 @@ impl<'a> Preview<'a> {
}
pub fn extract(&self, hostname: &'a str) -> Option<&'a str> {
if !hostname.contains(&self.delimiter)
|| !hostname.contains(&self.prefix)
|| !hostname.contains(&self.base)
if !hostname.contains(self.delimiter)
|| !hostname.contains(self.prefix)
|| !hostname.contains(self.base)
{
return None;
}

View file

@ -1,3 +1,4 @@
use actix_identity::Identity;
/*
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
*
@ -14,9 +15,10 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use actix_web::{http::header::ContentType, web, HttpRequest, HttpResponse, Responder};
use actix_web::{web, HttpRequest, HttpResponse, Responder};
use crate::errors::*;
use crate::pages;
use crate::AppCtx;
pub mod routes {
@ -34,26 +36,27 @@ pub mod routes {
}
#[actix_web_codegen_const_routes::get(path = "crate::V1_API_ROUTES.serve.catch_all")]
async fn index(req: HttpRequest, ctx: AppCtx) -> ServiceResult<impl Responder> {
#[tracing::instrument(name = "Serve webpages", skip(req, ctx, id))]
async fn index(req: HttpRequest, ctx: AppCtx, id: Identity) -> ServiceResult<impl Responder> {
let c = req.connection_info();
let mut host = c.host();
if host.contains(':') {
host = host.split(':').next().unwrap();
}
tracing::debug!("Current host {host}");
// serve meta page
if host == ctx.settings.server.domain || host == "localhost" {
return Ok(HttpResponse::Ok()
.content_type(ContentType::html())
.body("Welcome to Librepages!"));
tracing::debug!("Into home");
return Ok(pages::home(&id).await);
}
// serve default hostname content
if host.contains(&ctx.settings.page.base_domain) {
let extractor = crate::preview::Preview::new(&ctx);
if let Some(preview_branch) = extractor.extract(host) {
let res = if ctx.db.hostname_exists(&host).await? {
let path = crate::utils::get_website_path(&ctx.settings, &host);
let res = if ctx.db.hostname_exists(host).await? {
let path = crate::utils::get_website_path(&ctx.settings, host);
let content =
crate::git::read_preview_file(&path, preview_branch, req.uri().path())?;
let mime = if let Some(mime) = content.mime.first_raw() {
@ -74,7 +77,7 @@ async fn index(req: HttpRequest, ctx: AppCtx) -> ServiceResult<impl Responder> {
// TODO: custom domains.
if ctx.db.hostname_exists(host).await? {
let path = crate::utils::get_website_path(&ctx.settings, &host);
let path = crate::utils::get_website_path(&ctx.settings, host);
let content = crate::git::read_file(&path, req.uri().path())?;
let mime = if let Some(mime) = content.mime.first_raw() {
mime

View file

@ -16,22 +16,20 @@
*/
use std::env;
use std::path::Path;
use std::sync::Arc;
use config::{Config, ConfigError, Environment, File};
use derive_more::Display;
#[cfg(not(test))]
use log::{error, warn};
use tracing::warn;
#[cfg(test)]
use std::{println as warn, println as error};
use std::println as warn;
use serde::Deserialize;
use serde::Serialize;
use url::Url;
use crate::errors::*;
use crate::page::Page;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Server {
@ -84,6 +82,14 @@ pub struct Settings {
pub source_code: String,
pub database: Database,
pub page: PageConfig,
pub conductors: Vec<Conductor>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Conductor {
pub username: String,
pub api_key: String,
pub url: Url,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -130,15 +136,6 @@ impl Settings {
Err(e) => warn!("couldn't interpret PORT: {}", e),
}
if let Ok(val) = env::var("DATABASE_URL") {
let url = Url::parse(&val).expect("couldn't parse Database URL");
s = s.set_override("database.url", url.to_string()).unwrap();
let database_type = DBType::from_url(&url).unwrap();
s = s
.set_override("database.database_type", database_type.to_string())
.unwrap();
}
let intermediate_config = s.build_cloned().unwrap();
s = s
@ -165,6 +162,15 @@ impl Settings {
)
.expect("Couldn't set database url");
if let Ok(val) = env::var("DATABASE_URL") {
let url = Url::parse(&val).expect("couldn't parse Database URL");
s = s.set_override("database.url", url.to_string()).unwrap();
let database_type = DBType::from_url(&url).unwrap();
s = s
.set_override("database.database_type", database_type.to_string())
.unwrap();
}
let settings = s.build()?.try_deserialize::<Settings>()?;
settings.check_url();
@ -178,7 +184,7 @@ impl Settings {
}
if !path.exists() {
std::fs::create_dir_all(&path).unwrap();
std::fs::create_dir_all(path).unwrap();
}
}

View file

@ -35,6 +35,21 @@ pub mod routes {
lazy_static! {
pub static ref ASSETS: Assets = Assets::new();
}
#[derive(Serialize)]
pub struct Svg {
pub eye_off: &'static str,
pub eye: &'static str,
}
impl Svg {
/// create new instance of Routes
pub fn new() -> Svg {
Svg {
eye: &static_files::assets::CSS,
eye_off: &static_files::assets::CSS,
}
}
}
#[derive(Serialize)]
/// Top-level routes data structure for V1 AP1
@ -42,6 +57,7 @@ pub mod routes {
/// Authentication routes
pub css: &'static str,
pub mobile_css: &'static str,
pub svg: Svg,
}
impl Assets {
@ -50,6 +66,7 @@ pub mod routes {
Assets {
css: &static_files::assets::CSS,
mobile_css: &static_files::assets::CSS,
svg: Svg::new(),
}
}
}

View file

@ -29,6 +29,9 @@ pub mod assets {
lazy_static! {
pub static ref CSS: &'static str = FILES.get("./static/cache/css/main.css").unwrap();
pub static ref EYE: &'static str = FILES.get("./static/cache/img/svg/eye.svg").unwrap();
pub static ref EYE_OFF: &'static str =
FILES.get("./static/cache/img/svg/eye-off.svg").unwrap();
pub static ref MOBILE_CSS: &'static str =
FILES.get("./static/cache/css/mobile.css").unwrap();
}

View file

@ -24,6 +24,7 @@ use actix_web::{
};
use mktemp::Temp;
use serde::Serialize;
use url::Url;
use crate::ctx::api::v1::auth::{Login, Register};
use crate::ctx::api::v1::pages::AddSite;
@ -40,6 +41,15 @@ pub async fn get_ctx() -> (Temp, Arc<Ctx>) {
// mktemp::Temp is returned because the temp directory created
// is removed once the variable goes out of scope
let mut settings = Settings::new().unwrap();
let mut db_url = Url::parse(&settings.database.url).unwrap();
db_url.set_path(&crate::utils::get_random(8));
settings.database.url = db_url.to_string();
use sqlx::migrate::MigrateDatabase;
// sqlx::Postgres::create_database(&settings.database.url).await.unwrap();
sqlx::postgres::Postgres::create_database(&settings.database.url)
.await
.unwrap();
let tmp_dir = Temp::new_dir().unwrap();
println!("[log] Test temp directory: {}", tmp_dir.to_str().unwrap());
@ -48,8 +58,10 @@ pub async fn get_ctx() -> (Temp, Arc<Ctx>) {
settings.init();
println!("[log] Initialzing settings again with test config");
settings.init();
let ctx = Ctx::new(settings).await;
ctx.db.migrate().await.unwrap();
(tmp_dir, Ctx::new(settings).await)
(tmp_dir, ctx)
}
#[allow(dead_code, clippy::upper_case_acronyms)]
@ -109,6 +121,18 @@ macro_rules! delete_request {
)
.await
};
($app:expr, $route:expr, $cookies:expr, $serializable:expr, FORM) => {
test::call_service(
&$app,
test::TestRequest::delete()
.uri($route)
.set_form($serializable)
.cookie($cookies)
.to_request(),
)
.await
};
}
#[macro_export]

1
static/cache/img/svg/eye-off.svg vendored Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="icon" class="feather feather-eye-off"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>

After

Width:  |  Height:  |  Size: 470 B

1
static/cache/img/svg/eye.svg vendored Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="icon" class="feather feather-eye"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>

After

Width:  |  Height:  |  Size: 326 B

View file

@ -4,10 +4,9 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="{{ assets.css }}" />
<title>LibrePages</title>
<title>{% block title %} {% endblock %}</title>
<title>{% block title %} {% endblock %} | LibrePages</title>
</head>
<body>
<body class="default-body">
<header>{% block nav %} {% endblock %}</header>
{% block main %} {% endblock %}
{% include "footer" %}

View file

@ -2,7 +2,7 @@
<input type="checkbox" class="nav__toggle" id="nav__toggle" />
<div class="nav__header">
<a class="nav__logo-container" href="/">
<a class="nav__logo-container" href="{{page.dash.home}}">
<p class="nav__home-btn">LibrePages</p>
</a>
<label class="nav__hamburger-menu" for="nav__toggle">
@ -14,13 +14,13 @@
<div class="nav__link-group">
<div class="nav__link-container">
<a class="nav__link" rel="noreferrer" href="{{ page.gist.new }}">New Paste</a>
<a class="nav__link" rel="noreferrer" href="{{ page.dash.site.add }}">New Site</a>
</div>
{% if loggedin_user %}
<div class="nav__link-container">
<a class="nav__link" rel="noreferrer" href="{{ loggedin_user }}">Profile</a>
</div>
{% endif %}
<div class="nav__link-container">
<a class="nav__link" rel="noreferrer" href="{{ page.dash.forgejo_webhook.list }}">Webhooks</a>
</div>
<div class="nav__link-container">
<a class="nav__link" rel="noreferrer" href="{{ page.auth.logout }}">Log out</a>
</div>

View file

@ -2,7 +2,7 @@
<input type="checkbox" class="nav__toggle" id="nav__toggle" />
<div class="nav__header">
<a class="nav__logo-container" href="/">
<a class="nav__logo-container" href="{{ page.dash.home }}">
<p class="nav__home-btn">LibrePages</p>
</a>
<label class="nav__hamburger-menu" for="nav__toggle">

View file

@ -1,5 +1,5 @@
@mixin fullscreen {
height: 100vh;
min-height: 500px;
max-height: 800px;
// max-height: 800px;
}

View file

@ -1,5 +1,14 @@
@import "defaults.scss";
@import "pages/auth/sass/main.scss";
@import "pages/auth/sass/form/main.scss";
@import "pages/dash/main.scss";
@import "pages/dash/sites/main.scss";
@import "components/sass/footer/main.scss";
@import "components/nav/sass/main.scss";
.default-body {
display: flex;
@include fullscreen;
flex-direction: column;
justify-content: space-between;
}

View file

@ -0,0 +1,23 @@
{% extends 'base' %}{% block title %} Add Forgejo Webhook{% endblock title %} {% block nav
%} {% include "auth_nav" %} {% endblock nav %} {% block main %}
<main class="sites__main">
<div class="add-site__container">
<form class="auth-form" action="{{ page.dash.forgejo_webhook.add }}" method="POST">
<label class="auth-form__label" for="forgejo_url">
Forgejo instance URL
<input
type="url"
name="forgejo_url"
id="forgejo_url"
class="auth-form__input"
/>
</label>
<div class="auth-form__action-container">
<button class="auth-form__submit" type="submit">Add Webhook</button>
</div>
</form>
</div>
</main>
{% endblock main %}

View file

@ -0,0 +1,33 @@
{% extends 'base' %}{% block title %} Forgejo Webhooks{% endblock title %} {% block nav
%} {% include "auth_nav" %} {% endblock nav %} {% block main %}
<main class="sites__main">
<div class="sites__collection">
<div class="sites__actions">
<a class="sites__actions__new-site" href="{{ page.dash.forgejo_webhook.add }}">
<button>Add New Forgejo Webhook</button>
</a>
</div>
{% if payload|length > 0 %}
{% for hook in payload %}
<a href="{{ hook.view }}" class="site__container">
<div class="site__info--head">
<img
class="site__container--preview"
src="{{ hook.webhook.forgejo_url }}/favicon.ico"
alt="Webhook icon"
/>
<div class="site__info--column">
<p><b>{{ hook.webhook.forgejo_url }}</b></p>
<p>Forgejo instance {{ hook.webhook.forgejo_url }}</p>
</div>
</div>
</a>
{% endfor %}
{% else %}
<p class="sites__banner">Nothing to show, click <a href="{{page.dash.forgejo_webhook.add}}">here</a> to add new Forgejo webhook!</p>
{% endif %}
</div>
</main>
{% endblock main %}

View file

@ -0,0 +1,32 @@
{% extends 'base' %}{% block title %} {{ payload.webhook.forgejo_url }}{% endblock title %} {% block nav
%} {% include "auth_nav" %} {% endblock nav %} {% block main %}
<main class="sites__main">
<div class="add-site__container">
<section>
<table>
<tr>
<th>Webhook URL</th>
<td>{{ payload.url }}</td>
</tr>
<tr>
<th>Secret</th>
<td>
{% if show_forgejo_webhook_secret %}
{{ payload.webhook.forgejo_webhook_secret }} <a href="{{ payload.view }}">Hide</a>
{% else %}
****
<a href="{{ payload.view }}?show_forgejo_webhook_secret=true">
Show
</a>
{% endif %}
</td>
</tr>
</table>
</section>
</div>
</main>
{% endblock main %}

View file

@ -1,160 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="{{ assets.css }}" />
<title>LibrePages</title>
</head>
<body class="auth__body">
<header>
<nav>
<p>LibrePages</p>
<span class="nav__spacer"></span>
<ul class="nav__links">
<li class="nav__item">Help</li>
<li class="nav__item">Settings</li>
<li class="nav__item">Logout</li>
</ul>
</nav>
</header>
<main>
<div class="sites__collection">
<div class="sites__actions">
<a class="sites__actions__new-site" href="/add/new/site">
<button>Add new site</button>
</a>
</div>
<a href="/sites/mcaptcha.org" class="site__container">
{% extends 'base' %}{% block title %} Dashboard{% endblock title %} {% block nav
%} {% include "auth_nav" %} {% endblock nav %} {% block main %}
<main class="sites__main">
<div class="sites__collection">
<div class="sites__actions">
<a class="sites__actions__new-site" href="{{ page.dash.site.add }}">
<button>Add New Site</button>
</a>
</div>
{% if payload|length > 0 %}
{% for deployment in payload %}
<a href="{{ deployment.view }}" class="site__container">
<div class="site__info--head">
<img
class="site__container--preview"
src="https://mcaptcha.org/favicon.ico"
src="{{ deployment.site.hostname }}/favicon.ico"
alt="Website icon"
/>
<div class="site__info--column">
<p href="https://mcaptcha.org"><b>mcaptcha.org</b></p>
<p>Deploys from {{ source_url }}</p>
<p><b>{{ deployment.site.hostname }}</b></p>
<p>Deploys from {{ deployment.site.repo_url }}</p>
</div>
</div>
<div class="site__info--tail">
<p>Last update {{ last_update }}</p>
</div></a
>
</div>
</main>
{% include "footer" %}
</body>
{% if deployment.last_update %}
<div class="site__info--tail">
<p>Last update {{ deployment.last_update.time }}</p>
</div>
{% endif %}
</a>
{% endfor %}
{% else %}
<p class="sites__banner">Nothing to show, click <a href="{{page.dash.site.add}}">here</a> to get started!</p>
{% endif %}
</div>
</main>
<style>
header {
width: 100%;
}
nav {
width: 100%;
margin: auto;
display: flex;
}
.nav__spacer {
flex: 4;
}
.nav__links {
display: flex;
list-style: none;
}
.nav__item {
margin: 0 20px;
}
body {
display: flex;
flex-direction: column;
align-items: center;
}
main {
width: 100%;
margin: 20px;
}
.sites__collection {
margin: auto;
width: 70%;
border: 1px solid #e8ebed;
border-radius: 8px;
}
.sites__actions {
width: 100%;
height: 50px;
display: flex;
flex-direction: row-reverse;
align-items: center;
box-sizing: border-box;
padding: 0px 20px;
margin: 10px 0;
}
.sites__actions__new-site {
min-height: 36px;
background: green;
display: flex;
align-items: center;
padding: 0px 8px;
}
.sites__actions__new-site > button {
margin: 0;
padding: 0;
height: 100%;
border: none;
width: 100%;
color: white;
background: none;
}
.site__container {
box-sizing: border-box;
margin: 10px 0;
width: 100%;
display: flex;
justify-content: space-between;
padding: 10px 20px;
align-items: center;
}
.site__container:hover {
background: #f7f8f8;
}
.site__info--head {
display: flex;
align-items: center;
}
.site__info--column {
margin-left: 20px;
}
.site__info--column > p,
.site__info--column > a {
margin: 0;
padding: 0;
}
.site__container:visited,
.site__container {
color: black;
text-decoration: none;
}
.site__container--preview {
width: 50px;
height: 50px;
border-radius: 50%;
}
</style>
</html>
{% endblock main %}

View file

@ -0,0 +1,85 @@
.sites__main {
width: 100%;
margin: 20px;
}
.sites__collection {
margin: auto;
width: 70%;
border: 1px solid #e8ebed;
border-radius: 8px;
}
.sites__actions {
width: 100%;
height: 50px;
display: flex;
flex-direction: row-reverse;
align-items: center;
box-sizing: border-box;
padding: 0px 20px;
margin: 10px 0;
}
.sites__actions__new-site {
min-height: 36px;
background: green;
display: flex;
align-items: center;
padding: 0px 8px;
}
.sites__actions__new-site > button {
margin: 0;
padding: 0;
height: 100%;
border: none;
width: 100%;
color: white;
background: none;
}
.site__container {
box-sizing: border-box;
margin: 10px 0;
width: 100%;
display: flex;
justify-content: space-between;
padding: 10px 20px;
align-items: center;
}
.site__container:hover {
background: #f7f8f8;
}
.site__info--head {
display: flex;
align-items: center;
}
.site__info--column {
margin-left: 20px;
}
.site__info--column > p,
.site__info--column > a {
margin: 0;
padding: 0;
}
.site__container:visited,
.site__container {
color: black;
text-decoration: none;
}
.site__container--preview {
width: 50px;
height: 50px;
border-radius: 50%;
}
.sites__banner {
text-align: center;
}

View file

@ -0,0 +1,29 @@
{% extends 'base' %}{% block title %} Add Site{% endblock title %} {% block nav
%} {% include "auth_nav" %} {% endblock nav %} {% block main %}
<main class="sites__main">
<div class="add-site__container">
<form class="auth-form" action="{{ page.dash.site.add }}" method="POST">
<label class="auth-form__label" for="repo_url">
Repository URL
<input
type="url"
name="repo_url"
id="repo_url"
class="auth-form__input"
/>
</label>
<label class="auth-form__label" for="branch">
Deployment branch
<input type="text" name="branch" id="branch" class="auth-form__input" />
</label>
<div class="auth-form__action-container">
<button class="auth-form__submit" type="submit">Add Site</button>
</div>
</form>
</div>
</main>
{% endblock main %}

View file

@ -0,0 +1,37 @@
{% extends 'base' %}{% block title %} Delete {{ payload.site.hostname }}{% endblock title %} {% block nav
%} {% include "auth_nav" %} {% endblock nav %} {% block main %}
<main class="sites__main">
<div class="add-site__container">
<form class="auth-form" action="{{ payload.delete }}" method="post">
<h1>Confirm access</h1>
<p>
Please confirm access to your account to delete deployment at
<a href="http://{{ payload.site.hostname }}">
{{ payload.site.hostname }}
</a>
</p>
<label class="auth-form__label" for="password">
Password
<input
class="auth-form__input"
name="password"
required
id="password"
type="password"
{% if payload.password %}
value={{ payload.password }}
{% endif %}
/>
</label>
<div class="auth-form__action-container">
<button class="auth-form__submit--danger" type="submit">Delete</button>
</div>
</form>
</div>
</main>
{% endblock main %}

View file

@ -0,0 +1,4 @@
.add-site__container {
max-width: 50%;
margin: auto;
}

View file

@ -0,0 +1,72 @@
{% extends 'base' %}{% block title %} {{ payload.site.hostname }}{% endblock title %} {% block nav
%} {% include "auth_nav" %} {% endblock nav %} {% block main %}
<main class="sites__main">
<div class="add-site__container">
<section>
<table>
<tr>
<th>Hostname</th>
<td>{{ payload.site.hostname }}</td>
</tr>
<tr>
<th>Repository</th>
<td>{{ payload.site.repo_url }}</td>
</tr>
<tr>
<th>Secret</th>
<td>
{% if show_deploy_secret %}
{{ payload.site.site_secret }} <a href="{{ payload.view }}">Hide</a>
{% else %}
****
<a href="{{ payload.view }}?show_deploy_secret=true">
Show
</a>
{% endif %}
</td>
</tr>
<tr>
<th>Branch</th>
<td>{{ payload.site.branch }}</td>
</tr>
<tr>
<th>Last Updated</th>
{% if payload.last_updated %}
<td>{{ payload.last_updated.time }}</td>
{% else %}
<td>N/A</td>
{% endif %}
</tr>
</table>
<a href="{{ payload.delete }}"><button>Delete</button></a>
</section>
<section>
<h2>Events</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Event Type</th>
<th>Time</th>
</tr>
</thead>
<tbody>
{% for event in payload.events %}
<tr>
<td>{{ event.id }}</td>
<td>{{ event.event_type.name }}</td>
<td>{{ event.time }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
</div>
</main>
{% endblock main %}

View file

@ -1,138 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="{{ assets.css }}" />
<title>LibrePages</title>
</head>
<body class="auth__body">
<header>
<nav>
<p>LibrePages</p>
<span class="nav__spacer"></span>
<ul class="nav__links">
<li class="nav__item">Help</li>
</ul>
</nav>
</header>
<main>
<h1>LibrePages: FOSS static site hosting</h1>
<p>Welcome to LibrePages. Homepage.</p>
</main>
{% include "footer" %}
</body>
<style>
header {
width: 100%;
}
nav {
width: 100%;
margin: auto;
display: flex;
}
.nav__spacer {
flex: 4;
}
.nav__links {
display: flex;
list-style: none;
}
.nav__item {
margin: 0 20px;
}
body {
display: flex;
flex-direction: column;
align-items: center;
}
main {
width: 100%;
margin: 20px;
}
.sites__collection {
margin: auto;
width: 70%;
border: 1px solid #e8ebed;
border-radius: 8px;
}
.sites__actions {
width: 100%;
height: 50px;
display: flex;
flex-direction: row-reverse;
align-items: center;
box-sizing: border-box;
padding: 0px 20px;
margin: 10px 0;
}
.sites__actions__new-site {
min-height: 36px;
background: green;
display: flex;
align-items: center;
padding: 0px 8px;
}
.sites__actions__new-site > button {
margin: 0;
padding: 0;
height: 100%;
border: none;
width: 100%;
color: white;
background: none;
}
.site__container {
box-sizing: border-box;
margin: 10px 0;
width: 100%;
display: flex;
justify-content: space-between;
padding: 10px 20px;
align-items: center;
}
.site__container:hover {
background: #f7f8f8;
}
.site__info--head {
display: flex;
align-items: center;
}
.site__info--column {
margin-left: 20px;
}
.site__info--column > p,
.site__info--column > a {
margin: 0;
padding: 0;
}
.site__container:visited,
.site__container {
color: black;
text-decoration: none;
}
.site__container--preview {
width: 50px;
height: 50px;
border-radius: 50%;
}
</style>
</html>

View file

@ -0,0 +1,18 @@
domains = [
"example.org",
"example.com",
]
redirects = [
{from = "/from1", to = "/to1"},
{from = "/from2", to = "/to2"},
]
[source]
production_branch = "librepages"
staging = "beta"
[forms]
enable = true
[image_compression]
enable = true

View file

@ -72,7 +72,7 @@ dependencies = [
"proc-macro2",
"quote",
"strsim",
"syn",
"syn 1.0.94",
]
[[package]]
@ -83,7 +83,7 @@ checksum = "ddfc69c5bfcbd2fc09a0f38451d2daf0e372e367986a83906d1b0dbc88134fb5"
dependencies = [
"darling_core",
"quote",
"syn",
"syn 1.0.94",
]
[[package]]
@ -110,7 +110,7 @@ dependencies = [
"darling",
"proc-macro2",
"quote",
"syn",
"syn 1.0.94",
]
[[package]]
@ -120,7 +120,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68"
dependencies = [
"derive_builder_core",
"syn",
"syn 1.0.94",
]
[[package]]
@ -167,6 +167,21 @@ version = "0.2.125"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b"
[[package]]
name = "librepages"
version = "0.1.0"
dependencies = [
"cache-buster",
"serde",
"serde_json",
]
[[package]]
name = "memchr"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "mime"
version = "0.3.16"
@ -183,29 +198,20 @@ dependencies = [
"unicase",
]
[[package]]
name = "pages"
version = "0.1.0"
dependencies = [
"cache-buster",
"serde",
"serde_json",
]
[[package]]
name = "proc-macro2"
version = "1.0.38"
version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9027b48e9d4c9175fa2218adf3557f91c1137021739951d4932f5f8268ac48aa"
checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23"
dependencies = [
"unicode-xid",
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.18"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
dependencies = [
"proc-macro2",
]
@ -227,31 +233,32 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.137"
version = "1.0.210"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1"
checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.137"
version = "1.0.210"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be"
checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.66",
]
[[package]]
name = "serde_json"
version = "1.0.81"
version = "1.0.128"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c"
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
dependencies = [
"itoa",
"memchr",
"ryu",
"serde",
]
@ -284,6 +291,17 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "syn"
version = "2.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "typenum"
version = "1.15.0"
@ -299,6 +317,12 @@ dependencies = [
"version_check",
]
[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-xid"
version = "0.2.3"

View file

@ -1,11 +1,11 @@
[package]
name = "pages"
name = "librepages"
version = "0.1.0"
edition = "2021"
homepage = "https://github.com/realaravinth/pages"
repository = "https://github.com/realaravinth/pages"
documentation = "https://github.con/realaravinth/pages"
readme = "https://github.com/realaravinth/pages/blob/master/README.md"
homepage = "https://git.batsense.net/LibrePages/librepages"
repository = "https://git.batsense.net/LibrePages/librepages"
documentation = "https://github.con/realaravinth/librepages"
readme = "https://git.batsense.net/LibrePages/librepages/blob/master/README.md"
license = "AGPLv3 or later version"
authors = ["realaravinth <realaravinth@batsense.net>"]