Commit Graph

1066 Commits

Author SHA1 Message Date
Igor Galić
df7adaf0e0
when building links, skip both, /custom_domain/ and <custom_domain> 2019-08-20 15:04:29 +02:00
Igor Galić
768f126f1d
use Status::* as @fdb-hiroshima suggested 2019-08-20 14:51:14 +02:00
Igor Galić
169469816d
use Custom status code
thanks, @fdb-hiroshima

Co-Authored-By: fdb-hiroshima <35889323+fdb-hiroshima@users.noreply.github.com>
2019-08-20 14:43:20 +02:00
Igor Galić
064dd79eef
Allow editing blogs with custom_domain
n.b.: no validation yet
2019-08-20 12:24:36 +02:00
Igor Galić
df47cddb87
also mount domain_validation into /custom_domains/ 2019-08-20 11:47:24 +02:00
Igor Galić
f67ce93d94
fix getter router for domain_validation! 2019-08-20 11:33:00 +02:00
Igor Galić
38ece9b5a6
do not panic if reqwest does not work 2019-08-20 11:18:23 +02:00
Igor Galić
5e46922ed0 validate custom domain! 2019-08-19 22:42:34 +02:00
Igor Galić
6072351840 one step closer to validating custom domains! 2019-08-19 22:04:22 +02:00
Igor Galić
444a4673f4 correctly mutex-lock and modify valid_domains
thanks to @fdb-hiroshima for the review
2019-08-19 21:19:52 +02:00
Igor Galić
ed30284386
implement domain validation using rocket::State
this doesn't work (yet?), because i don't know how to store something
mutable in State<>
2019-08-15 17:47:19 +02:00
Igor Galić
bf1673dda1
start exploring some ideas for domain validation 2019-08-14 23:51:28 +02:00
Igor Galić
ff0c82efc1
review by @fdb-hiroshima
Co-Authored-By: fdb-hiroshima <35889323+fdb-hiroshima@users.noreply.github.com>
2019-08-14 23:51:27 +02:00
Ana Gelez
da6757c55c
Basic domain validation
The actual DNS check still needs to be written
2019-08-14 23:51:27 +02:00
Igor Galić
60270121dc
fix clippy warning
Co-Authored-By: fdb-hiroshima <35889323+fdb-hiroshima@users.noreply.github.com>
2019-08-14 23:51:26 +02:00
Ana Gelez
fdc7da0edf
Strings have to be cloned 2019-08-14 23:51:25 +02:00
Igor Galić
2dedcdbc53
start modifying /blogs/new to add custom_domain to the form 2019-08-14 23:51:24 +02:00
Trinity Pointard
b172a80e35
finally fix url!
also please a bit clippy
2019-08-14 23:51:23 +02:00
Trinity Pointard
c5f6b88b1d
make url! work better
there is still some issue with `None`, and an error making no sense at
some place
2019-08-14 23:51:23 +02:00
Igor Galić
6cd8bd89b2
fix syntax: we're now down to type errors 2019-08-14 23:51:22 +02:00
Trinity Pointard
cdc919e308
allow more syntaxes for url
allow for params that are used only by one of normal/custom routes
2019-08-14 23:51:21 +02:00
Igor Galić
f635dcf6c3
move custom_ route functions into a custom namespace
this way, we can actually use the url! macro
2019-08-14 23:51:20 +02:00
Trinity Pointard
7139119b8f
add url! macro for custom domain path uri creation
see doc-comment for limitations
2019-08-14 23:51:20 +02:00
Igor Galić
203da23cf2
follow up on @fdb-hiroshima & @BaptisteGelez review 2019-08-14 23:51:19 +02:00
Igor Galić
f73fba583a
custom_domainify posts::details 2019-08-14 23:51:18 +02:00
Igor Galić
fe110b5d8a
fix issues pointed out by @BaptisteGelez in review 2019-08-14 23:51:17 +02:00
Igor Galić
cc0df4ecb2
redirect blog urls to custom_domain if it exists 2019-08-14 23:51:16 +02:00
Igor Galić
9cee38ae6a
add url to Blog, this seems useful. 2019-08-14 23:51:16 +02:00
Igor Galić
8e7f789969
Allow searching from custom_domain 2019-08-14 23:51:15 +02:00
Igor Galić
92fbd174eb
extend 404 handler to handle all the requests our custom_ routes dont 2019-08-14 23:51:14 +02:00
Igor Galić
6253adf768
simplify / unify error handling
We want to return a Result<Blog>, instead of a QueryResult<Blog>.
We can use map_err() to map it to the desired error type.

thanks to review from @BaptisteGelez & @fdb-hiroshima.
2019-08-14 23:51:13 +02:00
Igor Galić
a0aef50674
extract common routing code into private "_guts()" functions 2019-08-14 23:51:13 +02:00
Igor Galić
8e6b1ab86e
simplify retrieval in find_by_host()
we can use "first()" instead of limit(1).load().etc…
since on a UNIQUE field, we only expect 1 result.

