Compare commits
No commits in common. "e040764902eceaa7f9a3632b0963119ee4c29909" and "80ac131fb2a151f7f20f8d36849a8a0f25cf8a90" have entirely different histories.
e040764902
...
80ac131fb2
@ -5,4 +5,3 @@ limits = { file = "10 MiB", data-form = "10 MiB"}
|
|||||||
smtp_pw = "8kIjlLH79Ky6D3jQ"
|
smtp_pw = "8kIjlLH79Ky6D3jQ"
|
||||||
usage_log_path = "./usage.txt"
|
usage_log_path = "./usage.txt"
|
||||||
openweathermap_key = "c8dab8f91b5b815d76e9879cbaecd8d5"
|
openweathermap_key = "c8dab8f91b5b815d76e9879cbaecd8d5"
|
||||||
wordpress_key = "KYplHPxd6Gtqjdx4Ruik"
|
|
||||||
|
@ -118,35 +118,6 @@ fn unauthorized_error(req: &Request) -> Redirect {
|
|||||||
Redirect::to("/auth")
|
Redirect::to("/auth")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(FromForm, Debug)]
|
|
||||||
struct NewBlogpostForm<'r> {
|
|
||||||
article_url: &'r str,
|
|
||||||
pw: &'r str,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[post("/", data = "<blogpost>")]
|
|
||||||
async fn new_blogpost(
|
|
||||||
db: &State<SqlitePool>,
|
|
||||||
blogpost: Form<NewBlogpostForm<'_>>,
|
|
||||||
config: &State<Config>,
|
|
||||||
) -> String {
|
|
||||||
if blogpost.pw == &config.wordpress_key {
|
|
||||||
let member = Role::find_by_name(&db, "Donau Linz").await.unwrap();
|
|
||||||
Notification::create_for_role(
|
|
||||||
db,
|
|
||||||
&member,
|
|
||||||
&format!("auf unserer Website!"),
|
|
||||||
&format!("Neuer Blogpost"),
|
|
||||||
Some(blogpost.article_url),
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
"ACK".into()
|
|
||||||
} else {
|
|
||||||
"WRONG pw".into()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[catch(403)] //forbidden
|
#[catch(403)] //forbidden
|
||||||
fn forbidden_error() -> Flash<Redirect> {
|
fn forbidden_error() -> Flash<Redirect> {
|
||||||
Flash::error(Redirect::to("/"), "Keine Berechtigung für diese Aktion. Wenn du der Meinung bist, dass du das machen darfst, melde dich bitte bei it@rudernlinz.at.")
|
Flash::error(Redirect::to("/"), "Keine Berechtigung für diese Aktion. Wenn du der Meinung bist, dass du das machen darfst, melde dich bitte bei it@rudernlinz.at.")
|
||||||
@ -216,7 +187,6 @@ pub struct Config {
|
|||||||
smtp_pw: String,
|
smtp_pw: String,
|
||||||
usage_log_path: String,
|
usage_log_path: String,
|
||||||
pub openweathermap_key: String,
|
pub openweathermap_key: String,
|
||||||
wordpress_key: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn config(rocket: Rocket<Build>) -> Rocket<Build> {
|
pub fn config(rocket: Rocket<Build>) -> Rocket<Build> {
|
||||||
@ -224,7 +194,6 @@ pub fn config(rocket: Rocket<Build>) -> Rocket<Build> {
|
|||||||
.mount("/", routes![index, steering, impressum])
|
.mount("/", routes![index, steering, impressum])
|
||||||
.mount("/auth", auth::routes())
|
.mount("/auth", auth::routes())
|
||||||
.mount("/wikiauth", routes![wikiauth])
|
.mount("/wikiauth", routes![wikiauth])
|
||||||
.mount("/new-blogpost", routes![new_blogpost])
|
|
||||||
.mount("/log", log::routes())
|
.mount("/log", log::routes())
|
||||||
.mount("/planned", planned::routes())
|
.mount("/planned", planned::routes())
|
||||||
.mount("/ergo", ergo::routes())
|
.mount("/ergo", ergo::routes())
|
||||||
|
@ -33,13 +33,6 @@
|
|||||||
<div class="mt-1">{{ notification.message | safe }}</div>
|
<div class="mt-1">{{ notification.message | safe }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{% if notification.link %}
|
|
||||||
<a href="{{ notification.link }}" class="inline-block">
|
|
||||||
<button class="btn btn-primary" type="button">
|
|
||||||
🔗
|
|
||||||
</button>
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
{% if not notification.read_at %}
|
{% if not notification.read_at %}
|
||||||
<a href="/notification/{{ notification.id }}/read" class="inline-block">
|
<a href="/notification/{{ notification.id }}/read" class="inline-block">
|
||||||
<button class="btn btn-primary" type="button">
|
<button class="btn btn-primary" type="button">
|
||||||
@ -63,13 +56,6 @@
|
|||||||
<strong>{{ notification.category }}</strong> • {{ notification.created_at | date(format="%d.%m.%Y %H:%M") }}
|
<strong>{{ notification.category }}</strong> • {{ notification.created_at | date(format="%d.%m.%Y %H:%M") }}
|
||||||
</small>
|
</small>
|
||||||
<div class="mt-1">{{ notification.message | safe }}</div>
|
<div class="mt-1">{{ notification.message | safe }}</div>
|
||||||
{% if notification.link %}
|
|
||||||
<a href="{{ notification.link }}" class="inline-block">
|
|
||||||
<button class="btn btn-primary" type="button">
|
|
||||||
🔗
|
|
||||||
</button>
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user