Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
939c8a75d2 | ||
|
|
a3fcfffef2 | ||
|
|
3aee14852a |
@@ -76,6 +76,7 @@ debug-mailer = []
|
||||
test = []
|
||||
search-lindera = ["plume-models/search-lindera"]
|
||||
s3 = ["plume-models/s3"]
|
||||
cargo-clippy = []
|
||||
|
||||
[workspace]
|
||||
members = ["plume-api", "plume-cli", "plume-models", "plume-common", "plume-front", "plume-macro"]
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
FROM rust:1.82 AS builder
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
gettext \
|
||||
postgresql-client \
|
||||
libpq-dev \
|
||||
git \
|
||||
curl \
|
||||
gcc \
|
||||
make \
|
||||
openssl \
|
||||
libssl-dev \
|
||||
clang
|
||||
|
||||
RUN ln -s /usr/bin/python3 /usr/bin/python & \
|
||||
ln -s /usr/bin/pip3 /usr/bin/pip
|
||||
|
||||
WORKDIR /scratch
|
||||
COPY script/wasm-deps.sh .
|
||||
RUN chmod a+x ./wasm-deps.sh && sleep 1 && ./wasm-deps.sh
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
RUN echo "=== TOOLCHAIN ===" && \
|
||||
rustc --version && \
|
||||
cargo --version && \
|
||||
rustup show && \
|
||||
echo "=== TIME-CORE IN LOCK ===" && \
|
||||
grep -A5 -B2 'name = "time-core"' Cargo.lock
|
||||
|
||||
#RUN cargo install wasm-pack
|
||||
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||
RUN chmod a+x ./script/plume-front.sh && sleep 1 && ./script/plume-front.sh
|
||||
|
||||
RUN cargo install --locked --path ./ --force --no-default-features --features postgres
|
||||
RUN cargo install --locked --path plume-cli --force --no-default-features --features postgres
|
||||
#RUN cargo install --path ./ --force --no-default-features --features postgres
|
||||
#RUN cargo install --path plume-cli --force --no-default-features --features postgres
|
||||
RUN cargo clean
|
||||
|
||||
FROM debian:stable-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
libpq5
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app /app
|
||||
COPY --from=builder /usr/local/cargo/bin/plm /bin/
|
||||
COPY --from=builder /usr/local/cargo/bin/plume /bin/
|
||||
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod 755 /usr/local/bin/entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
CMD ["plume"]
|
||||
|
||||
EXPOSE 7878
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
ENV_FILE=/app/.env
|
||||
|
||||
cat > "$ENV_FILE" <<EOF
|
||||
BASE_URL=blog.lainoa.eus
|
||||
ROCKET_SECRET_KEY=${ROCKET_SECRET_KEY}
|
||||
|
||||
MAIL_SERVER=smtp.lainoa.eus
|
||||
MAIL_USER=aitzol
|
||||
MAIL_PASSWORD=${EMAIL_PASSWORD}
|
||||
|
||||
POSTGRES_USER=plume
|
||||
POSTGRES_DB=plume
|
||||
POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
|
||||
DATABASE_URL=postgres://plume:${POSTGRES_PASSWORD}@postgres:5432/plume
|
||||
MIGRATION_DIRECTORY=migrations/postgres
|
||||
USE_HTTPS=1
|
||||
ROCKET_ADDRESS=0.0.0.0
|
||||
ROCKET_PORT=7878
|
||||
|
||||
LDAP_ADDR=ldaps://ldap.lainoa.eus:636
|
||||
LDAP_BASE_DN=cn=users,ou=groups,dc=ldap,dc=lainoa,dc=eus
|
||||
LDAP_USER_NAME_ATTR=uid
|
||||
LDAP_USER_MAIL_ATTR=mail
|
||||
LDAP_TLS=true
|
||||
LDAP_USER=cn=readonly,dc=ldap,dc=lainoa,dc=eus
|
||||
LDAP_PASSWORD=${LDAP_PASSWORD}
|
||||
|
||||
RUST_BACTRACE=1
|
||||
|
||||
EOF
|
||||
|
||||
chmod 600 "$ENV_FILE"
|
||||
|
||||
exec "$@"
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::{schema::apps, Error, Result};
|
||||
use chrono::NaiveDateTime;
|
||||
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl};
|
||||
use serde_derive::Serialize;
|
||||
|
||||
#[derive(Clone, Queryable, Serialize)]
|
||||
pub struct App {
|
||||
|
||||
@@ -136,7 +136,8 @@ impl Comment {
|
||||
|id| Comment::get(conn, id).map(|comment| comment.ap_url.unwrap_or_default()),
|
||||
)?);
|
||||
note.set_published(
|
||||
OffsetDateTime::from_unix_timestamp_nanos(self.creation_date.timestamp_nanos_opt().unwrap().into())
|
||||
//EZABATU OffsetDateTime::from_unix_timestamp_nanos(self.creation_date.timestamp_nanos_opt().unwrap().into())
|
||||
OffsetDateTime::from_unix_timestamp_nanos(self.creation_date.and_utc().timestamp_nanos_opt().unwrap().into())
|
||||
.expect("OffsetDateTime"),
|
||||
);
|
||||
note.set_attributed_to(author.into_id().parse::<IriString>()?);
|
||||
|
||||
@@ -5,6 +5,7 @@ use rocket::config::Limits;
|
||||
use rocket::Config as RocketConfig;
|
||||
use std::collections::HashSet;
|
||||
use std::env::{self, var};
|
||||
use serde_derive::Serialize;
|
||||
|
||||
#[cfg(feature = "s3")]
|
||||
use s3::{Bucket, Region, creds::Credentials};
|
||||
|
||||
@@ -12,7 +12,7 @@ use activitystreams::{
|
||||
prelude::*,
|
||||
time::OffsetDateTime,
|
||||
};
|
||||
use chrono::{NaiveDateTime, Utc};
|
||||
use chrono::{DateTime, NaiveDateTime, Utc};
|
||||
use diesel::{self, BelongingToDsl, ExpressionMethods, QueryDsl, RunQueryDsl};
|
||||
use once_cell::sync::Lazy;
|
||||
use plume_common::{
|
||||
@@ -373,7 +373,8 @@ impl Post {
|
||||
}))?;
|
||||
article.set_source(source);
|
||||
article.set_published(
|
||||
OffsetDateTime::from_unix_timestamp_nanos(self.creation_date.timestamp_nanos_opt().unwrap().into())
|
||||
//EZABATU OffsetDateTime::from_unix_timestamp_nanos(self.creation_date.timestamp_nanos_opt().unwrap().into())
|
||||
OffsetDateTime::from_unix_timestamp_nanos(self.creation_date.and_utc().timestamp_nanos_opt().unwrap().into())
|
||||
.expect("OffsetDateTime"),
|
||||
);
|
||||
article.set_summary(&*self.subtitle);
|
||||
@@ -752,6 +753,20 @@ impl FromId<Connection> for Post {
|
||||
license,
|
||||
// FIXME: This is wrong: with this logic, we may use the display URL as the AP ID. We need two different fields
|
||||
ap_url,
|
||||
creation_date: article.published().map(|published| {
|
||||
let timestamp_secs = published.unix_timestamp();
|
||||
let timestamp_nanos = published.unix_timestamp_nanos()
|
||||
- (timestamp_secs as i128) * 1000i128 * 1000i128 * 1000i128;
|
||||
|
||||
DateTime::from_timestamp(
|
||||
timestamp_secs,
|
||||
timestamp_nanos as u32,
|
||||
)
|
||||
.unwrap()
|
||||
.naive_utc()
|
||||
}),
|
||||
/*
|
||||
EZABATU
|
||||
creation_date: article.published().map(|published| {
|
||||
let timestamp_secs = published.unix_timestamp();
|
||||
let timestamp_nanos = published.unix_timestamp_nanos()
|
||||
@@ -762,6 +777,7 @@ impl FromId<Connection> for Post {
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
*/
|
||||
subtitle: article
|
||||
.summary()
|
||||
.and_then(|summary| summary.to_as_string())
|
||||
|
||||
@@ -93,7 +93,8 @@ macro_rules! gen_to_string {
|
||||
}
|
||||
)*
|
||||
$(
|
||||
for val in &$self.$date {
|
||||
//for val in &$self.$date {
|
||||
if let Some(val) = &$self.$date {
|
||||
$result.push_str(&format!("{}:{} ", stringify!($date), NaiveDate::from_num_days_from_ce_opt(*val as i32).unwrap().format("%Y-%m-%d")));
|
||||
}
|
||||
)*
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::{
|
||||
};
|
||||
use diesel::{self, BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl};
|
||||
use std::cmp::Ordering;
|
||||
use std::ops::Deref;
|
||||
|
||||
pub(crate) mod query;
|
||||
|
||||
|
||||
+3
-1
@@ -1 +1,3 @@
|
||||
nightly-2024-08-30
|
||||
[toolchain]
|
||||
#channel = "nightly-2025-08-01"
|
||||
channel = "nightly-2024-08-30"
|
||||
|
||||
+1
-1
@@ -256,7 +256,7 @@ Then try to restart Plume.
|
||||
routes::errors::server_error
|
||||
])
|
||||
.manage(Arc::new(Mutex::new(mail)))
|
||||
.manage::<Arc<Mutex<Vec<routes::session::ResetRequest>>>>(Arc::new(Mutex::new(vec![])))
|
||||
//EZABATU 20260927 .manage::<Arc<Mutex<Vec<routes::session::ResetRequest>>>>(Arc::new(Mutex::new(vec![])))
|
||||
.manage(dbpool)
|
||||
.manage(Arc::new(workpool))
|
||||
.manage(searcher)
|
||||
|
||||
@@ -11,7 +11,7 @@ use rocket_i18n::I18n;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
sync::{Arc, Mutex},
|
||||
time::Instant,
|
||||
// EZABATU 20260927 time::Instant,
|
||||
};
|
||||
use tracing::warn;
|
||||
use validator::{Validate, ValidationError, ValidationErrors};
|
||||
@@ -117,6 +117,7 @@ pub fn delete(mut cookies: Cookies<'_>, intl: I18n) -> Flash<Redirect> {
|
||||
)
|
||||
}
|
||||
|
||||
/* EZABATU 20260927
|
||||
#[derive(Clone)]
|
||||
pub struct ResetRequest {
|
||||
pub mail: String,
|
||||
@@ -129,6 +130,7 @@ impl PartialEq for ResetRequest {
|
||||
self.id == other.id
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[get("/password-reset")]
|
||||
pub fn password_reset_request_form(conn: DbConn, rockets: PlumeRocket) -> Ructe {
|
||||
|
||||
Reference in New Issue
Block a user