-
-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fd400aa
Showing
88 changed files
with
9,776 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"presets": [ | ||
"next/babel" | ||
], | ||
"plugins": [ | ||
[ | ||
"babel-plugin-transform-imports", | ||
{ | ||
"@material-ui/core": { | ||
"transform": "@material-ui/core/${member}", | ||
"preventFullImport": true | ||
}, | ||
"@material-ui/icons": { | ||
"transform": "@material-ui/icons/${member}", | ||
"preventFullImport": true | ||
} | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module.exports = { | ||
'extends': ['next', 'next/core-web-vitals'], | ||
'rules': { | ||
'indent': ['error', 2], | ||
'linebreak-style': ['error', 'unix'], | ||
'quotes': ['error', 'single'], | ||
'semi': ['error', 'always'], | ||
'jsx-quotes': ['error', 'prefer-single'], | ||
'react/prop-types': 'off', | ||
'react-hooks/rules-of-hooks': 'off', | ||
'react-hooks/exhaustive-deps': 'off', | ||
'react/jsx-uses-react': 'warn', | ||
'react/jsx-uses-vars': 'warn', | ||
'react/no-danger-with-children': 'warn', | ||
'react/no-deprecated': 'warn', | ||
'react/no-direct-mutation-state': 'warn', | ||
'react/no-is-mounted': 'warn', | ||
'react/no-typos': 'error', | ||
'react/react-in-jsx-scope': 'error', | ||
'react/require-render-return': 'error', | ||
'react/style-prop-object': 'warn', | ||
'@next/next/no-img-element': 'off' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: 'CI: Build' | ||
|
||
on: | ||
push: | ||
branches: [ trunk ] | ||
pull_request: | ||
branches: [ trunk ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '16.x' | ||
- name: 'Restore dependency cache' | ||
id: cache-restore | ||
uses: actions/cache@v2 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-node${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Create mock config | ||
run: echo -e "[uploader]\nroute = '/u'\nembed_route = '/a'\nlength = 6\ndirectory = './uploads'" > config.toml | ||
|
||
- name: Install dependencies | ||
if: steps.cache-restore.outputs.cache-hit != 'true' | ||
run: yarn install | ||
|
||
- name: Build | ||
run: yarn build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: 'CD: Push Docker Images' | ||
|
||
on: | ||
push: | ||
branches: [ trunk ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
push_to_ghcr: | ||
name: Push Image to GitHub Packages | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Push to GitHub Packages | ||
uses: docker/build-push-action@v1 | ||
with: | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
registry: docker.pkg.github.com | ||
repository: diced/zipline/zipline | ||
dockerfile: Dockerfile | ||
tag_with_ref: true | ||
|
||
push_to_dockerhub: | ||
name: Push Image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Push to Docker Hub | ||
uses: docker/build-push-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
repository: diced/zipline | ||
dockerfile: Dockerfile | ||
tag_with_ref: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# zipline | ||
config.toml | ||
uploads/ | ||
prisma/schema.prisma | ||
data.db* | ||
migrations/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn commitlint --edit $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM node:16-alpine3.11 AS builder | ||
WORKDIR /build | ||
|
||
COPY src ./src | ||
COPY server ./server | ||
COPY scripts ./scripts | ||
COPY prisma/schema.shared.prisma ./prisma/schema.shared.prisma | ||
|
||
COPY package.json yarn.lock next.config.js next-env.d.ts tsconfig.json ./ | ||
|
||
RUN yarn install | ||
|
||
# create a mock config.toml to spoof next build! | ||
RUN echo -e "[uploader]\nroute = '/u'\nembed_route = '/a'\nlength = 6\ndirectory = './uploads'" > config.toml | ||
|
||
RUN yarn build | ||
|
||
FROM node:16-alpine3.11 AS runner | ||
WORKDIR /zipline | ||
|
||
COPY --from=builder /build/node_modules ./node_modules | ||
|
||
COPY --from=builder /build/src ./src | ||
COPY --from=builder /build/server ./server | ||
COPY --from=builder /build/scripts ./scripts | ||
COPY --from=builder /build/.next ./.next | ||
COPY --from=builder /build/tsconfig.json ./tsconfig.json | ||
COPY --from=builder /build/package.json ./package.json | ||
|
||
CMD ["node", "server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
prisma/migrations | ||
node_modules | ||
.next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<p align="center"><img src="https://raw.githubusercontent.com/diced/zipline/trunk/public/zipline_small.png"/></p> | ||
|
||
![Version](https://img.shields.io/github/package-json/v/diced/zipline) | ||
![LICENCE](https://img.shields.io/github/license/diced/zipline) | ||
[![Discord](https://img.shields.io/discord/729771078196527176)](https://discord.gg/AtTSecwqeV) | ||
![Stars](https://img.shields.io/github/stars/diced/zipline) | ||
![GitHub repo size](https://img.shields.io/github/repo-size/diced/zipline) | ||
![GitHub last commit (branch)](https://img.shields.io/github/last-commit/diced/zipline/trunk) | ||
<br> | ||
|
||
# Zipline | ||
|
||
Fast & lightweight file uploading. | ||
|
||
# Features | ||
|
||
- Configurable | ||
- Fast | ||
- Built with Next.js & React | ||
- Support for **multible database types** | ||
- Token protected uploading | ||
- Easy setup instructions on [docs](https://zipline.diced.me) | ||
|
||
# Installing | ||
|
||
[See how to install here](https://zipline.diced.me/docs/getting-started) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
module.exports = { | ||
parserPreset: 'conventional-changelog-conventionalcommits', | ||
rules: { | ||
'body-leading-blank': [1, 'always'], | ||
'body-max-line-length': [2, 'always', 100], | ||
'footer-leading-blank': [1, 'always'], | ||
'footer-max-line-length': [2, 'always', 100], | ||
'header-max-length': [2, 'always', 100], | ||
'subject-case': [ | ||
2, | ||
'never', | ||
['sentence-case', 'start-case', 'pascal-case', 'upper-case'], | ||
], | ||
'subject-empty': [2, 'never'], | ||
'subject-full-stop': [2, 'never', '.'], | ||
'type-case': [2, 'always', 'lower-case'], | ||
'type-empty': [2, 'never'], | ||
'type-enum': [ | ||
2, | ||
'always', | ||
[ | ||
'build', | ||
'chore', | ||
'ci', | ||
'docs', | ||
'feat', | ||
'fix', | ||
'perf', | ||
'refactor', | ||
'revert', | ||
'style', | ||
'test', | ||
], | ||
], | ||
'scope-enum': [ | ||
1, | ||
'always', | ||
[ | ||
'prisma', | ||
'scripts', | ||
'server', | ||
'pages', | ||
'api', | ||
'hooks', | ||
'components', | ||
'middleware', | ||
'redux', | ||
'themes', | ||
'lib' | ||
], | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[core] | ||
secure = true | ||
secret = 'some secret' | ||
host = '0.0.0.0' | ||
port = 3000 | ||
|
||
[database] | ||
# postgresql | ||
type = 'psql' | ||
url = 'postgres://postgres:postgres@postgres/postgres' | ||
|
||
# mysql | ||
# type = 'mysql' | ||
# url = 'mysql://postgres:postgres@mysql/mysql' | ||
|
||
# sqlite | ||
# type = 'sqlite' | ||
# url = 'file:sqlite.db' | ||
|
||
[uploader] | ||
route = '/u' | ||
embed_route = '/a' | ||
length = 6 | ||
directory = './uploads' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
version: '3' | ||
services: | ||
postgres: | ||
image: postgres | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
- POSTGRES_DATABASE=postgres | ||
volumes: | ||
- pg_data:/var/lib/postgresql/data | ||
healthcheck: | ||
test: ['CMD-SHELL', 'pg_isready -U postgres'] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
zipline: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- '3000:3000' | ||
restart: unless-stopped | ||
environment: | ||
- SECURE=false | ||
- SECRET=changethis | ||
- HOST=0.0.0.0 | ||
- PORT=3000 | ||
- DATABASE_TYPE=psql | ||
- DATABASE_URL=postgresql://postgres:postgres@postgres/postgres/ | ||
- UPLOADER_ROUTE=/u | ||
- UPLOADER_EMBED_ROUTE=/a | ||
- UPLOADER_LENGTH=6 | ||
- UPLOADER_DIRECTORY=./uploads | ||
volumes: | ||
- '$PWD/uploads:/zipline/uploads' | ||
- '$PWD/prisma:/zipline/prisma' | ||
- '$PWD/public:/zipline/public' | ||
depends_on: | ||
- 'postgres' | ||
|
||
volumes: | ||
pg_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/types/global" /> | ||
|
||
import type { PrismaClient } from '@prisma/client'; | ||
import type { Config } from './src/lib/types'; | ||
|
||
declare global { | ||
namespace NodeJS { | ||
interface Global { | ||
prisma: PrismaClient; | ||
config: Config | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
reactStrictMode: true, | ||
}; | ||
|
Oops, something went wrong.