Fix the SQlite build

This commit is contained in:
Bat
2018-09-27 22:06:40 +01:00
committed by Igor Galić
parent 535c68b423
commit 743620eb6a
20 changed files with 142 additions and 114 deletions
+2 -2
View File
@@ -1,10 +1,10 @@
use activitypub::{activity::{Announce, Create, Delete, Like, Undo, Update}, object::Tombstone};
use diesel::PgConnection;
use failure::Error;
use serde_json;
use plume_common::activity_pub::{Id, inbox::{Deletable, FromActivity, InboxError}};
use plume_models::{
Connection,
comments::Comment,
follows::Follow,
instance::Instance,
@@ -15,7 +15,7 @@ use plume_models::{
};
pub trait Inbox {
fn received(&self, conn: &PgConnection, act: serde_json::Value) -> Result<(), Error> {
fn received(&self, conn: &Connection, act: serde_json::Value) -> Result<(), Error> {
let actor_id = Id::new(act["actor"].as_str().unwrap_or_else(|| act["actor"]["id"].as_str().expect("No actor ID for incoming activity")));
match act["type"].as_str() {
Some(t) => {
+2 -3
View File
@@ -1,5 +1,4 @@
use atom_syndication::{ContentBuilder, Entry, EntryBuilder, LinkBuilder, Person, PersonBuilder};
use diesel::PgConnection;
use rocket::{
http::uri::{FromUriParam, UriDisplay},
response::NamedFile
@@ -9,7 +8,7 @@ use std::{
path::{Path, PathBuf}
};
use plume_models::posts::Post;
use plume_models::{Connection, posts::Post};
macro_rules! may_fail {
($account:expr, $expr:expr, $template:expr, $msg:expr, | $res:ident | $block:block) => {
@@ -79,7 +78,7 @@ impl Page {
}
}
pub fn post_to_atom(post: Post, conn: &PgConnection) -> Entry {
pub fn post_to_atom(post: Post, conn: &Connection) -> Entry {
EntryBuilder::default()
.title(post.title.clone())
.content(ContentBuilder::default()
+6 -5
View File
@@ -1,5 +1,5 @@
use colored::Colorize;
use diesel::{pg::PgConnection, r2d2::{ConnectionManager, Pool}};
use diesel::r2d2::{ConnectionManager, Pool};
use dotenv::dotenv;
use std::fs::{self, File};
use std::io;
@@ -9,21 +9,22 @@ use rpassword;
use plume_models::safe_string::SafeString;
use plume_models::{
Connection,
DB_URL,
db_conn::{DbConn, PgPool},
db_conn::{DbConn, DbPool},
instance::*,
users::*
};
/// Initializes a database pool.
fn init_pool() -> Option<PgPool> {
fn init_pool() -> Option<DbPool> {
dotenv().ok();
let manager = ConnectionManager::<PgConnection>::new(DB_URL.as_str());
let manager = ConnectionManager::<Connection>::new(DB_URL.as_str());
Pool::new(manager).ok()
}
pub fn check() -> PgPool {
pub fn check() -> DbPool {
if let Some(pool) = init_pool() {
match pool.get() {
Ok(conn) => {