Removing old UI, using new perseus UI.

pull/10/head
Heretic 1 year ago
parent c687186771
commit be6aa179f9

4
.gitmodules vendored

@ -1,7 +1,3 @@
[submodule "ui"]
path = ui
url = https://git.torrents-csv.ml/heretic/torrents-csv-ui
branch = main
[submodule "data"]
path = data
url = https://git.torrents-csv.ml/heretic/torrents-csv-data

@ -4,9 +4,9 @@
[Demo Server](https://torrents-csv.ml)
`Torrents.csv` is a _collaborative_ repository of torrents and their files, consisting of a searchable `torrents.csv`, and `torrent_files.csv`. With it you can search for torrents, or files within torrents. It aims to be a universal file system for popular data.
`Torrents.csv` is a _collaborative_ repository of torrents, consisting of a searchable `torrents.csv` file. It aims to be a universal file system for popular data.
Its initially populated with a January 2017 backup of the pirate bay, and new torrents are periodically added from various torrents sites. It comes with a self-hostable [Torrents.csv webserver](https://torrents-csv.ml), a command line search, and a folder scanner to add torrents, and their files.
Its initially populated with a January 2017 backup of the pirate bay, and new torrents are periodically added from various torrents sites. It comes with a self-hostable [Torrents.csv webserver](https://torrents-csv.ml), a command line search, and a folder scanner to add torrents.
`Torrents.csv` will only store torrents with at least one seeder to keep the file small, will be periodically purged of non-seeded torrents, and sorted by infohash.
@ -14,7 +14,7 @@ Its initially populated with a January 2017 backup of the pirate bay, and new to
To request more torrents, or add your own, go [here](https://git.torrents-csv.ml/heretic/torrents-csv-data).
Made with [Rust](https://www.rust-lang.org), [ripgrep](https://github.com/BurntSushi/ripgrep), [Actix](https://actix.rs/), [Inferno](https://www.infernojs.org), [Typescript](https://www.typescriptlang.org/).
Made with [Rust](https://www.rust-lang.org), [ripgrep](https://github.com/BurntSushi/ripgrep), [Actix](https://actix.rs/), [Perseus](https://framesurge.sh/perseus/en-US/), and [Sycamore](https://sycamore-rs.netlify.app/).
## Webserver
@ -24,10 +24,11 @@ Made with [Rust](https://www.rust-lang.org), [ripgrep](https://github.com/BurntS
```
wget https://git.torrents-csv.ml/heretic/torrents-csv-server/raw/branch/main/docker/prod/docker-compose.yml
wget https://git.torrents-csv.ml/heretic/torrents-csv-server/raw/branch/main/docker/prod/nginx.conf
docker-compose up -d
```
And goto http://localhost:8902
And goto http://localhost:8904
### Docker Development
@ -35,6 +36,7 @@ And goto http://localhost:8902
git clone --recurse-submodules https://git.torrents-csv.ml/heretic/torrents-csv-server
cd torrents-csv-server/docker/dev
./docker_update.sh
# For the front end, check out http://git.torrents-csv.ml/heretic/torrents-csv-ui-perseus
```
## Command Line Searching
@ -59,8 +61,8 @@ bleh season 1 (1993-)
A JSON output of search results is available at:
`http://localhost:8902/service/search?q=[QUERY]&size=[NUMBER_OF_RESULTS]&page=[PAGE]&type=[torrent | file]`
`http://localhost:8904/service/search?q=[QUERY]&size=[NUMBER_OF_RESULTS]&page=[PAGE]`
New torrents are at:
`http://localhost:8902/service/new?size=[NUMBER_OF_RESULTS]&page=[PAGE]&type=[torrent | file]`
`http://localhost:8904/service/new?size=[NUMBER_OF_RESULTS]&page=[PAGE]`

@ -1,15 +1,4 @@
ARG RUST_BUILDER_IMAGE=clux/muslrust:stable
# Front end
FROM node:alpine as node
WORKDIR /app/ui
# Cache deps
COPY ui/package.json ui/yarn.lock ./
RUN yarn install --pure-lockfile
# Build the UI
COPY ./ui /app/ui
RUN yarn build
# Build the torrents.db file
FROM alpine:3 as db_file_builder
@ -53,7 +42,6 @@ RUN addgroup -S myuser && adduser -S myuser -G myuser
# Copy resources
COPY --from=builder /app/torrents-csv-service /app/
COPY --from=node /app/ui/dist /app/dist
COPY --from=db_file_builder /app/torrents.db /app/torrents.db
EXPOSE 8080
USER myuser

@ -9,3 +9,4 @@ services:
environment:
TORRENTS_CSV_DB_FILE: /app/torrents.db
TORRENTS_CSV_FRONT_END_DIR: /app/dist
# You should run perseus locally to test

@ -1,17 +1,5 @@
ARG RUST_BUILDER_IMAGE=clux/muslrust:stable
# Front end
FROM node:alpine as node
WORKDIR /app/ui
# Cache deps
COPY ui/package.json ui/yarn.lock ./
RUN yarn install --pure-lockfile
# Build the UI
COPY ./ui /app/ui
RUN yarn build
# Build the torrents.db file
FROM alpine:3 as db_file_builder
RUN apk add sqlite bash
@ -54,7 +42,6 @@ RUN addgroup -S myuser && adduser -S myuser -G myuser
# Copy resources
COPY --from=builder /app/torrents-csv-service /app/
COPY --from=node /app/ui/dist /app/dist
COPY --from=db_file_builder /app/torrents.db /app/torrents.db
EXPOSE 8080
USER myuser

@ -1,11 +1,45 @@
version: '3.7'
networks:
# communication to web and clients
torrentsexternalproxy:
# communication between lemmy services
torrentsinternal:
driver: bridge
internal: true
services:
proxy:
image: nginx:1-alpine
networks:
- torrentsinternal
- torrentsexternalproxy
ports:
# actual and only port facing any connection from outside
- "8904:8904"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
restart: always
depends_on:
- torrents-csv
- torrents-csv-ui-perseus
torrents-csv:
image: dessalines/torrents-csv-server:latest
restart: always
ports:
- "8902:8902"
hostname: torrents-csv
networks:
- torrentsinternal
environment:
TORRENTS_CSV_DB_FILE: /app/torrents.db
TORRENTS_CSV_FRONT_END_DIR: /app/dist
torrents-csv-ui-perseus:
image: dessalines/torrents-csv-ui-perseus:latest
restart: always
networks:
- torrentsinternal
environment:
PERSEUS_HOST: "0.0.0.0"
TORRENTS_CSV_ENDPOINT: "http://torrents-csv:8902"

@ -0,0 +1,55 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
upstream torrents-csv {
server "torrents-csv:8902";
}
upstream torrents-csv-ui-perseus {
server "torrents-csv-ui-perseus:8080";
}
server {
# this is the port inside docker, not the public one yet
listen 8904;
# change if needed, this is facing the public web
server_name localhost;
server_tokens off;
gzip on;
gzip_types text/css application/javascript image/svg+xml;
gzip_vary on;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
# frontend general requests
location / {
set $proxpass "http://torrents-csv-ui-perseus";
proxy_pass $proxpass;
rewrite ^(.+)/+$ $1 permanent;
# Send actual client IP upstream
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# backend
location ~ ^/(service) {
proxy_pass "http://torrents-csv";
# proxy common stuff
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Send actual client IP upstream
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}

@ -6,8 +6,6 @@ extern crate serde_json;
extern crate serde_derive;
extern crate rusqlite;
use actix_files as fs;
use actix_files::NamedFile;
use actix_web::{middleware, web, App, HttpResponse, HttpServer};
use anyhow::{anyhow, Result};
use rusqlite::params;
@ -25,8 +23,6 @@ async fn main() -> io::Result<()> {
HttpServer::new(move || {
App::new()
.wrap(middleware::Logger::default())
.service(fs::Files::new("/static", front_end_dir()))
.route("/", web::get().to(index))
.route("/service/search", web::get().to(search))
})
.keep_alive(None)
@ -35,14 +31,6 @@ async fn main() -> io::Result<()> {
.await
}
async fn index() -> Result<NamedFile, actix_web::error::Error> {
Ok(NamedFile::open(front_end_dir() + "/index.html")?)
}
fn front_end_dir() -> String {
env::var("TORRENTS_CSV_FRONT_END_DIR").unwrap_or_else(|_| "./ui/dist".to_string())
}
fn torrents_db_file() -> String {
env::var("TORRENTS_CSV_DB_FILE").unwrap_or_else(|_| "./torrents.db".to_string())
}

1
ui

@ -1 +0,0 @@
Subproject commit 5961585fe1fc378c27549786e7e0a7b39f0a7b2d

@ -1,6 +1,5 @@
#!/bin/bash
git submodule update --remote
git add data
git add ui
git commit -m"Updating torrents-csv-data."
git push

Loading…
Cancel
Save