Compare commits

..

2 Commits

Author SHA1 Message Date
Trinity Pointard f0ca7ccde8 attempt to add support for ldap
Blind attempt
Don't create account for existing ldap that is unknown yet
Include connection pooling
2019-08-16 19:06:07 +02:00
Trinity Pointard 7fd1fe6d52 refactor login
refactor login so it's self contained in a single function
will be useful in adding other password based login method such as ldap
2019-08-16 19:06:06 +02:00
477 changed files with 24292 additions and 31322 deletions
+2 -3
View File
@@ -10,7 +10,7 @@ executors:
type: boolean
default: false
docker:
- image: plumeorg/plume-buildenv:v0.0.9
- image: plumeorg/plume-buildenv:v0.0.7
- image: <<#parameters.postgres>>circleci/postgres:9.6-alpine<</parameters.postgres>><<^parameters.postgres>>alpine:latest<</parameters.postgres>>
environment:
POSTGRES_USER: postgres
@@ -82,7 +82,7 @@ commands:
type: string
steps:
- run: zip -0 ccov.zip `find . -name 'plume*.gc*' -o -name 'plm*.gc*'`
- run: grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore '/*' -o lcov.info
- run: grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore-dir '/*' -o lcov.info
- run: bash <(curl -s https://codecov.io/bash) -f lcov.info -F <<parameters.type>>
- run: find . -name 'plume*.gc*' -delete -o -name 'plm*.gc*' -delete
- run: rm ccov.zip lcov.info
@@ -226,7 +226,6 @@ jobs:
steps:
- restore_env:
cache: none
- run: cargo build
- run: crowdin upload -b master
workflows:
+1 -1
View File
@@ -1,5 +1,5 @@
localhost:443 {
proxy / integration:7878 {
proxy / localhost:7878 {
transparent
}
tls self_signed
+2 -2
View File
@@ -4,11 +4,11 @@ ENV PATH="/root/.cargo/bin:${PATH}"
#install native/circleci/build dependancies
RUN apt update &&\
apt install -y --no-install-recommends git ssh tar gzip ca-certificates default-jre&&\
apt install -y --no-install-recommends binutils-dev build-essential cmake curl gcc gettext git libcurl4-openssl-dev libdw-dev libelf-dev libiberty-dev libpq-dev libsqlite3-dev libssl-dev make openssl pkg-config postgresql postgresql-contrib python zlib1g-dev python3-pip zip unzip libclang-dev&&\
apt install -y --no-install-recommends binutils-dev build-essential cmake curl gcc gettext git libcurl4-openssl-dev libdw-dev libelf-dev libiberty-dev libpq-dev libsqlite3-dev libssl-dev make openssl pkg-config postgresql postgresql-contrib python zlib1g-dev python3-pip zip unzip &&\
rm -rf /var/lib/apt/lists/*
#install and configure rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2020-01-15 -y &&\
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2019-03-23 -y &&\
rustup component add rustfmt clippy &&\
rustup component add rust-std --target wasm32-unknown-unknown
-233
View File
@@ -1,233 +0,0 @@
// This is the CI config for Plume.
// It uses a Drone CI instance, on https://ci.joinplu.me
// First of all, we define a few useful constants
// This Docker image contains everything we need to build Plume.
// Its Dockerfile can be found at https://git.joinplu.me/plume/buildenv
local plumeEnv = "plumeorg/plume-buildenv:v0.2.0";
// Common cache config
local cacheConfig(name, extra) = {
name: name,
image: "meltwater/drone-cache:dev",
pull: true,
environment: {
AWS_ACCESS_KEY_ID: { from_secret: 'minio_key' },
AWS_SECRET_ACCESS_KEY: { from_secret: 'minio_secret' },
},
settings: extra + {
cache_key: 'v0-{{ checksum "Cargo.lock" }}-{{ .Commit.Branch }}',
archive_format: "gzip",
mount: [ "~/.cargo/", "./target" ],
bucket: 'cache',
path_style: true,
endpoints: "127.0.0.1:9000",
region: 'us-east-1',
debug: true,
},
volumes: [ { name: "cache", path: "/tmp/cache" } ]
};
// A pipeline step that restores the cache.
// The cache contains all the cargo build files.
// Thus, we don't have to download and compile all of our dependencies for each
// commit.
// This cache is only "deleted" when the contents of Cargo.lock changes.
//
// We use this plugin for caching: https://github.com/meltwater/drone-cache/
//
// Potential TODO: use one cache per pipeline, as we used to do when we were
// using CircleCI.
local restoreCache = cacheConfig("restore-cache", { restore: true });
// And a step that saves the cache.
local saveCache = cacheConfig("save-cache", { rebuild: true });
// This step starts a PostgreSQL database if the db parameter is "postgres",
// otherwise it does nothing.
local startDb(db) = if db == "postgres" then {
name: "start-db",
image: "postgres:12.3-alpine",
detach: true,
environment: {
POSTGRES_USER: "plume",
POSTGRES_DB: "plume",
POSTGRES_PASSWORD: "password",
}
} else {};
// A utility function to generate a new pipeline
local basePipeline(name, steps) = {
kind: "pipeline",
name: name,
type: "docker",
environment: {
RUST_TEST_THREADS: '1',
},
steps: steps
};
// And this function creates a pipeline with caching
local cachedPipeline(name, commands) = basePipeline(
name,
[
restoreCache,
{
name: name,
image: plumeEnv,
commands: commands,
},
saveCache
]
);
// This function creates a step to upload artifacts to Minio
local upload(name, source) = {
name: name,
image: 'plugins/s3',
settings: {
bucket: 'artifacts',
source: source,
target: '/${DRONE_BUILD_NUMBER}',
path_style: true,
endpoint: 'http://127.0.0.1:9000',
access_key: { from_secret: 'minio_key' },
secret_key: { from_secret: 'minio_secret' },
},
};
// Here starts the actual list of pipelines!
// PIPELINE 1: a pipeline that runs cargo fmt, and that fails if the style of
// the code is not standard.
local CargoFmt() = cachedPipeline(
"cargo-fmt",
[ "cargo fmt --all -- --check" ]
);
// PIPELINE 2: runs clippy, a tool that helps
// you writing idiomatic Rust.
// Helper function:
local cmd(db, pkg, features=true) = if features then
"cargo clippy --no-default-features --features " + db + " --release -p "
+ pkg + " -- -D warnings"
else
"cargo clippy --no-default-features --release -p "
+ pkg + " -- -D warnings";
// The actual pipeline:
local Clippy(db) = cachedPipeline(
"clippy-" + db,
[
cmd(db, "plume"),
cmd(db, "plume-cli"),
cmd(db, "plume-front", false)
]
);
// PIPELINE 3: runs unit tests
local Unit(db) = cachedPipeline(
"unit-" + db,
[
"cargo test --all --exclude plume-front --exclude plume-macro"
+ " --no-run --no-default-features --features=" + db
]
);
// PIPELINE 4: runs integration tests
// It installs a local instance an run integration test with Python scripts
// that use Selenium (located in scripts/browser_test).
local Integration(db) = basePipeline(
"integration-" + db,
[
restoreCache,
startDb(db),
{
name: 'selenium',
image: 'elgalu/selenium:latest',
detach: true,
},
{
name: "integration",
image: plumeEnv,
environment: {
BROWSER: "firefox",
DATABASE_URL: if db == "postgres" then "postgres://plume:password@start-db/plume" else "plume.db",
},
commands: [
// Install the front-end
"cargo web deploy -p plume-front",
// Install the server
'cargo install --debug --no-default-features --features="'
+ db + '",test --force --path .',
// Install plm
'cargo install --debug --no-default-features --features="'
+ db + '" --force --path plume-cli',
// Run the tests
"./script/run_browser_test.sh"
],
},
saveCache,
]
);
// PIPELINE 5: make a release build and save artifacts
//
// It should also deploy the SQlite build to a test instance
// located at https://pr-XXX.joinplu.me (but this system is not very
// stable, and often breaks).
local Release(db) = basePipeline(
"release-" + db,
[
restoreCache,
{
name: 'release-' + db,
image: plumeEnv,
commands: [
"cargo web deploy -p plume-front --release",
"cargo build --release --no-default-features --features=" + db + " -p plume",
"cargo build --release --no-default-features --features=" + db + " -p plume-cli",
"./script/generate_artifact.sh",
] + if db == "sqlite" then
[ "./script/upload_test_environment.sh" ] else
[]
},
upload('artifacts-' + db, '*.tar.gz'),
saveCache,
]
);
// PIPELINE 6: upload the new PO templates (.pot) to Crowdin
//
// TODO: run only on master
local PushTranslations() = basePipeline(
"push-translations",
[
{
name: "push-translations",
image: plumeEnv,
commands: [
"cargo build",
"crowdin upload -b master"
]
}
]
);
// And finally, the list of all our pipelines:
[
CargoFmt(),
Clippy("postgres"),
Clippy("sqlite"),
Unit("postgres"),
Unit("sqlite"),
Integration("postgres"),
Integration("sqlite"),
Release("postgres"),
Release("sqlite"),
PushTranslations()
]
-47
View File
@@ -1,47 +0,0 @@
# This file contains your instance configuration
# Some documentation about these variables is available here:
# https://docs.joinplu.me/environment/
## GENERAL SETTINGS ##
# The directory containing database migrations
# For Postgres: migrations/postgres
# For SQlite: migrations/sqlite
MIGRATION_DIRECTORY=migrations/postgres
# The URL of your database (or its path for SQlite databases)
DATABASE_URL=postgres://plume:plume@localhost/plume
# The domain of your instance
BASE_URL=plu.me
# The secret key for private cookies and CSRF protection
# You can generate one with `openssl rand -base64 32`
ROCKET_SECRET_KEY=
# Port and address which Plume will use
ROCKET_PORT=7878
ROCKET_ADDRESS=127.0.0.1
## MAIL CONFIG ##
#MAIL_SERVER=smtp.plu.me
#MAIL_ADDRESS=no-reply@plu.me
#MAIL_USER=plume
#MAIL_PASSWORD=
#MAIL_HELO_NAME=no-reply@plu.me
## ADVANCED OPTIONS ##
#MEDIA_UPLOAD_DIRECTORY=static/media
#SEARCH_INDEX=search_index
# Sample logo configuration
#PLUME_LOGO=icons/trwnh/paragraphs/plumeParagraphs.svg
#PLUME_LOGO_FAVICON=icons/trwnh/paragraphs/plumeParagraphs32.png
#PLUME_LOGO_48=icons/trwnh/paragraphs/plumeParagraphs48.png
#PLUME_LOGO_72=icons/trwnh/paragraphs/plumeParagraphs72.png
#PLUME_LOGO_96=icons/trwnh/paragraphs/plumeParagraphs96.png
#PLUME_LOGO_144=icons/trwnh/paragraphs/plumeParagraphs144.png
#PLUME_LOGO_160=icons/trwnh/paragraphs/plumeParagraphs160.png
#PLUME_LOGO_192=icons/trwnh/paragraphs/plumeParagraphs192.png
#PLUME_LOGO_256=icons/trwnh/paragraphs/plumeParagraphs256.png
#PLUME_LOGO_512=icons/trwnh/paragraphs/plumeParagraphs512.png
+4 -1
View File
@@ -7,7 +7,7 @@ translations
.env
Rocket.toml
!.gitkeep
static
static/media
docker-compose.yml
*.db
*.sqlite
@@ -16,5 +16,8 @@ docker-compose.yml
tags.*
!tags.rs
search_index
main.css
*.wasm
*.js
.buildconfig
__pycache__
Generated
+1388 -2106
View File
File diff suppressed because it is too large Load Diff
+13 -15
View File
@@ -1,9 +1,8 @@
[package]
authors = ["Plume contributors"]
name = "plume"
version = "0.4.0"
version = "0.3.0"
repository = "https://github.com/Plume-org/Plume"
edition = "2018"
[dependencies]
activitypub = "0.1.3"
@@ -17,22 +16,22 @@ gettext-macros = { git = "https://github.com/Plume-org/gettext-macros/", rev = "
gettext-utils = { git = "https://github.com/Plume-org/gettext-macros/", rev = "a7c605f7edd6bfbfbfe7778026bfefd88d82db10" }
guid-create = "0.1"
heck = "0.3.0"
lettre = "0.9.2"
lettre_email = "0.9.2"
num_cpus = "1.10"
rocket = "0.4.2"
rocket_contrib = { version = "0.4.2", features = ["json"] }
lettre = { git = "https://github.com/lettre/lettre", rev = "c988b1760ad8179d9e7f3fb8594d2b86cf2a0a49" }
lettre_email = { git = "https://github.com/lettre/lettre", rev = "c988b1760ad8179d9e7f3fb8594d2b86cf2a0a49" }
num_cpus = "1.0"
rocket = "0.4.0"
rocket_contrib = { version = "0.4.0", features = ["json"] }
rocket_i18n = { git = "https://github.com/Plume-org/rocket_i18n", rev = "e922afa7c366038b3433278c03b1456b346074f2" }
rpassword = "4.0"
scheduled-thread-pool = "0.2.2"
rpassword = "3.0"
runtime-fmt = "0.3.0"
scheduled-thread-pool = "0.2.0"
serde = "1.0"
serde_json = "1.0"
serde_qs = "0.5"
serde_qs = "0.4"
shrinkwraprs = "0.2.1"
syntect = "3.3"
validator = "0.8"
validator_derive = "0.8"
webfinger = "0.4.1"
webfinger = "0.3.1"
[[bin]]
name = "plume"
@@ -66,10 +65,10 @@ path = "plume-models"
[dependencies.rocket_csrf]
git = "https://github.com/fdb-hiroshima/rocket_csrf"
rev = "29910f2829e7e590a540da3804336577b48c7b31"
rev = "4a72ea2ec716cb0b26188fb00bccf2ef7d1e031c"
[build-dependencies]
ructe = "0.9.0"
ructe = "0.6.2"
rsass = "0.9"
[features]
@@ -78,7 +77,6 @@ postgres = ["plume-models/postgres", "diesel/postgres"]
sqlite = ["plume-models/sqlite", "diesel/sqlite"]
debug-mailer = []
test = []
search-lindera = ["plume-models/search-lindera"]
[workspace]
members = ["plume-api", "plume-cli", "plume-models", "plume-common", "plume-front", "plume-macro"]
+1 -2
View File
@@ -10,8 +10,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
make \
openssl \
libssl-dev \
clang
libssl-dev
WORKDIR /scratch
COPY script/wasm-deps.sh .
+1 -1
View File
@@ -1,5 +1,5 @@
<h1 align="center">
<img src="https://raw.githubusercontent.com/Plume-org/Plume/master/assets/icons/trwnh/feather/plumeFeather64.png" alt="Plume's logo">
<img src="https://raw.githubusercontent.com/Plume-org/Plume/master/static/icons/trwnh/feather/plumeFeather64.png" alt="Plume's logo">
Plume
</h1>
<p align="center">
-3
View File
@@ -1,3 +0,0 @@
* {
font-family: monospace;
}
@@ -1,28 +0,0 @@
@import '_variables';
/* Color Scheme */
$gray: #1a3854;
$black: #102e4a;
$white: #F8F8F8;
$purple: #7765E3;
$lightpurple: #c2bbee;
$red: #d16666;
$yellow: #ff934f;
$blue: #7f96ff;
$background: $black;
$form-input-background: $gray;
$form-input-border: $white;
$text-color: $white;
$primary: $purple;
$primary-text-color: $white; // text color on primary background (buttons for instance)
$success-color: $blue;
//Code Highlighting
$code-keyword-color: #f79ac1;
$code-source-color: #a6f0ab;
$code-constant-color: #dfec84;
$code-operator-color: #eddf95;
$code-string-color: #f2ae60;
$code-comment-color: #a3b4f9;
-37
View File
@@ -1,37 +0,0 @@
/* Color Scheme */
$gray: #f3f3f3;
$black: #242424;
$white: #f8f8f8;
$purple: #7765e3;
$lightpurple: #c2bbee;
$red: #e92f2f;
$yellow: #ffe347;
$green: #23f0c7;
$background: $white;
$form-input-background: white;
$form-input-border: $black;
$text-color: $black;
$primary: $purple;
$primary-text-color: $white; // text color on primary background (buttons for instance)
$success-color: $green;
/* Dimensions */
$article-width: 70ch;
$horizontal-margin: 20%;
$margin: 0 $horizontal-margin;
/* Fonts */
$route159: "Shabnam", "Route159", serif;
$playfair: "Vazir", "Playfair Display", serif;
$lora: "Vazir", "Lora", serif;
//Code Highlighting
$code-keyword-color: #45244a;
$code-source-color: #4c588c;
$code-constant-color: scale-color(magenta, $lightness: -5%);
$code-operator-color: scale-color($code-source-color, $lightness: -5%);
$code-string-color: #8a571c;
$code-comment-color: #1c4c8a;
-14
View File
@@ -1,14 +0,0 @@
/* color palette: https://coolors.co/23f0c7-ef767a-7765e3-6457a6-ffe347 */
@import url("./feather.css");
@import url("./fonts/Route159/Route159.css");
@import url("./fonts/Lora/Lora.css");
@import url("./fonts/Playfair_Display/PlayfairDisplay.css");
@import url("./fonts/Vazir_WOL/Vazir_WOL.css");
@import url("./fonts/Shabnam_WOL/Shabnam_WOL.css");
@import "dark_variables";
@import "global";
@import "header";
@import "article";
@import "forms";
@@ -1,94 +0,0 @@
Copyright (c) 2015, Saber Rastikerdar (saber.rastikerdar@gmail.com),
Glyphs and data from Roboto font are licensed under the Apache License, Version 2.0.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -1,49 +0,0 @@
@font-face {
font-family: Shabnam;
src: url("Shabnam-WOL.eot");
src: url("Shabnam-WOL.eot?#iefix") format("embedded-opentype"),
url("Shabnam-WOL.woff2") format("woff2"),
url("Shabnam-WOL.woff") format("woff"),
url("Shabnam-WOL.ttf") format("truetype");
font-weight: normal;
}
@font-face {
font-family: Shabnam;
src: url("Shabnam-Bold-WOL.eot");
src: url("Shabnam-Bold-WOL.eot?#iefix") format("embedded-opentype"),
url("Shabnam-Bold-WOL.woff2") format("woff2"),
url("Shabnam-Bold-WOL.woff") format("woff"),
url("Shabnam-Bold-WOL.ttf") format("truetype");
font-weight: bold;
}
@font-face {
font-family: Shabnam;
src: url("Shabnam-Thin-WOL.eot");
src: url("Shabnam-Thin-WOL.eot?#iefix") format("embedded-opentype"),
url("Shabnam-Thin-WOL.woff2") format("woff2"),
url("Shabnam-Thin-WOL.woff") format("woff"),
url("Shabnam-Thin-WOL.ttf") format("truetype");
font-weight: 100;
}
@font-face {
font-family: Shabnam;
src: url("Shabnam-Light-WOL.eot");
src: url("Shabnam-Light-WOL.eot?#iefix") format("embedded-opentype"),
url("Shabnam-Light-WOL.woff2") format("woff2"),
url("Shabnam-Light-WOL.woff") format("woff"),
url("Shabnam-Light-WOL.ttf") format("truetype");
font-weight: 300;
}
@font-face {
font-family: Shabnam;
src: url("Shabnam-Medium-WOL.eot");
src: url("Shabnam-Medium-WOL.eot?#iefix") format("embedded-opentype"),
url("Shabnam-Medium-WOL.woff2") format("woff2"),
url("Shabnam-Medium-WOL.woff") format("woff"),
url("Shabnam-Medium-WOL.ttf") format("truetype");
font-weight: 500;
}
@@ -1,51 +0,0 @@
Changes by Saber Rastikerdar (saber.rastikerdar@gmail.com) are in public domain.
Glyphs and data from Roboto font are licensed under the Apache License, Version 2.0.
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
Bitstream Vera Fonts Copyright
------------------------------
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
a trademark of Bitstream, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute the
Font Software, including without limitation the rights to use, copy, merge,
publish, distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to the
following conditions:
The above copyright and trademark notices and this permission notice shall
be included in all copies of one or more of the Font Software typefaces.
The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional glyphs or characters may be added to the Fonts, only if the fonts
are renamed to names not containing either the words "Bitstream" or the word
"Vera".
This License becomes null and void to the extent applicable to Fonts or Font
Software that has been modified and is distributed under the "Bitstream
Vera" names.
The Font Software may be sold as part of a larger software package but no
copy of one or more of the Font Software typefaces may be sold by itself.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
FONT SOFTWARE.
Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font Software
without prior written authorization from the Gnome Foundation or Bitstream
Inc., respectively. For further information, contact: fonts at gnome dot
org.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,65 +0,0 @@
@font-face {
font-family: Vazir;
src: url('Vazir-WOL.eot');
src: url('Vazir-WOL.eot?#iefix') format('embedded-opentype'),
url('Vazir-WOL.woff2') format('woff2'),
url('Vazir-WOL.woff') format('woff'),
url('Vazir-WOL.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: Vazir;
src: url('Vazir-Bold-WOL.eot');
src: url('Vazir-Bold-WOL.eot?#iefix') format('embedded-opentype'),
url('Vazir-Bold-WOL.woff2') format('woff2'),
url('Vazir-Bold-WOL.woff') format('woff'),
url('Vazir-Bold-WOL.ttf') format('truetype');
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: Vazir;
src: url('Vazir-Black-WOL.eot');
src: url('Vazir-Black-WOL.eot?#iefix') format('embedded-opentype'),
url('Vazir-Black-WOL.woff2') format('woff2'),
url('Vazir-Black-WOL.woff') format('woff'),
url('Vazir-Black-WOL.ttf') format('truetype');
font-weight: 900;
font-style: normal;
}
@font-face {
font-family: Vazir;
src: url('Vazir-Medium-WOL.eot');
src: url('Vazir-Medium-WOL.eot?#iefix') format('embedded-opentype'),
url('Vazir-Medium-WOL.woff2') format('woff2'),
url('Vazir-Medium-WOL.woff') format('woff'),
url('Vazir-Medium-WOL.ttf') format('truetype');
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: Vazir;
src: url('Vazir-Light-WOL.eot');
src: url('Vazir-Light-WOL.eot?#iefix') format('embedded-opentype'),
url('Vazir-Light-WOL.woff2') format('woff2'),
url('Vazir-Light-WOL.woff') format('woff'),
url('Vazir-Light-WOL.ttf') format('truetype');
font-weight: 300;
font-style: normal;
}
@font-face {
font-family: Vazir;
src: url('Vazir-Thin-WOL.eot');
src: url('Vazir-Thin-WOL.eot?#iefix') format('embedded-opentype'),
url('Vazir-Thin-WOL.woff2') format('woff2'),
url('Vazir-Thin-WOL.woff') format('woff'),
url('Vazir-Thin-WOL.ttf') format('truetype');
font-weight: 100;
font-style: normal;
}
-14
View File
@@ -1,14 +0,0 @@
/* color palette: https://coolors.co/23f0c7-ef767a-7765e3-6457a6-ffe347 */
@import url("./feather.css");
@import url("./fonts/Route159/Route159.css");
@import url("./fonts/Lora/Lora.css");
@import url("./fonts/Playfair_Display/PlayfairDisplay.css");
@import url("./fonts/Vazir_WOL/Vazir_WOL.css");
@import url("./fonts/Shabnam_WOL/Shabnam_WOL.css");
@import "variables";
@import "global";
@import "header";
@import "article";
@import "forms";
+22 -102
View File
@@ -1,8 +1,8 @@
use rsass;
use ructe::Ructe;
extern crate rsass;
extern crate ructe;
use ructe::*;
use std::process::{Command, Stdio};
use std::{ffi::OsStr, fs::*, io::Write, path::*};
use std::{env, fs::*, io::Write, path::PathBuf};
fn compute_static_hash() -> String {
//"find static/ -type f ! -path 'static/media/*' | sort | xargs stat -c'%n %Y' | openssl dgst -r"
@@ -37,17 +37,25 @@ fn compute_static_hash() -> String {
}
fn main() {
Ructe::from_env()
.expect("This must be run with cargo")
.compile_templates("templates")
.expect("compile templates");
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let in_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("templates");
compile_templates(&in_dir, &out_dir).expect("compile templates");
compile_themes().expect("Theme compilation error");
recursive_copy(&Path::new("assets").join("icons"), &Path::new("static"))
.expect("Couldn't copy icons");
recursive_copy(&Path::new("assets").join("images"), &Path::new("static"))
.expect("Couldn't copy images");
create_dir_all(&Path::new("static").join("media")).expect("Couldn't init media directory");
println!("cargo:rerun-if-changed=static/css/_article.scss");
println!("cargo:rerun-if-changed=static/css/_forms.scss");
println!("cargo:rerun-if-changed=static/css/_global.scss");
println!("cargo:rerun-if-changed=static/css/_header.scss");
println!("cargo:rerun-if-changed=static/css/_variables.scss");
println!("cargo:rerun-if-changed=static/css/main.scss");
let mut out = File::create("static/css/main.css").expect("Couldn't create main.css");
out.write_all(
&rsass::compile_scss_file(
"static/css/main.scss".as_ref(),
rsass::OutputStyle::Compressed,
)
.expect("Error during SCSS compilation"),
)
.expect("Couldn't write CSS output");
let cache_id = &compute_static_hash()[..8];
println!("cargo:rerun-if-changed=target/deploy/plume-front.wasm");
@@ -66,91 +74,3 @@ fn main() {
println!("cargo:rustc-env=CACHE_ID={}", cache_id)
}
fn compile_themes() -> std::io::Result<()> {
let input_dir = Path::new("assets").join("themes");
let output_dir = Path::new("static").join("css");
let themes = find_themes(input_dir)?;
for theme in themes {
compile_theme(&theme, &output_dir)?;
}
Ok(())
}
fn find_themes(path: PathBuf) -> std::io::Result<Vec<PathBuf>> {
let ext = path.extension().and_then(OsStr::to_str);
if metadata(&path)?.is_dir() {
Ok(read_dir(&path)?.fold(vec![], |mut themes, ch| {
if let Ok(ch) = ch {
if let Ok(mut new) = find_themes(ch.path()) {
themes.append(&mut new);
}
}
themes
}))
} else if (ext == Some("scss") || ext == Some("sass"))
&& !path.file_name().unwrap().to_str().unwrap().starts_with('_')
{
Ok(vec![path.clone()])
} else {
Ok(vec![])
}
}
fn compile_theme(path: &Path, out_dir: &Path) -> std::io::Result<()> {
let name = path
.components()
.skip_while(|c| *c != Component::Normal(OsStr::new("themes")))
.skip(1)
.filter_map(|c| {
c.as_os_str()
.to_str()
.unwrap_or_default()
.splitn(2, '.')
.next()
})
.collect::<Vec<_>>()
.join("-");
let dir = path.parent().unwrap();
let out = out_dir.join(name);
create_dir_all(&out)?;
// copy files of the theme that are not scss
for ch in read_dir(&dir)? {
recursive_copy(&ch?.path(), &out)?;
}
// compile the .scss/.sass file
let mut out = File::create(out.join("theme.css"))?;
out.write_all(
&rsass::compile_scss_file(path, rsass::OutputStyle::Compressed)
.expect("SCSS compilation error"),
)?;
Ok(())
}
fn recursive_copy(path: &Path, out_dir: &Path) -> std::io::Result<()> {
if metadata(path)?.is_dir() {
let out = out_dir.join(path.file_name().unwrap());
create_dir_all(out.clone())?;
for ch in read_dir(path)? {
recursive_copy(&ch?.path(), &out)?;
}
} else {
println!("cargo:rerun-if-changed={}", path.display());
let ext = path.extension().and_then(OsStr::to_str);
if ext != Some("scss") && ext != Some("sass") {
copy(path, out_dir.join(path.file_name().unwrap()))?;
}
}
Ok(())
}
@@ -0,0 +1,6 @@
-- This file should undo anything in `up.sql`
--#!|_conn, path: &Path| {
--#! let mut pb = path.to_path_buf();
--#! pb.push("search_index");
--#! std::fs::remove_dir_all(pb).map_err(Error::from)
--#!}
@@ -0,0 +1,10 @@
-- Your SQL goes here
--#!|conn: &Connection, path: &Path| {
--#! let mut pb = path.to_path_buf();
--#! pb.push("search_index");
--#! let searcher = super::search::Searcher::create(&pb)?;
--#! searcher.fill(conn)?;
--#! searcher.commit();
--#! Ok(())
--#!}
@@ -1,4 +0,0 @@
-- This file should undo anything in `up.sql`
ALTER TABLE users ADD COLUMN is_admin BOOLEAN NOT NULL DEFAULT 'f';
UPDATE users SET is_admin = 't' WHERE role = 0;
ALTER TABLE users DROP COLUMN role;
@@ -1,4 +0,0 @@
-- Your SQL goes here
ALTER TABLE users ADD COLUMN role INTEGER NOT NULL DEFAULT 2;
UPDATE users SET role = 0 WHERE is_admin = 't';
ALTER TABLE users DROP COLUMN is_admin;
@@ -1,4 +0,0 @@
-- This file should undo anything in `up.sql`
ALTER TABLE blogs DROP COLUMN theme;
ALTER TABLE users DROP COLUMN preferred_theme;
ALTER TABLE users DROP COLUMN hide_custom_css;
@@ -1,4 +0,0 @@
-- Your SQL goes here
ALTER TABLE blogs ADD COLUMN theme VARCHAR;
ALTER TABLE users ADD COLUMN preferred_theme VARCHAR;
ALTER TABLE users ADD COLUMN hide_custom_css BOOLEAN NOT NULL DEFAULT 'f';
@@ -1,6 +0,0 @@
-- This file should undo anything in `up.sql`
DROP TABLE timeline;
DROP TABLE timeline_definition;
DROP TABLE list_elems;
DROP TABLE lists;
@@ -1,31 +0,0 @@
-- Your SQL goes here
CREATE TABLE timeline_definition(
id SERIAL PRIMARY KEY,
user_id integer REFERENCES users ON DELETE CASCADE,
name VARCHAR NOT NULL,
query VARCHAR NOT NULL,
CONSTRAINT timeline_unique_user_name UNIQUE(user_id, name)
);
CREATE TABLE timeline(
id SERIAL PRIMARY KEY,
post_id integer NOT NULL REFERENCES posts ON DELETE CASCADE,
timeline_id integer NOT NULL REFERENCES timeline_definition ON DELETE CASCADE
);
CREATE TABLE lists(
id SERIAL PRIMARY KEY,
name VARCHAR NOT NULL,
user_id integer REFERENCES users ON DELETE CASCADE,
type integer NOT NULL,
CONSTRAINT list_unique_user_name UNIQUE(user_id, name)
);
CREATE TABLE list_elems(
id SERIAL PRIMARY KEY,
list_id integer NOT NULL REFERENCES lists ON DELETE CASCADE,
user_id integer REFERENCES users ON DELETE CASCADE,
blog_id integer REFERENCES blogs ON DELETE CASCADE,
word VARCHAR
);
@@ -1,4 +0,0 @@
-- This file should undo anything in `up.sql`
DELETE FROM timeline_definition WHERE name = 'Your feed';
DELETE FROM timeline_definition WHERE name = 'Local feed' AND query = 'local';
DELETE FROM timeline_definition WHERE name = 'Federared feed' AND query = 'all';
@@ -1,6 +0,0 @@
-- Your SQL goes here
INSERT INTO timeline_definition (name, query) VALUES
('Local feed', 'local'),
('Federated feed', 'all');
INSERT INTO timeline_definition (user_id,name,query)
select id,'Your feed',CONCAT('followed or [',fqn,']') from users;
@@ -1,8 +0,0 @@
DELETE FROM timeline WHERE id IN
(
SELECT timeline.id FROM timeline
INNER JOIN timeline_definition ON timeline.timeline_id = timeline_definition.id
WHERE timeline_definition.query LIKE 'followed or [%]' OR
timeline_definition.query = 'local' OR
timeline_definition.query = 'all'
);
@@ -1,18 +0,0 @@
INSERT INTO timeline (post_id, timeline_id)
SELECT posts.id,timeline_definition.id FROM posts,timeline_definition
WHERE timeline_definition.query = 'all';
INSERT INTO timeline (post_id, timeline_id)
SELECT posts.id,timeline_definition.id FROM posts
CROSS JOIN timeline_definition
INNER JOIN blogs ON posts.blog_id = blogs.id
INNER JOIN instances ON blogs.instance_id = instances.id
WHERE timeline_definition.query = 'local' and instances.local = true;
INSERT INTO timeline (post_id, timeline_id)
SELECT posts.id,timeline_definition.id FROM posts
INNER JOIN blog_authors ON posts.blog_id = blog_authors.blog_id
LEFT JOIN follows ON blog_authors.author_id = follows.following_id
INNER JOIN timeline_definition ON follows.follower_id = timeline_definition.user_id
or blog_authors.author_id = timeline_definition.user_id
WHERE timeline_definition.query LIKE 'followed or [%]';
@@ -1,3 +0,0 @@
-- This file should undo anything in `up.sql`
drop table email_blocklist;
@@ -1,6 +0,0 @@
-- Your SQL goes here
CREATE TABLE email_blocklist(id SERIAL PRIMARY KEY,
email_address TEXT UNIQUE,
note TEXT,
notify_user BOOLEAN DEFAULT FALSE,
notification_text TEXT);
@@ -0,0 +1,6 @@
-- This file should undo anything in `up.sql`
--#!|_conn, path: &Path| {
--#! let mut pb = path.to_path_buf();
--#! pb.push("search_index");
--#! std::fs::remove_dir_all(pb).map_err(Error::from)
--#!}
@@ -0,0 +1,10 @@
-- Your SQL goes here
--#!|conn: &Connection, path: &Path| {
--#! let mut pb = path.to_path_buf();
--#! pb.push("search_index");
--#! let searcher = super::search::Searcher::create(&pb)?;
--#! searcher.fill(conn)?;
--#! searcher.commit();
--#! Ok(())
--#!}
@@ -1,72 +0,0 @@
-- This file should undo anything in `up.sql`
CREATE TABLE IF NOT EXISTS "users_without_role" (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
username VARCHAR NOT NULL,
display_name VARCHAR NOT NULL DEFAULT '',
outbox_url VARCHAR NOT NULL UNIQUE,
inbox_url VARCHAR NOT NULL UNIQUE,
is_admin BOOLEAN NOT NULL DEFAULT 'f',
summary TEXT NOT NULL DEFAULT '',
email TEXT,
hashed_password TEXT,
instance_id INTEGER REFERENCES instances(id) ON DELETE CASCADE NOT NULL,
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
ap_url TEXT NOT NULL default '' UNIQUE,
private_key TEXT,
public_key TEXT NOT NULL DEFAULT '',
shared_inbox_url VARCHAR,
followers_endpoint VARCHAR NOT NULL DEFAULT '' UNIQUE,
avatar_id INTEGER REFERENCES medias(id) ON DELETE CASCADE,
last_fetched_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
fqn TEXT NOT NULL DEFAULT '',
summary_html TEXT NOT NULL DEFAULT '',
FOREIGN KEY (avatar_id) REFERENCES medias(id) ON DELETE SET NULL,
CONSTRAINT blog_authors_unique UNIQUE (username, instance_id)
);
INSERT INTO users_without_role SELECT
id,
username,
display_name,
outbox_url,
inbox_url,
't',
summary,
email,
hashed_password,
instance_id,
creation_date,
ap_url,
private_key,
public_key,
shared_inbox_url,
followers_endpoint,
avatar_id,
last_fetched_date,
fqn,
summary
FROM users WHERE role = 0;
INSERT INTO users_without_role SELECT
id,
username,
display_name,
outbox_url,
inbox_url,
'f',
summary,
email,
hashed_password,
instance_id,
creation_date,
ap_url,
private_key,
public_key,
shared_inbox_url,
followers_endpoint,
avatar_id,
last_fetched_date,
fqn,
summary
FROM users WHERE role != 0;
DROP TABLE users;
ALTER TABLE users_without_role RENAME TO users;
@@ -1,74 +0,0 @@
-- Your SQL goes here
CREATE TABLE IF NOT EXISTS "users_with_role" (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
username VARCHAR NOT NULL,
display_name VARCHAR NOT NULL DEFAULT '',
outbox_url VARCHAR NOT NULL UNIQUE,
inbox_url VARCHAR NOT NULL UNIQUE,
summary TEXT NOT NULL DEFAULT '',
email TEXT,
hashed_password TEXT,
instance_id INTEGER REFERENCES instances(id) ON DELETE CASCADE NOT NULL,
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
ap_url TEXT NOT NULL default '' UNIQUE,
private_key TEXT,
public_key TEXT NOT NULL DEFAULT '',
shared_inbox_url VARCHAR,
followers_endpoint VARCHAR NOT NULL DEFAULT '' UNIQUE,
avatar_id INTEGER REFERENCES medias(id) ON DELETE CASCADE,
last_fetched_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
fqn TEXT NOT NULL DEFAULT '',
summary_html TEXT NOT NULL DEFAULT '',
role INTEGER NOT NULL DEFAULT 2,
FOREIGN KEY (avatar_id) REFERENCES medias(id) ON DELETE SET NULL,
CONSTRAINT blog_authors_unique UNIQUE (username, instance_id)
);
INSERT INTO users_with_role SELECT
id,
username,
display_name,
outbox_url,
inbox_url,
summary,
email,
hashed_password,
instance_id,
creation_date,
ap_url,
private_key,
public_key,
shared_inbox_url,
followers_endpoint,
avatar_id,
last_fetched_date,
fqn,
summary,
0
FROM users WHERE is_admin = 't';
INSERT INTO users_with_role SELECT
id,
username,
display_name,
outbox_url,
inbox_url,
summary,
email,
hashed_password,
instance_id,
creation_date,
ap_url,
private_key,
public_key,
shared_inbox_url,
followers_endpoint,
avatar_id,
last_fetched_date,
fqn,
summary,
2
FROM users WHERE is_admin = 'f';
DROP TABLE users;
ALTER TABLE users_with_role RENAME TO users;
@@ -1,88 +0,0 @@
-- This file should undo anything in `up.sql`
CREATE TABLE blogs_before_themes (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
actor_id VARCHAR NOT NULL,
title VARCHAR NOT NULL,
summary TEXT NOT NULL DEFAULT '',
outbox_url VARCHAR NOT NULL UNIQUE,
inbox_url VARCHAR NOT NULL UNIQUE,
instance_id INTEGER REFERENCES instances(id) ON DELETE CASCADE NOT NULL,
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
ap_url text not null default '' UNIQUE,
private_key TEXT,
public_key TEXT NOT NULL DEFAULT '',
fqn TEXT NOT NULL DEFAULT '',
summary_html TEXT NOT NULL DEFAULT '',
icon_id INTEGER REFERENCES medias(id) ON DELETE SET NULL DEFAULT NULL,
banner_id INTEGER REFERENCES medias(id) ON DELETE SET NULL DEFAULT NULL,
CONSTRAINT blog_unique UNIQUE (actor_id, instance_id)
);
INSERT INTO blogs_before_themes SELECT
id,
actor_id,
title,
summary,
outbox_url,
inbox_url,
instance_id,
creation_date,
ap_url,
private_key,
public_key,
fqn,
summary_html,
icon_id,
banner_id
FROM blogs;
DROP TABLE blogs;
ALTER TABLE blogs_before_themes RENAME TO blogs;
CREATE TABLE users_before_themes (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
username VARCHAR NOT NULL,
display_name VARCHAR NOT NULL DEFAULT '',
outbox_url VARCHAR NOT NULL UNIQUE,
inbox_url VARCHAR NOT NULL UNIQUE,
summary TEXT NOT NULL DEFAULT '',
email TEXT,
hashed_password TEXT,
instance_id INTEGER REFERENCES instances(id) ON DELETE CASCADE NOT NULL,
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
ap_url TEXT NOT NULL default '' UNIQUE,
private_key TEXT,
public_key TEXT NOT NULL DEFAULT '',
shared_inbox_url VARCHAR,
followers_endpoint VARCHAR NOT NULL DEFAULT '' UNIQUE,
avatar_id INTEGER REFERENCES medias(id) ON DELETE CASCADE,
last_fetched_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
fqn TEXT NOT NULL DEFAULT '',
summary_html TEXT NOT NULL DEFAULT '',
role INTEGER NOT NULL DEFAULT 2,
FOREIGN KEY (avatar_id) REFERENCES medias(id) ON DELETE SET NULL,
CONSTRAINT blog_authors_unique UNIQUE (username, instance_id)
);
INSERT INTO users_before_themes SELECT
id,
username,
display_name,
outbox_url,
inbox_url,
summary,
email,
hashed_password,
instance_id,
creation_date,
ap_url,
private_key,
public_key,
shared_inbox_url,
followers_endpoint,
avatar_id,
last_fetched_date,
fqn,
summary_html,
role
FROM users;
DROP TABLE users;
ALTER TABLE users_before_themes RENAME TO users;
@@ -1,4 +0,0 @@
-- Your SQL goes here
ALTER TABLE blogs ADD COLUMN theme VARCHAR;
ALTER TABLE users ADD COLUMN preferred_theme VARCHAR;
ALTER TABLE users ADD COLUMN hide_custom_css BOOLEAN NOT NULL DEFAULT 'f';
@@ -1,6 +0,0 @@
-- This file should undo anything in `up.sql`
DROP TABLE timeline;
DROP TABLE timeline_definition;
DROP TABLE list_elems;
DROP TABLE lists;
@@ -1,31 +0,0 @@
-- Your SQL goes here
CREATE TABLE timeline_definition(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
name VARCHAR NOT NULL,
query VARCHAR NOT NULL,
CONSTRAINT timeline_unique_user_name UNIQUE(user_id, name)
);
CREATE TABLE timeline(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
post_id integer NOT NULL REFERENCES posts(id) ON DELETE CASCADE,
timeline_id integer NOT NULL REFERENCES timeline_definition(id) ON DELETE CASCADE
);
CREATE TABLE lists(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name VARCHAR NOT NULL,
user_id integer REFERENCES users(id) ON DELETE CASCADE,
type integer NOT NULL,
CONSTRAINT timeline_unique_user_name UNIQUE(user_id, name)
);
CREATE TABLE list_elems(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
list_id integer NOT NULL REFERENCES lists(id) ON DELETE CASCADE,
user_id integer REFERENCES users(id) ON DELETE CASCADE,
blog_id integer REFERENCES blogs(id) ON DELETE CASCADE,
word VARCHAR
);
@@ -1,4 +0,0 @@
-- This file should undo anything in `up.sql`
DELETE FROM timeline_definition WHERE name = 'Your feed';
DELETE FROM timeline_definition WHERE name = 'Local feed' AND query = 'local';
DELETE FROM timeline_definition WHERE name = 'Federared feed' AND query = 'all';
@@ -1,6 +0,0 @@
-- Your SQL goes here
INSERT INTO timeline_definition (name, query) VALUES
('Local feed', 'local'),
('Federated feed', 'all');
INSERT INTO timeline_definition (user_id,name,query)
select id,'Your feed','followed or ['||fqn||']' from users;
@@ -1,8 +0,0 @@
DELETE FROM timeline WHERE id IN
(
SELECT timeline.id FROM timeline
INNER JOIN timeline_definition ON timeline.timeline_id = timeline_definition.id
WHERE timeline_definition.query LIKE 'followed or [%]' OR
timeline_definition.query = 'local' OR
timeline_definition.query = 'all'
);
@@ -1,17 +0,0 @@
INSERT INTO timeline (post_id, timeline_id)
SELECT posts.id,timeline_definition.id FROM posts,timeline_definition
WHERE timeline_definition.query = 'all';
INSERT INTO timeline (post_id, timeline_id)
SELECT posts.id,timeline_definition.id FROM posts,timeline_definition
INNER JOIN blogs ON posts.blog_id = blogs.id
INNER JOIN instances ON blogs.instance_id = instances.id
WHERE timeline_definition.query = 'local' and instances.local = 1;
INSERT INTO timeline (post_id, timeline_id)
SELECT posts.id,timeline_definition.id FROM posts
INNER JOIN blog_authors ON posts.blog_id = blog_authors.blog_id
LEFT JOIN follows ON blog_authors.author_id = follows.following_id
INNER JOIN timeline_definition ON follows.follower_id = timeline_definition.user_id
or blog_authors.author_id = timeline_definition.user_id
WHERE timeline_definition.query LIKE 'followed or [%]';
@@ -1,3 +0,0 @@
-- This file should undo anything in `up.sql`
drop table email_blocklist;
@@ -1,6 +0,0 @@
-- Your SQL goes here
CREATE TABLE email_blocklist(id INTEGER PRIMARY KEY,
email_address TEXT UNIQUE,
note TEXT,
notify_user BOOLEAN DEFAULT FALSE,
notification_text TEXT);
+1 -2
View File
@@ -1,8 +1,7 @@
[package]
name = "plume-api"
version = "0.4.0"
version = "0.3.0"
authors = ["Plume contributors"]
edition = "2018"
[dependencies]
serde = "1.0"
+1
View File
@@ -1,3 +1,4 @@
extern crate serde;
#[macro_use]
extern crate serde_derive;
+2 -4
View File
@@ -1,8 +1,7 @@
[package]
name = "plume-cli"
version = "0.4.0"
version = "0.3.0"
authors = ["Plume contributors"]
edition = "2018"
[[bin]]
name = "plm"
@@ -11,7 +10,7 @@ path = "src/main.rs"
[dependencies]
clap = "2.33"
dotenv = "0.14"
rpassword = "4.0"
rpassword = "3.0"
[dependencies.diesel]
features = ["r2d2", "chrono"]
@@ -23,4 +22,3 @@ path = "../plume-models"
[features]
postgres = ["plume-models/postgres", "diesel/postgres"]
sqlite = ["plume-models/sqlite", "diesel/sqlite"]
search-lindera = ["plume-models/search-lindera"]
+5 -1
View File
@@ -1,4 +1,8 @@
use dotenv;
extern crate clap;
extern crate diesel;
extern crate dotenv;
extern crate plume_models;
extern crate rpassword;
use clap::App;
use diesel::Connection;
+7 -14
View File
@@ -82,7 +82,7 @@ fn init<'a>(args: &ArgMatches<'a>, conn: &Connection) {
}
};
if can_do || force {
let searcher = Searcher::create(&path, &CONFIG.search_tokenizers).unwrap();
let searcher = Searcher::create(&path).unwrap();
refill(args, conn, Some(searcher));
} else {
eprintln!(
@@ -93,13 +93,9 @@ fn init<'a>(args: &ArgMatches<'a>, conn: &Connection) {
}
fn refill<'a>(args: &ArgMatches<'a>, conn: &Connection, searcher: Option<Searcher>) {
let path = args.value_of("path");
let path = match path {
Some(path) => Path::new(path).join("search_index"),
None => Path::new(&CONFIG.search_index).to_path_buf(),
};
let searcher =
searcher.unwrap_or_else(|| Searcher::open(&path, &CONFIG.search_tokenizers).unwrap());
let path = args.value_of("path").unwrap_or(".");
let path = Path::new(path).join("search_index");
let searcher = searcher.unwrap_or_else(|| Searcher::open(&path).unwrap());
searcher.fill(conn).expect("Couldn't import post");
println!("Commiting result");
@@ -107,12 +103,9 @@ fn refill<'a>(args: &ArgMatches<'a>, conn: &Connection, searcher: Option<Searche
}
fn unlock<'a>(args: &ArgMatches<'a>) {
let path = match args.value_of("path") {
None => Path::new(&CONFIG.search_index),
Some(x) => Path::new(x),
};
let meta = Path::new(path).join(".tantivy-meta.lock");
let path = args.value_of("path").unwrap_or(".");
let meta = Path::new(path).join("search_index/.tantivy-meta.lock");
remove_file(meta).unwrap();
let writer = Path::new(path).join(".tantivy-writer.lock");
let writer = Path::new(path).join("search_index/.tantivy-writer.lock");
remove_file(writer).unwrap();
}
+2 -26
View File
@@ -52,12 +52,6 @@ pub fn command<'a, 'b>() -> App<'a, 'b> {
.long("admin")
.help("Makes the user an administrator of the instance"),
)
.arg(
Arg::with_name("moderator")
.short("m")
.long("moderator")
.help("Makes the user a moderator of the instance"),
)
.about("Create a new user on this instance"),
)
.subcommand(
@@ -100,17 +94,7 @@ fn new<'a>(args: &ArgMatches<'a>, conn: &Connection) {
.value_of("display-name")
.map(String::from)
.unwrap_or_else(|| super::ask_for("Display name"));
let admin = args.is_present("admin");
let moderator = args.is_present("moderator");
let role = if admin {
Role::Admin
} else if moderator {
Role::Moderator
} else {
Role::Normal
};
let bio = args.value_of("biography").unwrap_or("").to_string();
let email = args
.value_of("email")
@@ -125,16 +109,8 @@ fn new<'a>(args: &ArgMatches<'a>, conn: &Connection) {
rpassword::read_password().expect("Couldn't read your password.")
});
NewUser::new_local(
conn,
username,
display_name,
role,
&bio,
email,
User::hash_pass(&password).expect("Couldn't hash password"),
)
.expect("Couldn't save new user");
NewUser::new_local(conn, username, display_name, admin, &bio, email, &password)
.expect("Couldn't save new user");
}
fn reset_password<'a>(args: &ArgMatches<'a>, conn: &Connection) {
+4 -7
View File
@@ -1,18 +1,17 @@
[package]
name = "plume-common"
version = "0.4.0"
version = "0.3.0"
authors = ["Plume contributors"]
edition = "2018"
[dependencies]
activitypub = "0.1.1"
activitystreams-derive = "0.1.1"
activitystreams-derive = "0.1.0"
activitystreams-traits = "0.1.0"
array_tool = "1.0"
base64 = "0.10"
heck = "0.3.0"
hex = "0.3"
hyper = "0.12.33"
hyper = "0.12.28"
openssl = "0.10.22"
rocket = "0.4.0"
reqwest = "0.9"
@@ -20,9 +19,7 @@ serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
shrinkwraprs = "0.2.1"
syntect = "3.3"
tokio = "0.1.22"
regex-syntax = { version = "0.6.17", default-features = false, features = ["unicode-perl"] }
tokio = "0.1.21"
[dependencies.chrono]
features = ["serde"]
+1 -1
View File
@@ -64,7 +64,7 @@ impl<T> ActivityStream<T> {
}
impl<'r, O: Object> Responder<'r> for ActivityStream<O> {
fn respond_to(self, request: &Request<'_>) -> Result<Response<'r>, Status> {
fn respond_to(self, request: &Request) -> Result<Response<'r>, Status> {
let mut json = serde_json::to_value(&self.0).map_err(|_| Status::InternalServerError)?;
json["@context"] = context();
serde_json::to_string(&json).respond_to(request).map(|r| {

Some files were not shown because too many files have changed in this diff Show More