Skip to content

Commit

Permalink
repo restructured (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronleopold authored Jun 16, 2022
1 parent b9b35e2 commit 2b98498
Show file tree
Hide file tree
Showing 310 changed files with 137 additions and 147 deletions.
2 changes: 1 addition & 1 deletion packages/core/.dockerignore → .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
node_modules
build
static
client
core/client
target
*.lock
*.log
Expand Down
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
*.sql linguist-detectable=false

# I don't want website to be included in language stats
packages/website/** linguist-vendored
apps/website/** linguist-vendored
4 changes: 2 additions & 2 deletions .github/scripts/setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if (-NOT (Get-Command pnpm -errorAction SilentlyContinue)) {
write-host "Attempting to install 'cargo-watch':"
cargo install cargo-watch

write-host "Running 'pnpm core setup':"
write-host "Running 'pnpm run setup':"
pnpm run setup

write-host "Pre-setup completed! Run 'pnpm core dev' or 'pnpm core start' to get started."
write-host "Pre-setup completed! Run 'pnpm dev' or 'pnpm start' to get started."
8 changes: 4 additions & 4 deletions .github/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,26 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then

cargo install cargo-watch

echo "Running 'pnpm core setup':"
echo "Running 'pnpm run setup':"
echo

pnpm run setup

echo
echo "Pre-setup completed! Run 'pnpm core dev' to get started."
echo "Pre-setup completed! Run 'pnpm dev' to get started."
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo
echo "Attempting to install 'cargo-watch':"
echo

cargo install cargo-watch

echo "Running 'pnpm core setup':"
echo "Running 'pnpm run setup':"
echo
pnpm run setup

echo
echo "Pre-setup completed! Run 'pnpm core dev' to get started."
echo "Pre-setup completed! Run 'pnpm dev' to get started."
else
echo "Your OS '$OSTYPE' is not supported by the pre-setup script. Please consider adding support for it: https://github.com/aaronleopold/stump/issues"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ build
# rust
static
target
client
core/client
*.db*
*.sqlite*
*prisma.rs*
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[workspace]
members = ["packages/core/server", "packages/core/server/prisma-cli"]
members = ["core", "core/prisma-cli"]
10 changes: 2 additions & 8 deletions packages/core/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM node:16-alpine3.14 as frontend

WORKDIR /home/stump

COPY frontend/ .
COPY apps/client/ .

RUN npm install
RUN npm run build
Expand All @@ -19,17 +19,11 @@ FROM rust:1-alpine3.15 as builder

ENV RUSTFLAGS="-C target-feature=-crt-static"

# https://github.com/briansmith/ring/issues/1414 -> TLDR; might have to add musl-tools clang llvm and
# the following:
# ENV CC_aarch64_unknown_linux_musl=clang
# ENV AR_aarch64_unknown_linux_musl=llvm-ar
# ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld"

RUN apk add --no-cache --verbose musl-dev build-base sqlite openssl-dev

WORKDIR /home/stump

COPY server/ .
COPY core/ .

RUN cargo build --release --target=x86_64-unknown-linux-musl

Expand Down
43 changes: 26 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,33 +51,34 @@ For information about getting started, how Stump works and manages your library

I am ommitting a lot of files and only focusing on the main directories, but the following is the structure of the project:

```bash
```
.
├── packages
│   ├── core
│   │   ├── frontend
│   │   └── server
│   │   ├── prisma
│   │   ├── prisma-cli
│   │   └── src
├── apps
│   ├── client
│   │   └── src
│   └── website
│      └── src
├── core
│   ├── prisma
│   ├── prisma-cli
│   └── src
├── README.md
└── ...
```

### Core

The core package is where Stump's core functionality is located.
The core directory is where Stump's 'core' functionality is located, written in Rust.

`server`: This is the bulk of Stump's functionality. It is a Rocket server.
<!-- TODO: mention prisma -->

`frontend`: The frontend directory is where the web client is located. It is a static React application that is served by Stump.
### Apps

<!-- This file is used to seed the database with data. -->
The 'apps' directory is where Stump applications are located. These are separate from the Rust core, and are individual applications.

### Website
`client`: A React application that is served by a Stump server. This is the primary web-client for interacting with a Stump server.

The website package contains a Next.js application for the Stump landing page and documentation pages. The documentation aspect is created using [Markdoc](https://markdoc.io/). This code gets deployed to [stumpapp.dev](http://stumpapp.dev)
`website`: A Next.js application for the Stump landing site and documentation pages. The documentation is created using [Markdoc](https://markdoc.io/). This code gets deployed to [stumpapp.dev](http://stumpapp.dev)

## Development Setup

Expand All @@ -89,6 +90,8 @@ There is now a setup script that handles most of the initial configuration, howe

> If you feel that your system is already configured for development, you may skip this step and run `cargo install cargo-watch` and `pnpm run setup`. I highly recommend using the script, however.
> **Note**: If you are on a Windows machine, you will need [Visual C++](https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170) installed on your system.
If you are on a Windows machine, you'll need to run the following:

```
Expand All @@ -110,14 +113,20 @@ If you face any issues running these, or are using a system that is not supporte
To start the application for development, simply run:

```bash
pnpm core dev
pnpm dev
```

This will start both the vite dev server and the rust server, watching for changes. You can also run the server and the frontend in separate processes:

```bash
pnpm core server:dev # start the server
pnpm core frontend:dev # start the frontend
pnpm core dev # start the Stump server
pnpm client dev # start the web client
```

To run in a release profile, you would just need to run:

```bash
pnpm core start
```

## License
Expand Down
7 changes: 7 additions & 0 deletions apps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# apps

The 'apps' directory is where Stump applications are located. These are separate from the Rust core, and are individual applications.

`client`: A React application that is served by a Stump server. This is the primary web-client for interacting with a Stump server.

`website`: A Next.js application for the Stump landing site and documentation pages. The documentation is created using [Markdoc](https://markdoc.io/). This code gets deployed to [stumpapp.dev](http://stumpapp.dev)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "frontend",
"name": "@stump/client",
"private": true,
"version": "0.0.1",
"homepage": ".",
"scripts": {
"dev": "vite --host",
"build": "vite build",
"preview": "vite preview --port 3000"
"preview": "vite preview --port 3000",
"unimported": "npx unimported"
},
"dependencies": {
"@chakra-ui/react": "^2.0.0",
Expand Down Expand Up @@ -55,6 +56,8 @@
"tailwind-scrollbar-hide": "^1.1.7",
"tailwindcss": "^3.0.24",
"typescript": "^4.7.2",
"vite": "^2.9.9"
"vite": "^2.9.9",
"move-cli": "2.0.0",
"trash-cli": "^5.0.0"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo } from 'react';
import React from 'react';
import { Box, Heading, HStack, useColorModeValue } from '@chakra-ui/react';
import { CaretLeft, CaretRight } from 'phosphor-react';
import Button from '../ui/Button';
Expand Down Expand Up @@ -62,13 +62,13 @@ export default function Topbar() {

const { showViewOptions, viewAsGrid, onViewModeChange } = useViewMode();

const truncatedTitle = useMemo(() => {
if (title.length <= 20) {
return title;
}
// const truncatedTitle = useMemo(() => {
// if (title.length <= 20) {
// return title;
// }

return `${title.substring(0, 20)}...`;
}, [title]);
// return `${title.substring(0, 20)}...`;
// }, [title]);

// TODO: fix this
return (
Expand All @@ -89,8 +89,8 @@ export default function Topbar() {
<Navigation />

{/* @ts-ignore: this seems to work, idky it has type error */}
<Heading as="h3" size={{ base: 'sm', md: 'md' }}>
{truncatedTitle}
<Heading as="h3" fontSize={{ base: 'sm', md: 'md' }} noOfLines={1}>
{title}
</Heading>
</HStack>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
titleTemplate: 'Stump | %s',
defaultTitle: 'Stump',
description:
'Free, open source, self-hosting for all your comic books, manga and digital book collections.',
'Free, open source, self-hosting for your comic books, manga and digital book collections.',
canonical: 'https://stumpapp.dev',
openGraph: {
type: 'website',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions apps/website/src/pages/guides/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# An Introduction to Stump

## What is Stump?

Stump is an open source, self hostable, media server for your comic books, manga, and other digital books. It is designed to be _easy to use_ and _easy to deploy_.

The short on how it works:

- Install and run Stump on a computer or NAS (Network Attached Storage).
- Configure your libraries (i.e. _where your media lives_), and Stump will take care of the rest.
- To read your media, you can use the web interface or any compatible client.

## What isn't Stump?

Stump **is not** a tool used for fetching or downloading any kind of media. It is a tool used to host and access **your own media**. You may think of it like a Plex server for your comic books/manga/etc. If you are unfamiliar with Plex, you can think of Stump as a personal Netflix, for comic books/manga/etc, that lives on a computer in your home (like a NAS).

## What's compatibility like?

Stump works on all major browsers and operating systems.

The hardware requirements vary and should serve **only as a guide**. Generally speaking, 1GB of RAM and disk space is more than enough. Stump also runs well on low-powered ARM-based single board computers, such as a Raspberry Pi (I personally host a Stump server on a Pi 4).

TODO
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Stump's REST API

Stump exposes a REST API that allows you to interact with your Stump server.

{% callout title="Note" icon="warning" %}
There is currently no official documentation for the REST API. However, this is an extremely important item on the roadmap and will be available before the first beta release.
{% /callout %}
Stump exposes a REST API that allows you to interact with your Stump server. If you already have your Stump server set up, you can view the API documentation by visiting `http(s)://your-server(:10801)/api/rapidoc`

## Authentication

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 1 addition & 5 deletions packages/core/server/Cargo.toml → core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stump"
version = "0.1.0"
version = "0.0.1"
edition = "2021"
default-run = "stump"

Expand Down Expand Up @@ -35,10 +35,6 @@ cuid = "1.2.0"
webp = "0.2.2"
image = "0.24.2"
include_dir = "0.7.2"
# TODO: make this *NOT* bundled in release, not necessary. I guess I would have to feature
# gate it? but that is just kinda annoying. Since I am pushing this feature off for now,
# hopefully the PR branch I am pointing to is merged, as well.
# rocket_okapi = { git = "https://github.com/ThouCheese/okapi", branch = "feat/rocket0.5-rc.2", features = ["rapidoc", "swagger"] }
rocket_okapi = { version = "0.8.0-rc.2", features = ["rapidoc", "swagger"] }
schemars = "0.8.10"
fern = "0.6.1"
Expand Down
1 change: 1 addition & 0 deletions core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: explain scripts and other basic information about this workspace
File renamed without changes.
17 changes: 17 additions & 0 deletions core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@stump/core",
"version": "0.0.1",
"description": "",
"keywords": [],
"license": "MIT",
"scripts": {
"setup": "cargo prisma generate && pnpm get-client",
"start": "cargo run --release",
"dev": "cargo watch -x run",
"build": "pnpm get-client && cargo build --release && pnpm move-client && pnpm move-rocket",
"get-client": "trash ./client && move-cli ../apps/client/build ./client",
"move-client": "trash ../target/release/client && cp -r ./client ../target/release/client",
"move-rocket": "trash ../target/release/Rocket.toml && cp ./Rocket.toml ../target/release/Rocket.toml",
"fmt": "cargo fmt --all --manifest-path=./Cargo.toml --"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 2b98498

Please sign in to comment.