rust bertsio berritzea

This commit is contained in:
2026-09-26 16:05:44 +01:00
parent 2fb52dc594
commit 3aee14852a
9 changed files with 85 additions and 6 deletions
+1
View File
@@ -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"]
+57
View File
@@ -0,0 +1,57 @@
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/
CMD ["plume"]
EXPOSE 7878
+1
View File
@@ -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 {
+2 -1
View File
@@ -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>()?);
+1
View File
@@ -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};
+18 -2
View File
@@ -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())
+2 -1
View File
@@ -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")));
} }
)* )*
-1
View File
@@ -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
View File
@@ -1 +1,3 @@
nightly-2024-08-30 [toolchain]
#channel = "nightly-2025-08-01"
channel = "nightly-2024-08-30"