Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
5597c44
initial bugs
kaatrasalo Jun 23, 2024
4d6f3ae
footer now opens in a new tab
kaatrasalo Jun 23, 2024
eb212ea
changes
Masterjoona Jun 23, 2024
17a2bf7
husk solution
kaatrasalo Jun 23, 2024
5a4d508
unhusk the husk
kaatrasalo Jun 23, 2024
b70a9c1
fuck you
kaatrasalo Jun 23, 2024
95629a1
nvm you will not use
kaatrasalo Jun 23, 2024
265af01
about
Masterjoona Jun 23, 2024
16983e7
husk script + rework p
kaatrasalo Jun 23, 2024
5aa94a7
husk it did not push
kaatrasalo Jun 23, 2024
74a12b3
this should work :pray:
kaatrasalo Jun 23, 2024
cbc168a
svelte <3
kaatrasalo Jun 23, 2024
4f9c9b9
unfeast about me
kaatrasalo Jun 23, 2024
a818126
I ate a little too mcuh :3
kaatrasalo Jun 23, 2024
79f510c
make styling consistent
kaatrasalo Jun 23, 2024
cc7d534
chore: clean un-used import
kaatrasalo Jun 23, 2024
9b72e1d
Merge branch 'svelte' into docker-golte
kaatrasalo Jun 23, 2024
05e15a7
Merge pull request #1 from Masterjoona/docker-golte
kaatrasalo Jun 23, 2024
bdad079
Make golte build work
Masterjoona Jun 25, 2024
911bd55
Make golte build work
Masterjoona Jun 25, 2024
e6c330e
Merge branch 'svelte' of https://github.com/Masterjoona/pawste into s…
Masterjoona Jun 25, 2024
823f7b9
idk even know
Masterjoona Jun 25, 2024
6c565d7
how am i so good at deleting files
Masterjoona Jun 25, 2024
0330ba1
more testing
Masterjoona Jun 25, 2024
3474aac
feature: list & button functionality (+ improved /test to generate a …
kaatrasalo Jun 26, 2024
83fa684
chore: remove joonas insanity
kaatrasalo Jun 26, 2024
5f4b7a2
feat: custom scrollbar, fix: overflow now scrolls
kaatrasalo Jun 26, 2024
c56ab21
feat: toasts
Masterjoona Jun 26, 2024
d31d005
fix: pawste standard
Masterjoona Jun 26, 2024
45dc20f
move go thing to pkg/
Masterjoona Jun 28, 2024
a7fd037
fix docker build
Masterjoona Jun 28, 2024
fb56cb4
chore: styling
Masterjoona Jun 30, 2024
160db7a
troll
Masterjoona Jun 30, 2024
81343a0
more
Masterjoona Jun 30, 2024
5f3194b
chore: simplify code
Masterjoona Jul 2, 2024
abfa191
Start work on password frontend and some file fixing
Masterjoona Jul 5, 2024
48f5726
bonk old web
Masterjoona Jul 6, 2024
37d3956
More removing old web
Masterjoona Jul 6, 2024
283e746
small list changes
Masterjoona Jul 6, 2024
7efa98d
update go and more password stuff
Masterjoona Jul 6, 2024
a381b26
remove unused
Masterjoona Jul 6, 2024
0f0928b
file frontend stuff
Masterjoona Jul 6, 2024
f7290d0
one view paste
Masterjoona Jul 7, 2024
af98c54
Saving works!
Masterjoona Jul 8, 2024
100b21e
auth works somewhat
Masterjoona Jul 8, 2024
aaa155a
make one view work somewhat with encrypted
Masterjoona Jul 8, 2024
16da335
little more sane config options
Masterjoona Jul 8, 2024
9e5cb86
fix encrypted oneviews
Masterjoona Jul 8, 2024
123b126
diff utils and config dirs
Masterjoona Jul 8, 2024
7a50e40
paste editing stuff
Masterjoona Jul 8, 2024
69e0ac8
css files
Masterjoona Jul 8, 2024
c584fc3
guh
Masterjoona Jul 8, 2024
b94ee0d
Some private file access things
Masterjoona Jul 9, 2024
f411eee
Paste updating works! Updating files too!
Masterjoona Jul 9, 2024
f0d5d7a
paste deletion
Masterjoona Jul 9, 2024
fa2fb91
a goofy admin page and other stuff
Masterjoona Jul 9, 2024
d4f41fb
try new method for authing pastes
Masterjoona Jul 9, 2024
b831cd9
the future is now old man
Masterjoona Jul 10, 2024
5063d05
guh
Masterjoona Jul 10, 2024
453db8c
i guess this works?
Masterjoona Jul 10, 2024
4cac512
fix docker
Masterjoona Jul 10, 2024
82907c8
guh
Masterjoona Jul 10, 2024
ec7c19b
basic readme
Masterjoona Jul 10, 2024
fe35344
i hate
Masterjoona Jul 11, 2024
bf9c4b9
fix stupit type
Masterjoona Jul 11, 2024
dca7739
bring back 2nd dev attribution and list componet
Masterjoona Jul 11, 2024
f13578f
insanity gone
Masterjoona Jul 11, 2024
4b5aaec
thing
Masterjoona Jul 11, 2024
bc55879
some things
Masterjoona Jul 12, 2024
ffcc38a
readonly stuff
Masterjoona Jul 12, 2024
ac69609
split things in multiple files
Masterjoona Jul 12, 2024
6a2c5d6
change db dir
Masterjoona Jul 12, 2024
a596bc5
guh wrong endpoint
Masterjoona Jul 12, 2024
6c47c14
works but i dont like it
Masterjoona Jul 12, 2024
79ae449
convert remaining scripts to ts
Masterjoona Jul 12, 2024
bba2f5e
buttons better on mobile
Masterjoona Jul 13, 2024
3611d9a
Merge branch 'main' into svelte
Masterjoona Jul 13, 2024
d7272b2
fix password on paste
Masterjoona Jul 13, 2024
62ecc20
config stuff
Masterjoona Jul 13, 2024
8583194
deduplicate code?
Masterjoona Jul 13, 2024
05ef27e
error handling
kaatrasalo Jul 13, 2024
67ff9ce
add window titles
kaatrasalo Jul 13, 2024
bf5e857
violate https://kit.svelte.dev/docs/project-structure
kaatrasalo Jul 13, 2024
09a776a
guide
kaatrasalo Jul 13, 2024
9fc18e9
title for guide
kaatrasalo Jul 13, 2024
d326abf
use profile site for taro
kaatrasalo Jul 13, 2024
608db02
move routes and fix file upload thingy
Masterjoona Jul 13, 2024
d199b20
forgot edit page
Masterjoona Jul 13, 2024
fcbeaad
nvmimdumbplsnoshame
kaatrasalo Jul 13, 2024
d916eef
embed stuff
Masterjoona Jul 21, 2024
a2878ba
Fix expiration and add never expiring
Masterjoona Jul 21, 2024
056f1c5
fix parsing time, add logging (and remove panics)
Masterjoona Jul 23, 2024
0e55d94
make upload password functional
Masterjoona Jul 23, 2024
332e2dc
make it only file uploading passwd
Masterjoona Jul 23, 2024
4c85eab
Update page titles to show project name instead
Masterjoona Jul 23, 2024
afecf17
add example files
Masterjoona Jul 23, 2024
893cccb
Syntax highlighting
Masterjoona Aug 5, 2024
6fe8742
gitignore .env.dev and ternary generics
Masterjoona Aug 5, 2024
cb71598
fix small ternary issue
Masterjoona Aug 5, 2024
3164c5e
move shiki to prod dep, fix some style issues and ignore logs for gol…
Masterjoona Aug 5, 2024
84bcbd8
funny readme comment
Masterjoona Aug 5, 2024
d1bfab8
small perf change
Masterjoona Aug 5, 2024
b686dce
it had a purpose
Masterjoona Aug 5, 2024
85cb0d2
insane
Masterjoona Aug 5, 2024
53f72b6
change db password hashing
Masterjoona Aug 6, 2024
1d2d8c3
Actually ignore golte files
Masterjoona Aug 6, 2024
4fe418e
Patch golte to allow access to fsys
Masterjoona Aug 6, 2024
307bcfb
"view" encrypted files, favicon stuff (guhh hate)
Masterjoona Aug 6, 2024
feaefd1
hate
Masterjoona Aug 6, 2024
31c4d8b
view encrypted files and fix some build time issues
Masterjoona Aug 6, 2024
7d2f25f
Bump deps
Masterjoona Aug 7, 2024
865dac2
fix docker build
Masterjoona Aug 7, 2024
6a4af78
Add auto clean pastes and upload progress
Masterjoona Aug 7, 2024
11510df
chore: Refactor savePaste function for better code organization
Masterjoona Aug 7, 2024
81c7d9d
Unified logger
Masterjoona Aug 8, 2024
66b1876
chore:change log level
Masterjoona Aug 8, 2024
e276aef
Fix not encrypting content/files when editing
Masterjoona Aug 9, 2024
9475201
Fix bug when editing encrypted pastes
Masterjoona Aug 9, 2024
b4e98e6
Remove mentions of higher encryption level
Masterjoona Aug 9, 2024
93ebf13
feat: Add NormalizeFilenames configuration option
Masterjoona Aug 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
node_modules
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
*.md
build
.vscode
README.md
LICENSE
.vscode
Makefile
.env
41 changes: 24 additions & 17 deletions .env → .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Salt used for encryption. tbh i dont know if this helps at all since if
# someone has access to this file they can just read the salt
# openssl rand -hex 32
export PAWSTE_SALT="banana"

# the port the server will listen on
Expand All @@ -14,37 +15,36 @@ export PAWSTE_ADMIN_PASSWORD="admin"
# is the list public.
export PAWSTE_PUBLIC_LIST="true"

# public url for the server
export PAWSTE_PUBLIC_URL="http://localhost:9454"

# should file upload be enabled
export PAWSTE_FILE_UPLOAD="true"


# max bytes for a file upload
# if multiple files are uploaded the total size
# enter a number or a multiplication expression
export PAWSTE_MAX_FILE_SIZE="1024 * 1024 * 10"

export PAWSTE_MAX_ENCRYPTED_FILE_SIZE="1024 * 1024 * 10"

# max content length for a paste
export PAWSTE_MAX_CONTENT_LENGTH="1024 * 1024 * 10"
export PAWSTE_MAX_CONTENT_LENGTH="5000"

# is a password needed to upload a file
# "" means no password is needed
export PAWSTE_UPLOADING_PASSWORD=""
export PAWSTE_FILE_UPLOADING_PASSWORD=""

# disable never expiring pastes
export PAWSTE_DISABLE_ETERNAL_PASTE="false"
# never expiring pastes
export PAWSTE_ETERNAL_PASTE="false"

# disable read count
export PAWSTE_DISABLE_READ_COUNT="false"
# enable read count
export PAWSTE_READ_COUNT="true"
# whether file fetches should count as a read
export PAWSTE_COUNT_FILE_USAGE="false"

# disable burn after
export PAWSTE_DISABLE_BURN_AFTER="false"
# enable burn after
export PAWSTE_BURN_AFTER="true"

# default expiration time for pastes
# valid options 10min, 1min, 1h, 6h, 24h, 72h, 1w, never
# Options are parsed, so you can use 6h, 10d, 2w, 1M etc.
export PAWSTE_DEFAULT_EXPIRY="1w"

# animal-animal-animal to something shorter, random characters
Expand All @@ -53,7 +53,14 @@ export PAWSTE_SHORT_PASTE_NAMES="false"
# url redirects pastes will have shortened urls, so basically above but only for redirects
export PAWSTE_SHORTEN_REDIRECT_PASTES="false"

# this will delete the database and create a new one
# only set this to true if you understand what it does
# mostly for testing i guess until i figure out a better way to do this
# export PAWSTE_I_UNDERSTAND_THE_RISKS="false"
# whether to anonymize file names
export PAWSTE_ANONYMISE_FILE_NAMES="false"

# whether to normalize file names e.g. remove spaces, special characters
export PAWSTE_NORMALIZE_FILE_NAMES="true"

export PAWSTE_ANIME_GIRL_MODE="false"

export GIN_MODE="release"

export LOG_LEVEL="info"
14 changes: 6 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
js/speed-highlight
node_modules
pawste
pkg/build/*
build


.svelte-kit
build
.DS_Store
Thumbs.db
svelte-dev/.env
svelte-dev/.env.*
svelte-dev/vite.config.js.timestamp-*
svelte-dev/vite.config.ts.timestamp-*
*.upx
pawste_data*
*.png
.env
.env.dev
23 changes: 13 additions & 10 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{
"tabWidth": 4,
"useTabs": false,
"plugins": ["prettier-plugin-go-template"],
"tabWidth": 4,
"useTabs": false,
"plugins": [
"prettier-plugin-svelte"
],
"overrides": [
{
"files": ["*.html"],
"options": {
"parser": "go-template"
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
}
]
}
],
"svelteBracketNewLine": false
}
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}
}
49 changes: 20 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,45 +1,36 @@
FROM node:20 AS node-builder
FROM node:20-slim AS base

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable

WORKDIR /app
COPY package.json pnpm-lock.yaml ./
COPY golte.config.ts ./
COPY svelte.config.js ./
COPY ./web /app/web

COPY package.json ./
COPY pnpm-lock.yaml ./

RUN pnpm install

COPY ./web ./web
FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod
RUN pnpm run build

RUN npx golte dev

FROM golang:1.22.4 AS go-builder
FROM golang:1.22.5-alpine AS go-build

WORKDIR /app

COPY --from=node-builder /app/build ./build

ENV GOCACHE=/root/.cache/go-build
ENV CGO_ENABLED=1

COPY go.mod go.sum ./

RUN go mod download
RUN apk add gcc musl-dev

COPY . .
COPY --from=build /app/pkg/build /app/pkg/build
COPY ./pkg /app/pkg/
COPY main.go ./
COPY go.mod go.sum ./

RUN --mount=type=cache,target="/root/.cache/go-build" go build -ldflags "-s -w"
RUN --mount=type=cache,target="/root/.cache/go-build" go build -o pawste "-ldflags=-s -w"

FROM alpine:latest

RUN apk --no-cache add ca-certificates

WORKDIR /root/

COPY --from=go-builder /app/pawste /root/pawste
COPY --from=go-builder /app/build /root/build
COPY ./web /root/web

EXPOSE 9454
WORKDIR /app
COPY --from=go-build /app/pawste /app/pawste

CMD ["/root/pawste"]
ENTRYPOINT [ "./pawste" ]
14 changes: 3 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
binary_name="pawste"

build:
npx golte dev --use-pnpm && go build -o $(binary_name) "-ldflags=-s -w"

run:
npx golte dev --use-pnpm && go run .

runnopnpm:
runnoweb:
go run .

clean:
rm $(binary_name)

newdb:
npx golte dev --use-pnpm && PAWSTE_I_UNDERSTAND_THE_RISKS="true" go run .
rundocker:
docker compose up -d --build
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# pawste

Simple pastebin made in go.
This is my attempt at making pastebin, **pawste**!

**Look at the the [svelte branch](https://github.com/Masterjoona/pawste/tree/svelte) for most recent development.**
### Public instance: [pawst.eu](https://pawst.eu)

Or if you're savvy enough, you can host your own instance of pawste!

## Features

- single binary (fat ass one at that (shiki insanity), upx it or smth)
- encryption (server side, ~~soon on client too~~ horror)
- configurable file uploads
- url shortening/redirection
- public, private, editable pastes
- readcounts and burn after n reads
- works with sharex ([examples](examples/))

## Hosting your own instance

Copy `.env.example` to `.env` and configure it to your liking.

### Docker

```sh
git clone https://github.com/Masterjoona/pawste/
cd pawste
docker compose up -d --build
# for whatever reason building go in docker takes so long...
```

### Manual

```sh
pnpm build && go build
```

Then make a [service file](examples/pawste.service) for it and run it with systemd or something.
107 changes: 0 additions & 107 deletions database/create_paste.go

This file was deleted.

Loading