first() returns QueryResult, which is Result<T, diesel::Error>, so we
need to implement a converter for that error type.

This commit addresses @fdb-hiroshima's review.
2019-08-14 23:51:12 +02:00
Igor Galić
1c34ac38f7
replace if / else with ok_or() 2019-08-14 23:51:11 +02:00
Igor Galić
468e663344
Add custom_details and custom_activity_details as first routes
how this works: we use find_by_host() to find the Host in question, the
defer to the existing function!

Caveat: Currently, we, in that function, we do another lookup DB lookup
for the Blog, even thou we already know it.
It might be wise, to have both of those another wrapper here?!
2019-08-14 23:51:10 +02:00
Igor Galić
0645f7e253
CustomDomainFairing must not match /static/ and /api/
thanks, again, @fdb-hiroshima for helping with this code, when i got
stuck in lifetime-hecc.
2019-08-14 23:51:10 +02:00
Igor Galić
f94b0c79c5
move impl closer to mother struct 2019-08-14 23:51:09 +02:00
Igor Galić
b09b51c74b
normalize URLs before setting them 2019-08-14 23:51:08 +02:00
Igor Galić
e6747de998
cache custom_domains list
follow #572 and cache the list of custom domains.
2019-08-14 23:51:07 +02:00
Igor Galić
2746e088ae
appease clippy 2019-08-14 23:51:06 +02:00
Igor Galić
3a4c2f2cf9
create & attach an AdHoc Fairing for dealing with Custom Domains
this rewrites the URL to /custom_domain/<url>
(we have no route handlers for this path yet)

Lots of help from @fdb-hiroshima & @BaptisteGelez in dealing with the
borrow checker — thank you 💜
2019-08-14 23:51:06 +02:00
Igor Galić
351c01f71c
list custom_domains
thanks a lot to @fdb-hiroshima and @BaptisteGelez for helping with the
code.
2019-08-14 23:51:05 +02:00
Igor Galić
65ae51b7e5
implement Host more completely by doing less
we now use DieselNewType and Shrinkwrap to automatically derive all the
things we need.
2019-08-14 23:51:04 +02:00
Igor Galić
92bbeeb45e
add Host(String) wrapper type
we can use this to handle rocket Requests (from_request)
but we still have to figure out how to automatically assign the type to
custom_domain: Optional<Host>, and public_domain: Host.
2019-08-14 23:51:03 +02:00
Igor Galić
6bcc4f0ab0
add custom_domain (default to NULL) to schema 2019-08-14 23:51:03 +02:00
fdb-hiroshima
fb60236a54
update dependancies (#643)
* Bump activitystreams-derive from 0.1.0 to 0.1.1
* Bump tantivy from 0.9.1 to 0.10.1
* Bump rpassword from 3.0.2 to 4.0.1
* Bump num_cpus from 1.10.0 to 1.10.1
* Bump serde_qs from 0.4.6 to 0.5.0
* Bump stdweb-internal-runtime from 0.1.3 to 0.1.4
* [Security] Bump smallvec from 0.6.9 to 0.6.10
* Bump chrono from 0.4.6 to 0.4.7
* Bump bcrypt from 0.4.0 to 0.5.0
* Bump serde_json from 1.0.39 to 1.0.40
* Bump tokio from 0.1.21 to 0.1.22
* Bump scheduled-thread-pool from 0.2.0 to 0.2.2
* Bump stdweb from 0.4.14 to 0.4.18
* Bump hyper from 0.12.29 to 0.12.33
* Bump reqwest from 0.9.17 to 0.9.19
* Bump url from 1.7.2 to 2.1.0
2019-08-14 15:04:30 +02:00
fdb-hiroshima
4f7c20fc26 Fix some federation issue (#573)
* send scheme as part of webfinger remote follow template

fix tsileo/microblog.pub#49

* bump webfinger to 0.4.1

* cargo fmt

* revert translations

* Use group: prefix for blog webfinger queries
2019-07-31 11:38:49 +02:00
Mostafa Ahangarha
54c6d21fc5 WIP - initial RTL support #575 (#577)
* initial RTL support

* fix dir in template-util

* fix dir in blogs new

* fix dir in blogs details

* fix dir in posts new

* fix dir in posts details

* fix dir in posts remote

* Fix dir in partials

some parts should be recheck carefully in real usage
2019-07-11 09:34:27 +02:00
Wilfried OLLIVIER
c031804464 Add clap to plume in order to print help and version (#631)
* Add clap in order to print help and version

Related to https://github.com/Plume-org/Plume/issues/594

* Update after_help text message
2019-07-03 19:36:42 +01:00
fdb-hiroshima
5289fe872a
don't ignore dotenv errors (#630) 2019-07-03 09:30:44 +02:00