Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
939c8a75d2 | ||
|
|
a3fcfffef2 | ||
|
|
3aee14852a | ||
|
|
2fb52dc594 | ||
|
|
e2c9e8000a |
@@ -76,6 +76,7 @@ debug-mailer = []
|
|||||||
test = []
|
test = []
|
||||||
search-lindera = ["plume-models/search-lindera"]
|
search-lindera = ["plume-models/search-lindera"]
|
||||||
s3 = ["plume-models/s3"]
|
s3 = ["plume-models/s3"]
|
||||||
|
cargo-clippy = []
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["plume-api", "plume-cli", "plume-models", "plume-common", "plume-front", "plume-macro"]
|
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
|
||||||
+3
-2
@@ -13,11 +13,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
libssl-dev \
|
libssl-dev \
|
||||||
clang
|
clang
|
||||||
|
|
||||||
|
RUN ln -s /usr/bin/python3 /usr/bin/python & \
|
||||||
|
ln -s /usr/bin/pip3 /usr/bin/pip
|
||||||
|
|
||||||
WORKDIR /scratch
|
WORKDIR /scratch
|
||||||
COPY script/wasm-deps.sh .
|
COPY script/wasm-deps.sh .
|
||||||
RUN chmod a+x ./wasm-deps.sh && sleep 1 && ./wasm-deps.sh
|
RUN chmod a+x ./wasm-deps.sh && sleep 1 && ./wasm-deps.sh
|
||||||
RUN ln -s /usr/bin/python3 /usr/bin/python & \
|
|
||||||
ln -s /usr/bin/pip3 /usr/bin/pip
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|||||||
@@ -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 crate::{schema::apps, Error, Result};
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl};
|
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl};
|
||||||
|
use serde_derive::Serialize;
|
||||||
|
|
||||||
#[derive(Clone, Queryable, Serialize)]
|
#[derive(Clone, Queryable, Serialize)]
|
||||||
pub struct App {
|
pub struct App {
|
||||||
|
|||||||
@@ -136,7 +136,8 @@ impl Comment {
|
|||||||
|id| Comment::get(conn, id).map(|comment| comment.ap_url.unwrap_or_default()),
|
|id| Comment::get(conn, id).map(|comment| comment.ap_url.unwrap_or_default()),
|
||||||
)?);
|
)?);
|
||||||
note.set_published(
|
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"),
|
.expect("OffsetDateTime"),
|
||||||
);
|
);
|
||||||
note.set_attributed_to(author.into_id().parse::<IriString>()?);
|
note.set_attributed_to(author.into_id().parse::<IriString>()?);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use rocket::config::Limits;
|
|||||||
use rocket::Config as RocketConfig;
|
use rocket::Config as RocketConfig;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::env::{self, var};
|
use std::env::{self, var};
|
||||||
|
use serde_derive::Serialize;
|
||||||
|
|
||||||
#[cfg(feature = "s3")]
|
#[cfg(feature = "s3")]
|
||||||
use s3::{Bucket, Region, creds::Credentials};
|
use s3::{Bucket, Region, creds::Credentials};
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use activitystreams::{
|
|||||||
prelude::*,
|
prelude::*,
|
||||||
time::OffsetDateTime,
|
time::OffsetDateTime,
|
||||||
};
|
};
|
||||||
use chrono::{NaiveDateTime, Utc};
|
use chrono::{DateTime, NaiveDateTime, Utc};
|
||||||
use diesel::{self, BelongingToDsl, ExpressionMethods, QueryDsl, RunQueryDsl};
|
use diesel::{self, BelongingToDsl, ExpressionMethods, QueryDsl, RunQueryDsl};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use plume_common::{
|
use plume_common::{
|
||||||
@@ -373,7 +373,8 @@ impl Post {
|
|||||||
}))?;
|
}))?;
|
||||||
article.set_source(source);
|
article.set_source(source);
|
||||||
article.set_published(
|
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"),
|
.expect("OffsetDateTime"),
|
||||||
);
|
);
|
||||||
article.set_summary(&*self.subtitle);
|
article.set_summary(&*self.subtitle);
|
||||||
@@ -752,6 +753,20 @@ impl FromId<Connection> for Post {
|
|||||||
license,
|
license,
|
||||||
// FIXME: This is wrong: with this logic, we may use the display URL as the AP ID. We need two different fields
|
// FIXME: This is wrong: with this logic, we may use the display URL as the AP ID. We need two different fields
|
||||||
ap_url,
|
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| {
|
creation_date: article.published().map(|published| {
|
||||||
let timestamp_secs = published.unix_timestamp();
|
let timestamp_secs = published.unix_timestamp();
|
||||||
let timestamp_nanos = published.unix_timestamp_nanos()
|
let timestamp_nanos = published.unix_timestamp_nanos()
|
||||||
@@ -762,6 +777,7 @@ impl FromId<Connection> for Post {
|
|||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}),
|
}),
|
||||||
|
*/
|
||||||
subtitle: article
|
subtitle: article
|
||||||
.summary()
|
.summary()
|
||||||
.and_then(|summary| summary.to_as_string())
|
.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")));
|
$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 diesel::{self, BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::ops::Deref;
|
|
||||||
|
|
||||||
pub(crate) mod query;
|
pub(crate) mod query;
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -1 +1,3 @@
|
|||||||
nightly-2024-07-19
|
[toolchain]
|
||||||
|
#channel = "nightly-2025-08-01"
|
||||||
|
channel = "nightly-2024-08-30"
|
||||||
|
|||||||
+1
-25
@@ -21,29 +21,5 @@ EOF
|
|||||||
echo "Detected arch: $ARCH"
|
echo "Detected arch: $ARCH"
|
||||||
|
|
||||||
if [ $ARCH == "aarch64" -o $ARCH == "armv71" ] ; then
|
if [ $ARCH == "aarch64" -o $ARCH == "armv71" ] ; then
|
||||||
apt-get install -y --no-install-recommends build-essential subversion ninja-build cmake
|
apt-get install -y --no-install-recommends build-essential cmake llvm lld
|
||||||
mkdir -p /scratch/src
|
|
||||||
cd /scratch/src
|
|
||||||
svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_900/final/ llvm
|
|
||||||
cd /scratch/src/llvm/tools
|
|
||||||
svn co http://llvm.org/svn/llvm-project/lld/tags/RELEASE_900/final/ lld
|
|
||||||
mkdir -p /scratch/build/arm
|
|
||||||
cd /scratch/build/arm
|
|
||||||
if [ "$ARCH" == "aarch64" ] ; then
|
|
||||||
cmake -G Ninja /scratch/src/llvm \
|
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=/opt/local/llvm \
|
|
||||||
-DLLVM_TARGETS_TO_BUILD="AArch64" \
|
|
||||||
-DLLVM_TARGET_ARCH="AArch64"
|
|
||||||
else
|
|
||||||
cmake -G Ninja /scratch/src/llvm \
|
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=/opt/local/llvm \
|
|
||||||
-DLLVM_TARGETS_TO_BUILD="ARM" \
|
|
||||||
-DLLVM_TARGET_ARCH="ARM"
|
|
||||||
fi
|
|
||||||
ninja lld
|
|
||||||
ninja install-lld
|
|
||||||
cd ~
|
|
||||||
rm -rf /scratch
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
+1
-1
@@ -256,7 +256,7 @@ Then try to restart Plume.
|
|||||||
routes::errors::server_error
|
routes::errors::server_error
|
||||||
])
|
])
|
||||||
.manage(Arc::new(Mutex::new(mail)))
|
.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(dbpool)
|
||||||
.manage(Arc::new(workpool))
|
.manage(Arc::new(workpool))
|
||||||
.manage(searcher)
|
.manage(searcher)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use rocket_i18n::I18n;
|
|||||||
use std::{
|
use std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
time::Instant,
|
// EZABATU 20260927 time::Instant,
|
||||||
};
|
};
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
use validator::{Validate, ValidationError, ValidationErrors};
|
use validator::{Validate, ValidationError, ValidationErrors};
|
||||||
@@ -54,7 +54,7 @@ pub fn create(
|
|||||||
Ok(_) => ValidationErrors::new(),
|
Ok(_) => ValidationErrors::new(),
|
||||||
Err(e) => e,
|
Err(e) => e,
|
||||||
};
|
};
|
||||||
let user = User::login(&conn, &form.email_or_name, &form.password);
|
let user = User::login(&conn, &form.email_or_name.to_lowercase(), &form.password);
|
||||||
let user_id = if let Ok(user) = user {
|
let user_id = if let Ok(user) = user {
|
||||||
user.id.to_string()
|
user.id.to_string()
|
||||||
} else {
|
} else {
|
||||||
@@ -117,6 +117,7 @@ pub fn delete(mut cookies: Cookies<'_>, intl: I18n) -> Flash<Redirect> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* EZABATU 20260927
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct ResetRequest {
|
pub struct ResetRequest {
|
||||||
pub mail: String,
|
pub mail: String,
|
||||||
@@ -129,6 +130,7 @@ impl PartialEq for ResetRequest {
|
|||||||
self.id == other.id
|
self.id == other.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#[get("/password-reset")]
|
#[get("/password-reset")]
|
||||||
pub fn password_reset_request_form(conn: DbConn, rockets: PlumeRocket) -> Ructe {
|
pub fn password_reset_request_form(conn: DbConn, rockets: PlumeRocket) -> Ructe {
|
||||||
|
|||||||
Reference in New Issue
Block a user