Compare commits

...

14 commits

358 changed files with 4031 additions and 34628 deletions

19
.gitignore vendored
View file

@ -6,16 +6,17 @@ ansible/passwords/
# docker build files # docker build files
docker/lemmy_mine.hjson docker/lemmy_mine.hjson
docker/dev/env_deploy.sh docker/dev/env_deploy.sh
docker/federation/volumes volumes
docker/federation-test/volumes
docker/dev/volumes
# local build files
build/
ui/src/translations
# ide config # ide config
.idea/ .idea
.vscode/ .vscode
# local build files
target target
env_setup.sh
query_testing/*.json
query_testing/*.json.old
# API tests
api_tests/node_modules

7
server/Cargo.lock → Cargo.lock generated vendored
View file

@ -768,6 +768,12 @@ dependencies = [
"time 0.1.43", "time 0.1.43",
] ]
[[package]]
name = "cargo-husky"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b02b629252fe8ef6460461409564e2c21d0c8e77e0944f3d189ff06c4e932ad"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.58" version = "1.0.58"
@ -1851,6 +1857,7 @@ dependencies = [
"base64 0.12.3", "base64 0.12.3",
"bcrypt", "bcrypt",
"captcha", "captcha",
"cargo-husky",
"chrono", "chrono",
"diesel", "diesel",
"diesel_migrations", "diesel_migrations",

View file

@ -59,3 +59,8 @@ anyhow = "1.0.32"
thiserror = "1.0.20" thiserror = "1.0.20"
background-jobs = " 0.8.0-alpha.2" background-jobs = " 0.8.0-alpha.2"
reqwest = { version = "0.10", features = ["json"] } reqwest = { version = "0.10", features = ["json"] }
[dev-dependencies.cargo-husky]
version = "1"
default-features = false # Disable features which are enabled by default
features = ["precommit-hook", "run-cargo-fmt", "run-cargo-clippy"]

View file

@ -13,8 +13,6 @@
hostname: "{{ domain }}" hostname: "{{ domain }}"
# json web token for authorization between server and client # json web token for authorization between server and client
jwt_secret: "{{ jwt_password }}" jwt_secret: "{{ jwt_password }}"
# The location of the frontend
front_end_dir: "/app/dist"
# email sending configuration # email sending configuration
email: { email: {
# hostname of the smtp server # hostname of the smtp server

View file

@ -51,8 +51,9 @@ server {
# Upload limit for pictrs # Upload limit for pictrs
client_max_body_size 20M; client_max_body_size 20M;
location / { # lemmy api
proxy_pass http://0.0.0.0:8536; location /api/v1 {
proxy_pass http://0.0.0.0:8536/api/v1;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -69,6 +70,23 @@ server {
limit_req zone=lemmy_ratelimit burst=30 nodelay; limit_req zone=lemmy_ratelimit burst=30 nodelay;
} }
# Docs
location /docs {
proxy_pass http://0.0.0.0:8536/docs;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# lemmy-isomorphic-ui
location / {
proxy_pass http://0.0.0.0:1235;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# Redirect pictshare images to pictrs # Redirect pictshare images to pictrs
location ~ /pictshare/(.*)$ { location ~ /pictshare/(.*)$ {
return 301 /pictrs/image/$1; return 301 /pictrs/image/$1;

4
api_tests/jest.config.js vendored Normal file
View file

@ -0,0 +1,4 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};

20
api_tests/package.json vendored Normal file
View file

@ -0,0 +1,20 @@
{
"name": "api_tests",
"version": "0.0.1",
"description": "API tests for lemmy backend",
"main": "index.js",
"repository": "https://github.com/LemmyNet/lemmy",
"author": "Dessalines",
"license": "AGPL-3.0",
"scripts": {
"api-test": "jest src/ -i --verbose"
},
"devDependencies": {
"@types/jest": "^26.0.13",
"jest": "^26.4.2",
"lemmy-js-client": "^1.0.11",
"node-fetch": "^2.6.1",
"ts-jest": "^26.3.0",
"typescript": "^4.0.2"
}
}

View file

@ -1,3 +1,4 @@
jest.setTimeout(120000);
import { import {
alpha, alpha,
beta, beta,

3659
api_tests/yarn.lock vendored Normal file

File diff suppressed because it is too large Load diff

View file

View file

@ -33,8 +33,6 @@
port: 8536 port: 8536
# json web token for authorization between server and client # json web token for authorization between server and client
jwt_secret: "changeme" jwt_secret: "changeme"
# The location of the frontend
front_end_dir: "../ui/dist"
# address where pictrs is available # address where pictrs is available
pictrs_url: "http://pictrs:8080" pictrs_url: "http://pictrs:8080"
# rate limits for various user actions, by user ip # rate limits for various user actions, by user ip

View file

View file

39
docker/dev/Dockerfile vendored
View file

@ -1,15 +1,3 @@
FROM node:10-jessie as node
WORKDIR /app/ui
# Cache deps
COPY ui/package.json ui/yarn.lock ./
RUN yarn install --pure-lockfile
# Build
COPY ui /app/ui
RUN yarn build
FROM ekidd/rust-musl-builder:nightly-2020-05-07 as rust FROM ekidd/rust-musl-builder:nightly-2020-05-07 as rust
# Cache deps # Cache deps
@ -27,22 +15,22 @@ RUN mkdir -p lemmy_db/src/ \
lemmy lemmy
# Copy the cargo tomls # Copy the cargo tomls
COPY server/Cargo.toml server/Cargo.lock ./ COPY Cargo.toml Cargo.lock ./
COPY server/lemmy_db/Cargo.toml ./lemmy_db/ COPY lemmy_db/Cargo.toml ./lemmy_db/
COPY server/lemmy_utils/Cargo.toml ./lemmy_utils/ COPY lemmy_utils/Cargo.toml ./lemmy_utils/
COPY server/lemmy_api_structs/Cargo.toml ./lemmy_api_structs/ COPY lemmy_api_structs/Cargo.toml ./lemmy_api_structs/
COPY server/lemmy_rate_limit/Cargo.toml ./lemmy_rate_limit/ COPY lemmy_rate_limit/Cargo.toml ./lemmy_rate_limit/
# Cache the deps # Cache the deps
RUN cargo build-deps RUN cargo build-deps
# Copy the src folders # Copy the src folders
COPY server/src ./src/ COPY src ./src/
COPY server/lemmy_db/src ./lemmy_db/src/ COPY lemmy_db/src ./lemmy_db/src/
COPY server/lemmy_utils/src/ ./lemmy_utils/src/ COPY lemmy_utils/src/ ./lemmy_utils/src/
COPY server/lemmy_api_structs/src/ ./lemmy_api_structs/src/ COPY lemmy_api_structs/src/ ./lemmy_api_structs/src/
COPY server/lemmy_rate_limit/src/ ./lemmy_rate_limit/src/ COPY lemmy_rate_limit/src/ ./lemmy_rate_limit/src/
COPY server/migrations ./migrations/ COPY migrations ./migrations/
# Build for debug # Build for debug
RUN cargo build RUN cargo build
@ -62,10 +50,9 @@ RUN apk add libpq
RUN apk add espeak RUN apk add espeak
# Copy resources # Copy resources
COPY server/config/defaults.hjson /config/defaults.hjson COPY config/defaults.hjson /config/defaults.hjson
COPY --from=rust /app/server/target/x86_64-unknown-linux-musl/debug/lemmy_server /app/lemmy COPY --from=rust /app/server/target/x86_64-unknown-linux-musl/debug/lemmy_server /app/lemmy
COPY --from=docs /app/docs/book/ /app/dist/documentation/ COPY --from=docs /app/docs/book/ /app/documentation/
COPY --from=node /app/ui/dist /app/dist
RUN addgroup -g 1000 lemmy RUN addgroup -g 1000 lemmy
RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy

View file

@ -15,6 +15,17 @@ services:
- pictrs - pictrs
- postgres - postgres
- iframely - iframely
lemmy-isomorphic-ui:
image: dessalines/lemmy-isomorphic-ui:v0.0.6
# image: lemmy-isomorphic-ui:latest
ports:
- "1235:1234"
environment:
- LEMMY_INTERNAL_HOST=lemmy:8536
- LEMMY_EXTERNAL_HOST=localhost:8536
- LEMMY_HTTPS=false
depends_on:
- lemmy
postgres: postgres:
image: postgres:12-alpine image: postgres:12-alpine

2
docker/lemmy.hjson vendored
View file

@ -30,8 +30,6 @@
# host where postgres is running # host where postgres is running
host: "postgres" host: "postgres"
} }
# The location of the frontend
front_end_dir: "/app/dist"
# # optional: email sending configuration # # optional: email sending configuration
# email: { # email: {
# # hostname of the smtp server # # hostname of the smtp server

View file

@ -10,17 +10,17 @@ WORKDIR /app
RUN sudo chown -R rust:rust . RUN sudo chown -R rust:rust .
RUN USER=root cargo new server RUN USER=root cargo new server
WORKDIR /app/server WORKDIR /app/server
COPY server/Cargo.toml server/Cargo.lock ./ COPY Cargo.toml Cargo.lock ./
COPY server/lemmy_db ./lemmy_db COPY lemmy_db ./lemmy_db
COPY server/lemmy_utils ./lemmy_utils COPY lemmy_utils ./lemmy_utils
COPY server/lemmy_api_structs ./lemmy_api_structs COPY lemmy_api_structs ./lemmy_api_structs
COPY server/lemmy_rate_limit ./lemmy_rate_limit COPY lemmy_rate_limit ./lemmy_rate_limit
RUN mkdir -p ./src/bin \ RUN mkdir -p ./src/bin \
&& echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs && echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs
RUN cargo build --release RUN cargo build --release
RUN find target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR -type f -name "$(echo "lemmy_server" | tr '-' '_')*" -exec touch -t 200001010000 {} + RUN find target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR -type f -name "$(echo "lemmy_server" | tr '-' '_')*" -exec touch -t 200001010000 {} +
COPY server/src ./src/ COPY src ./src/
COPY server/migrations ./migrations/ COPY migrations ./migrations/
# build for release # build for release
# workaround for https://github.com/rust-lang/rust/issues/62896 # workaround for https://github.com/rust-lang/rust/issues/62896
@ -36,18 +36,6 @@ WORKDIR /app
COPY --chown=rust:rust docs ./docs COPY --chown=rust:rust docs ./docs
RUN mdbook build docs/ RUN mdbook build docs/
FROM node:12-buster as node
WORKDIR /app/ui
# Cache deps
COPY ui/package.json ui/yarn.lock ./
RUN yarn install --pure-lockfile --network-timeout 600000
# Build
COPY ui /app/ui
RUN yarn build
FROM alpine:3.12 as lemmy FROM alpine:3.12 as lemmy
# Install libpq for postgres # Install libpq for postgres
@ -60,10 +48,9 @@ RUN addgroup -g 1000 lemmy
RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy
# Copy resources # Copy resources
COPY --chown=lemmy:lemmy server/config/defaults.hjson /config/defaults.hjson COPY --chown=lemmy:lemmy config/defaults.hjson /config/defaults.hjson
COPY --chown=lemmy:lemmy --from=rust /app/server/lemmy_server /app/lemmy COPY --chown=lemmy:lemmy --from=rust /app/server/lemmy_server /app/lemmy
COPY --chown=lemmy:lemmy --from=docs /app/docs/book/ /app/dist/documentation/ COPY --chown=lemmy:lemmy --from=docs /app/docs/book/ /app/documentation/
COPY --chown=lemmy:lemmy --from=node /app/ui/dist /app/dist
RUN chown lemmy:lemmy /app/lemmy RUN chown lemmy:lemmy /app/lemmy
USER lemmy USER lemmy

View file

@ -13,8 +13,8 @@ third_semver=$(echo $new_tag | cut -d "." -f 3)
# Setting the version on the front end # Setting the version on the front end
cd ../../ cd ../../
# Setting the version on the backend # Setting the version on the backend
echo "pub const VERSION: &str = \"$new_tag\";" > "server/src/version.rs" echo "pub const VERSION: &str = \"$new_tag\";" > "src/version.rs"
git add "server/src/version.rs" git add "src/version.rs"
# Setting the version for Ansible # Setting the version for Ansible
echo $new_tag > "ansible/VERSION" echo $new_tag > "ansible/VERSION"
git add "ansible/VERSION" git add "ansible/VERSION"

View file

@ -25,6 +25,18 @@ services:
- pictrs - pictrs
- iframely - iframely
lemmy-isomorphic-ui:
image: dessalines/lemmy-isomorphic-ui:v0.0.6
# image: lemmy-isomorphic-ui:latest
ports:
- "1235:1234"
environment:
- LEMMY_INTERNAL_HOST=lemmy:8536
- LEMMY_EXTERNAL_HOST=localhost:8536
- LEMMY_HTTPS=false
depends_on:
- lemmy
pictrs: pictrs:
image: asonix/pictrs:v0.1.13-r0 image: asonix/pictrs:v0.1.13-r0
ports: ports:

View file

@ -35,7 +35,6 @@ services:
- LEMMY_HOSTNAME=lemmy-alpha:8540 - LEMMY_HOSTNAME=lemmy-alpha:8540
- LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_alpha:5432/lemmy - LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_alpha:5432/lemmy
- LEMMY_JWT_SECRET=changeme - LEMMY_JWT_SECRET=changeme
- LEMMY_FRONT_END_DIR=/app/dist
- LEMMY_FEDERATION__ENABLED=true - LEMMY_FEDERATION__ENABLED=true
- LEMMY_FEDERATION__TLS_ENABLED=false - LEMMY_FEDERATION__TLS_ENABLED=false
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta,lemmy-gamma,lemmy-delta,lemmy-epsilon - LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta,lemmy-gamma,lemmy-delta,lemmy-epsilon
@ -65,7 +64,6 @@ services:
- LEMMY_HOSTNAME=lemmy-beta:8550 - LEMMY_HOSTNAME=lemmy-beta:8550
- LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_beta:5432/lemmy - LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_beta:5432/lemmy
- LEMMY_JWT_SECRET=changeme - LEMMY_JWT_SECRET=changeme
- LEMMY_FRONT_END_DIR=/app/dist
- LEMMY_FEDERATION__ENABLED=true - LEMMY_FEDERATION__ENABLED=true
- LEMMY_FEDERATION__TLS_ENABLED=false - LEMMY_FEDERATION__TLS_ENABLED=false
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-gamma,lemmy-delta,lemmy-epsilon - LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-gamma,lemmy-delta,lemmy-epsilon
@ -95,7 +93,6 @@ services:
- LEMMY_HOSTNAME=lemmy-gamma:8560 - LEMMY_HOSTNAME=lemmy-gamma:8560
- LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_gamma:5432/lemmy - LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_gamma:5432/lemmy
- LEMMY_JWT_SECRET=changeme - LEMMY_JWT_SECRET=changeme
- LEMMY_FRONT_END_DIR=/app/dist
- LEMMY_FEDERATION__ENABLED=true - LEMMY_FEDERATION__ENABLED=true
- LEMMY_FEDERATION__TLS_ENABLED=false - LEMMY_FEDERATION__TLS_ENABLED=false
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-beta,lemmy-delta,lemmy-epsilon - LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-beta,lemmy-delta,lemmy-epsilon
@ -126,7 +123,6 @@ services:
- LEMMY_HOSTNAME=lemmy-delta:8570 - LEMMY_HOSTNAME=lemmy-delta:8570
- LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_delta:5432/lemmy - LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_delta:5432/lemmy
- LEMMY_JWT_SECRET=changeme - LEMMY_JWT_SECRET=changeme
- LEMMY_FRONT_END_DIR=/app/dist
- LEMMY_FEDERATION__ENABLED=true - LEMMY_FEDERATION__ENABLED=true
- LEMMY_FEDERATION__TLS_ENABLED=false - LEMMY_FEDERATION__TLS_ENABLED=false
- LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta - LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta
@ -157,7 +153,6 @@ services:
- LEMMY_HOSTNAME=lemmy-epsilon:8580 - LEMMY_HOSTNAME=lemmy-epsilon:8580
- LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_epsilon:5432/lemmy - LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_epsilon:5432/lemmy
- LEMMY_JWT_SECRET=changeme - LEMMY_JWT_SECRET=changeme
- LEMMY_FRONT_END_DIR=/app/dist
- LEMMY_FEDERATION__ENABLED=true - LEMMY_FEDERATION__ENABLED=true
- LEMMY_FEDERATION__TLS_ENABLED=false - LEMMY_FEDERATION__TLS_ENABLED=false
- LEMMY_FEDERATION__BLOCKED_INSTANCES=lemmy-alpha - LEMMY_FEDERATION__BLOCKED_INSTANCES=lemmy-alpha

View file

@ -12,7 +12,7 @@ sudo docker build ../../ --file ../prod/Dockerfile --tag dessalines/lemmy:travis
sudo docker-compose up -d sudo docker-compose up -d
pushd ../../ui pushd ../../api_tests
echo "Waiting for Lemmy to start..." echo "Waiting for Lemmy to start..."
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8540/api/v1/site')" != "200" ]]; do sleep 1; done while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8540/api/v1/site')" != "200" ]]; do sleep 1; done
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8550/api/v1/site')" != "200" ]]; do sleep 1; done while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8550/api/v1/site')" != "200" ]]; do sleep 1; done

View file

@ -1,7 +1,7 @@
# Configuration # Configuration
The configuration is based on the file The configuration is based on the file
[defaults.hjson](https://yerbamate.dev/LemmyNet/lemmy/src/branch/main/server/config/defaults.hjson). [defaults.hjson](https://yerbamate.dev/LemmyNet/lemmy/src/branch/main/config/defaults.hjson).
This file also contains documentation for all the available options. To override the defaults, you This file also contains documentation for all the available options. To override the defaults, you
can copy the options you want to change into your local `config.hjson` file. can copy the options you want to change into your local `config.hjson` file.

View file

@ -32,18 +32,10 @@ by the `cd` command.
### Build the backend (Rust) ### Build the backend (Rust)
``` ```
cd server
cargo build cargo build
# for development, use `cargo check` instead) # for development, use `cargo check` instead)
``` ```
### Build the frontend (Typescript)
```
cd ui
yarn
yarn build
```
### Setup postgresql ### Setup postgresql
#### Ubuntu #### Ubuntu
``` ```

View file

@ -28,214 +28,222 @@
- [Request](#request-1) - [Request](#request-1)
- [Response](#response-1) - [Response](#response-1)
- [HTTP](#http-2) - [HTTP](#http-2)
+ [Get User Details](#get-user-details) + [Get Captcha](#get-captcha)
- [Request](#request-2) - [Request](#request-2)
- [Response](#response-2) - [Response](#response-2)
- [HTTP](#http-3) - [HTTP](#http-3)
+ [Save User Settings](#save-user-settings) + [Get User Details](#get-user-details)
- [Request](#request-3) - [Request](#request-3)
- [Response](#response-3) - [Response](#response-3)
- [HTTP](#http-4) - [HTTP](#http-4)
+ [Get Replies / Inbox](#get-replies--inbox) + [Save User Settings](#save-user-settings)
- [Request](#request-4) - [Request](#request-4)
- [Response](#response-4) - [Response](#response-4)
- [HTTP](#http-5) - [HTTP](#http-5)
+ [Get User Mentions](#get-user-mentions) + [Get Replies / Inbox](#get-replies--inbox)
- [Request](#request-5) - [Request](#request-5)
- [Response](#response-5) - [Response](#response-5)
- [HTTP](#http-6) - [HTTP](#http-6)
+ [Mark User Mention as read](#mark-user-mention-as-read) + [Get User Mentions](#get-user-mentions)
- [Request](#request-6) - [Request](#request-6)
- [Response](#response-6) - [Response](#response-6)
- [HTTP](#http-7) - [HTTP](#http-7)
+ [Get Private Messages](#get-private-messages) + [Mark User Mention as read](#mark-user-mention-as-read)
- [Request](#request-7) - [Request](#request-7)
- [Response](#response-7) - [Response](#response-7)
- [HTTP](#http-8) - [HTTP](#http-8)
+ [Create Private Message](#create-private-message) + [Get Private Messages](#get-private-messages)
- [Request](#request-8) - [Request](#request-8)
- [Response](#response-8) - [Response](#response-8)
- [HTTP](#http-9) - [HTTP](#http-9)
+ [Edit Private Message](#edit-private-message) + [Create Private Message](#create-private-message)
- [Request](#request-9) - [Request](#request-9)
- [Response](#response-9) - [Response](#response-9)
- [HTTP](#http-10) - [HTTP](#http-10)
+ [Delete Private Message](#delete-private-message) + [Edit Private Message](#edit-private-message)
- [Request](#request-10) - [Request](#request-10)
- [Response](#response-10) - [Response](#response-10)
- [HTTP](#http-11) - [HTTP](#http-11)
+ [Mark Private Message as Read](#mark-private-message-as-read) + [Delete Private Message](#delete-private-message)
- [Request](#request-11) - [Request](#request-11)
- [Response](#response-11) - [Response](#response-11)
- [HTTP](#http-12) - [HTTP](#http-12)
+ [Mark All As Read](#mark-all-as-read) + [Mark Private Message as Read](#mark-private-message-as-read)
- [Request](#request-12) - [Request](#request-12)
- [Response](#response-12) - [Response](#response-12)
- [HTTP](#http-13) - [HTTP](#http-13)
+ [Delete Account](#delete-account) + [Mark All As Read](#mark-all-as-read)
- [Request](#request-13) - [Request](#request-13)
- [Response](#response-13) - [Response](#response-13)
- [HTTP](#http-14) - [HTTP](#http-14)
+ [Add admin](#add-admin) + [Delete Account](#delete-account)
- [Request](#request-14) - [Request](#request-14)
- [Response](#response-14) - [Response](#response-14)
- [HTTP](#http-15) - [HTTP](#http-15)
+ [Ban user](#ban-user) + [Add admin](#add-admin)
- [Request](#request-15) - [Request](#request-15)
- [Response](#response-15) - [Response](#response-15)
- [HTTP](#http-16) - [HTTP](#http-16)
* [Site](#site) + [Ban user](#ban-user)
+ [List Categories](#list-categories)
- [Request](#request-16) - [Request](#request-16)
- [Response](#response-16) - [Response](#response-16)
- [HTTP](#http-17) - [HTTP](#http-17)
+ [Search](#search) * [Site](#site)
+ [List Categories](#list-categories)
- [Request](#request-17) - [Request](#request-17)
- [Response](#response-17) - [Response](#response-17)
- [HTTP](#http-18) - [HTTP](#http-18)
+ [Get Modlog](#get-modlog) + [Search](#search)
- [Request](#request-18) - [Request](#request-18)
- [Response](#response-18) - [Response](#response-18)
- [HTTP](#http-19) - [HTTP](#http-19)
+ [Create Site](#create-site) + [Get Modlog](#get-modlog)
- [Request](#request-19) - [Request](#request-19)
- [Response](#response-19) - [Response](#response-19)
- [HTTP](#http-20) - [HTTP](#http-20)
+ [Edit Site](#edit-site) + [Create Site](#create-site)
- [Request](#request-20) - [Request](#request-20)
- [Response](#response-20) - [Response](#response-20)
- [HTTP](#http-21) - [HTTP](#http-21)
+ [Get Site](#get-site) + [Edit Site](#edit-site)
- [Request](#request-21) - [Request](#request-21)
- [Response](#response-21) - [Response](#response-21)
- [HTTP](#http-22) - [HTTP](#http-22)
+ [Transfer Site](#transfer-site) + [Get Site](#get-site)
- [Request](#request-22) - [Request](#request-22)
- [Response](#response-22) - [Response](#response-22)
- [HTTP](#http-23) - [HTTP](#http-23)
+ [Get Site Config](#get-site-config) + [Transfer Site](#transfer-site)
- [Request](#request-23) - [Request](#request-23)
- [Response](#response-23) - [Response](#response-23)
- [HTTP](#http-24) - [HTTP](#http-24)
+ [Save Site Config](#save-site-config) + [Get Site Config](#get-site-config)
- [Request](#request-24) - [Request](#request-24)
- [Response](#response-24) - [Response](#response-24)
- [HTTP](#http-25) - [HTTP](#http-25)
* [Community](#community) + [Save Site Config](#save-site-config)
+ [Get Community](#get-community)
- [Request](#request-25) - [Request](#request-25)
- [Response](#response-25) - [Response](#response-25)
- [HTTP](#http-26) - [HTTP](#http-26)
+ [Create Community](#create-community) * [Community](#community)
+ [Get Community](#get-community)
- [Request](#request-26) - [Request](#request-26)
- [Response](#response-26) - [Response](#response-26)
- [HTTP](#http-27) - [HTTP](#http-27)
+ [List Communities](#list-communities) + [Create Community](#create-community)
- [Request](#request-27) - [Request](#request-27)
- [Response](#response-27) - [Response](#response-27)
- [HTTP](#http-28) - [HTTP](#http-28)
+ [Ban from Community](#ban-from-community) + [List Communities](#list-communities)
- [Request](#request-28) - [Request](#request-28)
- [Response](#response-28) - [Response](#response-28)
- [HTTP](#http-29) - [HTTP](#http-29)
+ [Add Mod to Community](#add-mod-to-community) + [Ban from Community](#ban-from-community)
- [Request](#request-29) - [Request](#request-29)
- [Response](#response-29) - [Response](#response-29)
- [HTTP](#http-30) - [HTTP](#http-30)
+ [Edit Community](#edit-community) + [Add Mod to Community](#add-mod-to-community)
- [Request](#request-30) - [Request](#request-30)
- [Response](#response-30) - [Response](#response-30)
- [HTTP](#http-31) - [HTTP](#http-31)
+ [Delete Community](#delete-community) + [Edit Community](#edit-community)
- [Request](#request-31) - [Request](#request-31)
- [Response](#response-31) - [Response](#response-31)
- [HTTP](#http-32) - [HTTP](#http-32)
+ [Remove Community](#remove-community) + [Delete Community](#delete-community)
- [Request](#request-32) - [Request](#request-32)
- [Response](#response-32) - [Response](#response-32)
- [HTTP](#http-33) - [HTTP](#http-33)
+ [Follow Community](#follow-community) + [Remove Community](#remove-community)
- [Request](#request-33) - [Request](#request-33)
- [Response](#response-33) - [Response](#response-33)
- [HTTP](#http-34) - [HTTP](#http-34)
+ [Get Followed Communities](#get-followed-communities) + [Follow Community](#follow-community)
- [Request](#request-34) - [Request](#request-34)
- [Response](#response-34) - [Response](#response-34)
- [HTTP](#http-35) - [HTTP](#http-35)
+ [Transfer Community](#transfer-community) + [Get Followed Communities](#get-followed-communities)
- [Request](#request-35) - [Request](#request-35)
- [Response](#response-35) - [Response](#response-35)
- [HTTP](#http-36) - [HTTP](#http-36)
* [Post](#post) + [Transfer Community](#transfer-community)
+ [Create Post](#create-post)
- [Request](#request-36) - [Request](#request-36)
- [Response](#response-36) - [Response](#response-36)
- [HTTP](#http-37) - [HTTP](#http-37)
+ [Get Post](#get-post) * [Post](#post)
+ [Create Post](#create-post)
- [Request](#request-37) - [Request](#request-37)
- [Response](#response-37) - [Response](#response-37)
- [HTTP](#http-38) - [HTTP](#http-38)
+ [Get Posts](#get-posts) + [Get Post](#get-post)
- [Request](#request-38) - [Request](#request-38)
- [Response](#response-38) - [Response](#response-38)
- [HTTP](#http-39) - [HTTP](#http-39)
+ [Create Post Like](#create-post-like) + [Get Posts](#get-posts)
- [Request](#request-39) - [Request](#request-39)
- [Response](#response-39) - [Response](#response-39)
- [HTTP](#http-40) - [HTTP](#http-40)
+ [Edit Post](#edit-post) + [Create Post Like](#create-post-like)
- [Request](#request-40) - [Request](#request-40)
- [Response](#response-40) - [Response](#response-40)
- [HTTP](#http-41) - [HTTP](#http-41)
+ [Delete Post](#delete-post) + [Edit Post](#edit-post)
- [Request](#request-41) - [Request](#request-41)
- [Response](#response-41) - [Response](#response-41)
- [HTTP](#http-42) - [HTTP](#http-42)
+ [Remove Post](#remove-post) + [Delete Post](#delete-post)
- [Request](#request-42) - [Request](#request-42)
- [Response](#response-42) - [Response](#response-42)
- [HTTP](#http-43) - [HTTP](#http-43)
+ [Lock Post](#lock-post) + [Remove Post](#remove-post)
- [Request](#request-43) - [Request](#request-43)
- [Response](#response-43) - [Response](#response-43)
- [HTTP](#http-44) - [HTTP](#http-44)
+ [Sticky Post](#sticky-post) + [Lock Post](#lock-post)
- [Request](#request-44) - [Request](#request-44)
- [Response](#response-44) - [Response](#response-44)
- [HTTP](#http-45) - [HTTP](#http-45)
+ [Save Post](#save-post) + [Sticky Post](#sticky-post)
- [Request](#request-45) - [Request](#request-45)
- [Response](#response-45) - [Response](#response-45)
- [HTTP](#http-46) - [HTTP](#http-46)
* [Comment](#comment) + [Save Post](#save-post)
+ [Create Comment](#create-comment)
- [Request](#request-46) - [Request](#request-46)
- [Response](#response-46) - [Response](#response-46)
- [HTTP](#http-47) - [HTTP](#http-47)
+ [Edit Comment](#edit-comment) * [Comment](#comment)
+ [Create Comment](#create-comment)
- [Request](#request-47) - [Request](#request-47)
- [Response](#response-47) - [Response](#response-47)
- [HTTP](#http-48) - [HTTP](#http-48)
+ [Delete Comment](#delete-comment) + [Edit Comment](#edit-comment)
- [Request](#request-48) - [Request](#request-48)
- [Response](#response-48) - [Response](#response-48)
- [HTTP](#http-49) - [HTTP](#http-49)
+ [Remove Comment](#remove-comment) + [Delete Comment](#delete-comment)
- [Request](#request-49) - [Request](#request-49)
- [Response](#response-49) - [Response](#response-49)
- [HTTP](#http-50) - [HTTP](#http-50)
+ [Mark Comment as Read](#mark-comment-as-read) + [Remove Comment](#remove-comment)
- [Request](#request-50) - [Request](#request-50)
- [Response](#response-50) - [Response](#response-50)
- [HTTP](#http-51) - [HTTP](#http-51)
+ [Save Comment](#save-comment) + [Get Comments](#get-comments)
- [Request](#request-51) - [Request](#request-51)
- [Response](#response-51) - [Response](#response-51)
- [HTTP](#http-52) - [HTTP](#http-52)
+ [Create Comment Like](#create-comment-like) + [Mark Comment as Read](#mark-comment-as-read)
- [Request](#request-52) - [Request](#request-52)
- [Response](#response-52) - [Response](#response-52)
- [HTTP](#http-53) - [HTTP](#http-53)
+ [Save Comment](#save-comment)
- [Request](#request-53)
- [Response](#response-53)
- [HTTP](#http-54)
+ [Create Comment Like](#create-comment-like)
- [Request](#request-54)
- [Response](#response-54)
- [HTTP](#http-55)
* [RSS / Atom feeds](#rss--atom-feeds) * [RSS / Atom feeds](#rss--atom-feeds)
+ [All](#all) + [All](#all)
+ [Community](#community-1) + [Community](#community-1)
@ -1787,6 +1795,38 @@ Only a mod or admin can remove the comment.
`POST /comment/remove` `POST /comment/remove`
#### Get Comments
Comment listing types are `All, Subscribed, Community`
##### Request
```rust
{
op: "GetComments",
data: {
type_: String,
sort: String,
page: Option<i64>,
limit: Option<i64>,
community_id: Option<i32>,
community_name: Option<String>,
auth: Option<String>
}
}
```
##### Response
```rust
{
op: "GetComments",
data: {
comments: Vec<CommentView>,
}
}
```
##### HTTP
`GET /comment/list`
#### Mark Comment as Read #### Mark Comment as Read
Only the recipient can do this. Only the recipient can do this.

2
install.sh vendored
View file

@ -29,7 +29,7 @@ ask_to_init_db() {
done done
if [ "$init_db_final" = 1 ] if [ "$init_db_final" = 1 ]
then then
source ./server/db-init.sh source ./db-init.sh
read -n 1 -s -r -p "Press ANY KEY to continue execution of this script, press CTRL+C to quit..." read -n 1 -s -r -p "Press ANY KEY to continue execution of this script, press CTRL+C to quit..."
echo echo
fi fi

View file

@ -68,6 +68,7 @@ pub struct GetComments {
pub page: Option<i64>, pub page: Option<i64>,
pub limit: Option<i64>, pub limit: Option<i64>,
pub community_id: Option<i32>, pub community_id: Option<i32>,
pub community_name: Option<String>,
pub auth: Option<String>, pub auth: Option<String>,
} }

View file

@ -129,3 +129,13 @@ pub struct TransferCommunity {
pub user_id: i32, pub user_id: i32,
pub auth: String, pub auth: String,
} }
#[derive(Deserialize, Debug)]
pub struct CommunityJoin {
pub community_id: i32,
}
#[derive(Serialize, Clone)]
pub struct CommunityJoinResponse {
pub joined: bool,
}

View file

@ -103,3 +103,13 @@ pub struct SavePost {
pub save: bool, pub save: bool,
pub auth: String, pub auth: String,
} }
#[derive(Deserialize, Debug)]
pub struct PostJoin {
pub post_id: i32,
}
#[derive(Serialize, Clone)]
pub struct PostJoinResponse {
pub joined: bool,
}

View file

@ -235,5 +235,5 @@ pub struct UserJoin {
#[derive(Serialize, Clone)] #[derive(Serialize, Clone)]
pub struct UserJoinResponse { pub struct UserJoinResponse {
pub user_id: i32, pub joined: bool,
} }

View file

@ -1,7 +1,7 @@
use crate::{schema::activity, Crud}; use crate::{schema::activity, Crud};
use diesel::{dsl::*, result::Error, *}; use diesel::{dsl::*, result::Error, *};
use log::debug; use log::debug;
use serde::{Serialize}; use serde::Serialize;
use serde_json::Value; use serde_json::Value;
use std::{ use std::{
fmt::Debug, fmt::Debug,

View file

@ -3,7 +3,7 @@ use crate::{
Crud, Crud,
}; };
use diesel::{dsl::*, result::Error, *}; use diesel::{dsl::*, result::Error, *};
use serde::{Serialize}; use serde::Serialize;
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize)] #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize)]
#[table_name = "category"] #[table_name = "category"]

View file

@ -84,9 +84,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "comment_fast_view"] #[table_name = "comment_fast_view"]
pub struct CommentView { pub struct CommentView {
pub id: i32, pub id: i32,
@ -132,6 +130,7 @@ pub struct CommentQueryBuilder<'a> {
listing_type: ListingType, listing_type: ListingType,
sort: &'a SortType, sort: &'a SortType,
for_community_id: Option<i32>, for_community_id: Option<i32>,
for_community_name: Option<String>,
for_post_id: Option<i32>, for_post_id: Option<i32>,
for_creator_id: Option<i32>, for_creator_id: Option<i32>,
search_term: Option<String>, search_term: Option<String>,
@ -153,6 +152,7 @@ impl<'a> CommentQueryBuilder<'a> {
listing_type: ListingType::All, listing_type: ListingType::All,
sort: &SortType::New, sort: &SortType::New,
for_community_id: None, for_community_id: None,
for_community_name: None,
for_post_id: None, for_post_id: None,
for_creator_id: None, for_creator_id: None,
search_term: None, search_term: None,
@ -188,6 +188,11 @@ impl<'a> CommentQueryBuilder<'a> {
self self
} }
pub fn for_community_name<T: MaybeOptional<String>>(mut self, for_community_name: T) -> Self {
self.for_community_name = for_community_name.get_optional();
self
}
pub fn search_term<T: MaybeOptional<String>>(mut self, search_term: T) -> Self { pub fn search_term<T: MaybeOptional<String>>(mut self, search_term: T) -> Self {
self.search_term = search_term.get_optional(); self.search_term = search_term.get_optional();
self self
@ -233,6 +238,10 @@ impl<'a> CommentQueryBuilder<'a> {
query = query.filter(community_id.eq(for_community_id)); query = query.filter(community_id.eq(for_community_id));
} }
if let Some(for_community_name) = self.for_community_name {
query = query.filter(community_name.eq(for_community_name));
}
if let Some(for_post_id) = self.for_post_id { if let Some(for_post_id) = self.for_post_id {
query = query.filter(post_id.eq(for_post_id)); query = query.filter(post_id.eq(for_post_id));
}; };

View file

@ -123,9 +123,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "community_fast_view"] #[table_name = "community_fast_view"]
pub struct CommunityView { pub struct CommunityView {
pub id: i32, pub id: i32,

View file

@ -1,6 +1,6 @@
use crate::limit_and_offset; use crate::limit_and_offset;
use diesel::{result::Error, *}; use diesel::{result::Error, *};
use serde::{Serialize}; use serde::Serialize;
table! { table! {
mod_remove_post_view (id) { mod_remove_post_view (id) {
@ -17,9 +17,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "mod_remove_post_view"] #[table_name = "mod_remove_post_view"]
pub struct ModRemovePostView { pub struct ModRemovePostView {
pub id: i32, pub id: i32,
@ -77,9 +75,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "mod_lock_post_view"] #[table_name = "mod_lock_post_view"]
pub struct ModLockPostView { pub struct ModLockPostView {
pub id: i32, pub id: i32,
@ -136,9 +132,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "mod_sticky_post_view"] #[table_name = "mod_sticky_post_view"]
pub struct ModStickyPostView { pub struct ModStickyPostView {
pub id: i32, pub id: i32,
@ -200,9 +194,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "mod_remove_comment_view"] #[table_name = "mod_remove_comment_view"]
pub struct ModRemoveCommentView { pub struct ModRemoveCommentView {
pub id: i32, pub id: i32,
@ -264,9 +256,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "mod_remove_community_view"] #[table_name = "mod_remove_community_view"]
pub struct ModRemoveCommunityView { pub struct ModRemoveCommunityView {
pub id: i32, pub id: i32,
@ -320,9 +310,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "mod_ban_from_community_view"] #[table_name = "mod_ban_from_community_view"]
pub struct ModBanFromCommunityView { pub struct ModBanFromCommunityView {
pub id: i32, pub id: i32,
@ -381,9 +369,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "mod_ban_view"] #[table_name = "mod_ban_view"]
pub struct ModBanView { pub struct ModBanView {
pub id: i32, pub id: i32,
@ -435,9 +421,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "mod_add_community_view"] #[table_name = "mod_add_community_view"]
pub struct ModAddCommunityView { pub struct ModAddCommunityView {
pub id: i32, pub id: i32,
@ -492,9 +476,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "mod_add_view"] #[table_name = "mod_add_view"]
pub struct ModAddView { pub struct ModAddView {
pub id: i32, pub id: i32,

View file

@ -1,7 +1,7 @@
use super::post_view::post_fast_view::BoxedQuery; use super::post_view::post_fast_view::BoxedQuery;
use crate::{fuzzy_search, limit_and_offset, ListingType, MaybeOptional, SortType}; use crate::{fuzzy_search, limit_and_offset, ListingType, MaybeOptional, SortType};
use diesel::{dsl::*, pg::Pg, result::Error, *}; use diesel::{dsl::*, pg::Pg, result::Error, *};
use serde::{Serialize}; use serde::Serialize;
// The faked schema since diesel doesn't do views // The faked schema since diesel doesn't do views
table! { table! {
@ -106,9 +106,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "post_fast_view"] #[table_name = "post_fast_view"]
pub struct PostView { pub struct PostView {
pub id: i32, pub id: i32,

View file

@ -1,6 +1,6 @@
use crate::{limit_and_offset, MaybeOptional}; use crate::{limit_and_offset, MaybeOptional};
use diesel::{pg::Pg, result::Error, *}; use diesel::{pg::Pg, result::Error, *};
use serde::{Serialize}; use serde::Serialize;
// The faked schema since diesel doesn't do views // The faked schema since diesel doesn't do views
table! { table! {
@ -28,9 +28,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "private_message_view"] #[table_name = "private_message_view"]
pub struct PrivateMessageView { pub struct PrivateMessageView {
pub id: i32, pub id: i32,

View file

@ -1,5 +1,5 @@
use diesel::{result::Error, *}; use diesel::{result::Error, *};
use serde::{Serialize}; use serde::Serialize;
table! { table! {
site_view (id) { site_view (id) {
@ -24,9 +24,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "site_view"] #[table_name = "site_view"]
pub struct SiteView { pub struct SiteView {
pub id: i32, pub id: i32,

View file

@ -6,7 +6,7 @@ use crate::{
}; };
use bcrypt::{hash, DEFAULT_COST}; use bcrypt::{hash, DEFAULT_COST};
use diesel::{dsl::*, result::Error, *}; use diesel::{dsl::*, result::Error, *};
use serde::{Serialize}; use serde::Serialize;
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)] #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
#[table_name = "user_"] #[table_name = "user_"]

View file

@ -1,6 +1,6 @@
use crate::{limit_and_offset, MaybeOptional, SortType}; use crate::{limit_and_offset, MaybeOptional, SortType};
use diesel::{dsl::*, pg::Pg, result::Error, *}; use diesel::{dsl::*, pg::Pg, result::Error, *};
use serde::{Serialize}; use serde::Serialize;
// The faked schema since diesel doesn't do views // The faked schema since diesel doesn't do views
table! { table! {
@ -83,9 +83,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "user_mention_fast_view"] #[table_name = "user_mention_fast_view"]
pub struct UserMentionView { pub struct UserMentionView {
pub id: i32, pub id: i32,

View file

@ -1,7 +1,7 @@
use super::user_view::user_fast::BoxedQuery; use super::user_view::user_fast::BoxedQuery;
use crate::{fuzzy_search, limit_and_offset, MaybeOptional, SortType}; use crate::{fuzzy_search, limit_and_offset, MaybeOptional, SortType};
use diesel::{dsl::*, pg::Pg, result::Error, *}; use diesel::{dsl::*, pg::Pg, result::Error, *};
use serde::{Serialize}; use serde::Serialize;
table! { table! {
user_view (id) { user_view (id) {
@ -51,9 +51,7 @@ table! {
} }
} }
#[derive( #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
)]
#[table_name = "user_fast"] #[table_name = "user_fast"]
pub struct UserView { pub struct UserView {
pub id: i32, pub id: i32,

View file

@ -13,7 +13,6 @@ pub struct Settings {
pub bind: IpAddr, pub bind: IpAddr,
pub port: u16, pub port: u16,
pub jwt_secret: String, pub jwt_secret: String,
pub front_end_dir: String,
pub pictrs_url: String, pub pictrs_url: String,
pub rate_limit: RateLimitConfig, pub rate_limit: RateLimitConfig,
pub email: Option<EmailConfig>, pub email: Option<EmailConfig>,
@ -88,7 +87,7 @@ impl Settings {
/// added to the config. /// added to the config.
/// ///
/// Note: The env var `LEMMY_DATABASE_URL` is parsed in /// Note: The env var `LEMMY_DATABASE_URL` is parsed in
/// `server/lemmy_db/src/lib.rs::get_database_url_from_env()` /// `lemmy_db/src/lib.rs::get_database_url_from_env()`
fn init() -> Result<Self, ConfigError> { fn init() -> Result<Self, ConfigError> {
let mut s = Config::new(); let mut s = Config::new();

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