Hello there!
If you want to contact me for any reason, feel free to do so using one of the following ways:
- Discord:
lus#8001
- E-Mail:
[email protected]
- Mastodon:
@[email protected]
- Matrix:
@lus:goose.rodeo
pasty is a fast and lightweight code pasting server
Home Page: https://pasty.lus.pm
License: MIT License
Hello there!
If you want to contact me for any reason, feel free to do so using one of the following ways:
lus#8001
[email protected]
@[email protected]
@lus:goose.rodeo
Hey @lus,
first of all thank you for your work on pasty. I really like the project, the UI and the functionality.
But I would really appreciate if you could implement some kind of release management or tagging for different versions of pasty.
There are a few systems out there, like semantic-release (using conventional commits), that can help you with that. Here is also an example project where semantic release is used.
If you need some help with that, I am happy to support you.
The content type header is set to text/plain
in http header when requesting .js
file.
Which then causing the JavaScript not being loaded by browser.
The following fixes has been applied for trying to solve the issue but it didn't work
if !strings.HasPrefix(path, "/api") && (strings.Count(path, "/") == 1 || strings.HasPrefix(path, "/assets")) {
ctx.SetContentType("")
frontend(ctx)
return
}
Lines 33 to 35 in 542bb5b
OS: Windows 10 1809
Go Version: 1.16.3
Currently, the raw paste view (GET /<paste_id>/raw
) is handled by the backend while the normal paste view (GET /<paste_id>
) is being routed to the frontend.
It would make sense to move this as paste encryption is done on the client side and currently paste decryption is not possible for the raw view.
It would also provide a structured way of different view options which then could include #21 .
Add a api for pasting to this
The current paste viewing design is pretty straightforward and reasonable in my opinion.
However it gets pretty unhandy and ugly when it comes to any form of embed (an example would be https://blog.goose.rodeo).
This is why I think we should implement some kind of /embed
or ?embed=true
identifiers to tell the frontend to render it without the interactive elements (header, footer & extra buttons).
Hi,
I was wondering how feasible/sensible it would be to change the ID generation to only use lowercase characters? Since the ID is the part that it's often easier to just type out at the destination, it would speed up that process, and if it causes a bottleneck due to the lower total possible IDs, the ID length can just be increased to compensate for anyone that has that issue.
To elaborate more, I frequently use my Pasty to share snippets between my work and personal computers, and the easiest way to do that is noting the generated ID on the computer I start on, and just appending that to the domain on the destination computer.
Not a massive issue at all, but if it's a small job to maybe add an environment variable to change ID generation (maybe even with the option to only have lowercase letters, or only numbers), it would be even more useful as a tool for me!
Thanks!
It would be cool to be able to explicitly set the language of the paste for proper syntax highlighting, like it is common among most pastebins.
As presented in #31 , I did not implement any error logging in the backend. I would do differently if I would start the project nowadays.
This definitely has to be implemented.
Looks promising, but could you please add installation instructions? Thanks
Currently adding any custom JS/CSS means, the person has to manually fork and edit the code, would request for an environment variable which can take the source of a JS/CSS file to be included at <head>
Proposal can be: PASTY_CUSTOM_CSS
and PASTY_CUSTOM_JS
which would hold values to URLs having the JS/CSS respectively.
I think removing all storage drivers except the PostgreSQL one would be a good idea.
One major problem when it comes to the implementation of new features that somewhat affect the paste models is that we always have to keep in mind that old data has to be migrateable.
Only the PostgreSQL driver implements auto-migration and maintaining migration logic for every single storage driver would dramatically decrease the development effectivity.
Migrating pastes stored with another driver always include the manual import and export tool which is annoying.
However, we should keep the file storage driver but restrict it to only be accessible when in development mode to not force the developer to set up a fully-fledged PSQL database just to improve some part of the frontend.
Setting up PostgreSQL should not be an issue and I think removing support for other storage options is an acceptable trade-off to achieve a much better development effectivity and flexibility.
Is there a way to create a paste from CLI? If so, could I have an example on how to do it? Thanks!
Maybe it would be nice to be able to create a paste by just sending a POST request to the root URL (i.e. https://pasty.lus.pm) with the request body representing the raw paste content.
This endpoint should only return the raw paste ID or URL; no JSON involved.
This would be nice for CLI users.
When I run pasty from the command line, and use Caddy to proxy to it, it works fine, no issues. Of course, I want to run it with systemd
. This is my systemd
file:
[Unit]
Description=Pastie
After=network.target
[Service]
Type=simple
Restart=on-failure
RestartSec=10
StartLimitBurst=5
StartLimitInterval=100
User=www-data
Group=www-data
ExecStart=/usr/local/bin/pasty
EnvironmentFile=/usr/local/etc/pasty/.env
[Install]
WantedBy=multi-user.target
Pasty will start fine, and run, but when I try accessing it, I get Cannot open requested path
. Any idea of what could be happening?
Serving the web frontend by opening the ./web/
directory is not flexible at all. We should consider using Go's (relatively) new embed feature to embed it into the final binary.
At times, I'd like to be able to deploy this in a way that doesn't provide a popup for a deletion token, just saving and providing a URL.
Would you be willing to allow a config option to disable the deletion token creation/popup?
It would be awesome if you could define a custom code for a created paste.
I think a good way to implement this would be to set an alias which points to the original paste, which still has the ID. This way, the custom code can be changed via the modification key.
We should allow the Cmd key on Apple keyboards as an alternative to the Ctrl/Option key for keybinds.
CC @kxmpxtxnt
Maybe it would be nice to be able to attach to the pasty process and instruct it to do something based on commands. Maybe like this:
$ docker attach pasty
> delete abc123
:: deleted paste abc123
> stats
:: pastes: 420
:: today: 69
>
I'm out looking for a self-hosted Pastebin service. I'm mostly doing:
I cloned this repo and moved into the pkg/pasty
folder, then ran go run .
pasty/$ go run .
2022/01/08 01:02:53 Loading the application configuration...
2022/01/08 01:02:53 Loading the configured storage driver...
2022/01/08 01:02:53 Serving the web resources...
Then I went to http://localhost:8080 and got this.
Maybe this is expected, but it's certainly not user friendly. So I can back here and scanned through the README more, but found no mention of "how to use" this app. I can only assume what I'm getting from the web interface is not expected, and something is wrong here.
Then, on a whim I did cd ../.. ; go run ./cmd/pasty
and got the same output, but this time the web server had actual content. So I looked in the README for the word log
but found nothing. This app doesn't seem to log errors, or requests, or anything happening. Is that expected?
I finally tested it. My test is (always) paste a 5MB log file and hit save.
Does it work? Nope, it just spins.
Is it fast, or slow? Slow, and the line numbers seem to misalign with the paste lines while scrolling.
Can it be "loaded" quickly after being saved? It never saved the 5MB paste, and never printed an error.
Small pastes seem to work OK. This is my feedback, hope it's helpful.
There is no cap for the payload length of the past creation request body. When creating very large pastes, this will cause various problems.
And sorry by the way for some very large files in your object storage which I have created during my testing. ^^
It would be nice to be able to encrypt pastes to be only accessible with a decryption token.
A counter that tracks the amount of views a paste has received
I have checked the open and closed issues to see if this already exists
This feature request is in the scope of this project
A view counter similar in design to the lines and character counters, however I feel it would be better suited to the footer than a floating div
So, I had a request from my team to set some paste docs to never expire
While I see there's no option, I thought to ask for the said feature here
Am thinking to maybe set this via a password or a specific command (button) from the UI
Well up to you guys to decide to add or not :)
Thank you
I plan on completely rewriting the frontend, maybe using React or some other tool that doesn't take up 3 gigabytes for 2 static pages.
The current implementation works fine for the very limited functionality pasty currently has, but I plan on implementing some basic administration (reports directly integrated into pasty rather than using a webhook, #55 , etc.) which would require additional UI work.
I'm using autofilter bot and i want to delete my some filters in bulk and pasty.lu.pm site want modification token
Rather than implementing administration functionality directly into pasty (which was intended to be lightweight by default), it could make sense to implement an administration API used to manage the instance.
A new project called pasty-admin
could then be deployed if needed. This service would implement the whole administration side (UI, user authentication, report management etc.).
As requested in #36 , we should bundle all JS dependencies instead of loading them from a CDN.
Maybe include a simple report system to give users the ability to report inappropriate pastes to the service hoster.
Currently, the only possible administration token is stored in the PASTY_MODIFICATION_TOKEN_MASTER
environment variable.
I think it would make sense to store Argon2id hashes in an additional admin_tokens
database table instead so we can later provide an API to manage them. The current PASTY_MODIFICATION_TOKEN_MASTER
value will then be used as the only superadmin token which is authorized to manage other administration tokens.
I am getting "Clipboard permission denied" when clicking on the clipboard icon. Happening on macOS 12.1, under Safari 15.2 (17612.3.6.1.6).
what I do
chchang@hqdc039:~$ cd git
chchang@hqdc039:~/git$ git clone https://github.com/lus/pasty
正複製到 'pasty'...
remote: Enumerating objects: 529, done.
remote: Counting objects: 100% (529/529), done.
remote: Compressing objects: 100% (301/301), done.
remote: Total 529 (delta 262), reused 432 (delta 168), pack-reused 0
接收物件中: 100% (529/529), 126.29 KiB | 329.00 KiB/s, 完成.
處理 delta 中: 100% (262/262), 完成.
chchang@hqdc039:~/git$ cd pasty/
chchang@hqdc039:~/git/pasty$ go build -o pasty ./cmd/pasty/main.go
go: downloading github.com/ulule/limiter/v3 v3.5.0
go: downloading github.com/minio/minio-go/v7 v7.0.5
go: downloading github.com/johejo/golang-migrate-extra v0.0.0-20210217013041-51a992e50d16
go: downloading github.com/fasthttp/router v1.2.4
go: downloading github.com/golang-migrate/migrate/v4 v4.14.2-0.20201125065321-a53e6fc42574
go: downloading go.mongodb.org/mongo-driver v1.4.0
go: downloading github.com/alexedwards/argon2id v0.0.0-20200802152012-2464efd3196b
go: extracting github.com/johejo/golang-migrate-extra v0.0.0-20210217013041-51a992e50d16
go: downloading github.com/jackc/pgx/v4 v4.11.0
go: extracting github.com/alexedwards/argon2id v0.0.0-20200802152012-2464efd3196b
go: extracting github.com/golang-migrate/migrate/v4 v4.14.2-0.20201125065321-a53e6fc42574
go: extracting github.com/ulule/limiter/v3 v3.5.0
go: extracting github.com/fasthttp/router v1.2.4
go: downloading golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
go: downloading github.com/savsgio/gotils v0.0.0-20200616100644-13ff1fd2c28c
go: downloading github.com/valyala/bytebufferpool v1.0.0
go: downloading github.com/joho/godotenv v1.3.0
go: extracting github.com/minio/minio-go/v7 v7.0.5
go: downloading github.com/json-iterator/go v1.1.10
go: extracting github.com/jackc/pgx/v4 v4.11.0
go: downloading github.com/jackc/pgconn v1.8.1
go: extracting github.com/valyala/bytebufferpool v1.0.0
go: extracting github.com/savsgio/gotils v0.0.0-20200616100644-13ff1fd2c28c
go: extracting github.com/joho/godotenv v1.3.0
go: downloading golang.org/x/net v0.0.0-20210226172049-e18ecbb05110
go: downloading github.com/google/uuid v1.1.2
go: downloading github.com/hashicorp/go-multierror v1.1.0
go: extracting github.com/google/uuid v1.1.2
go: extracting github.com/hashicorp/go-multierror v1.1.0
go: downloading github.com/jackc/pgtype v1.7.0
go: extracting github.com/jackc/pgconn v1.8.1
go: downloading github.com/lib/pq v1.8.0
go: extracting github.com/json-iterator/go v1.1.10
go: downloading gopkg.in/ini.v1 v1.57.0
go: extracting golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
go: extracting golang.org/x/net v0.0.0-20210226172049-e18ecbb05110
go: downloading github.com/jackc/pgproto3 v1.1.0
go: extracting go.mongodb.org/mongo-driver v1.4.0
go: downloading github.com/minio/md5-simd v1.1.0
go: downloading github.com/valyala/fasthttp v1.16.0
go: extracting gopkg.in/ini.v1 v1.57.0
go: extracting github.com/lib/pq v1.8.0
go: downloading golang.org/x/text v0.3.3
go: extracting github.com/jackc/pgtype v1.7.0
go: downloading golang.org/x/sys v0.0.0-20201119102817-f84b799fce68
go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: extracting github.com/jackc/pgproto3 v1.1.0
go: downloading github.com/jackc/pgproto3/v2 v2.0.6
go: downloading github.com/jackc/puddle v1.1.3
go: downloading github.com/modern-go/reflect2 v1.0.1
go: downloading github.com/rs/xid v1.2.1
go: extracting github.com/minio/md5-simd v1.1.0
go: downloading github.com/klauspost/cpuid v1.3.1
go: downloading github.com/go-stack/stack v1.8.0
go: extracting github.com/valyala/fasthttp v1.16.0
go: downloading github.com/klauspost/compress v1.10.11
go: extracting golang.org/x/sys v0.0.0-20201119102817-f84b799fce68
go: downloading github.com/minio/sha256-simd v0.1.1
go: extracting github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: extracting github.com/jackc/puddle v1.1.3
go: downloading golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208
go: extracting github.com/rs/xid v1.2.1
go: extracting github.com/modern-go/reflect2 v1.0.1
go: extracting github.com/go-stack/stack v1.8.0
go: extracting github.com/jackc/pgproto3/v2 v2.0.6
go: downloading github.com/jackc/pgio v1.0.0
go: downloading github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b
go: downloading github.com/andybalholm/brotli v1.0.0
go: downloading github.com/jackc/chunkreader v1.0.0
go: extracting github.com/klauspost/cpuid v1.3.1
go: extracting github.com/minio/sha256-simd v0.1.1
go: extracting github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b
go: extracting github.com/jackc/pgio v1.0.0
go: extracting golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208
go: downloading github.com/golang/snappy v0.0.1
go: extracting github.com/jackc/chunkreader v1.0.0
go: downloading github.com/jackc/chunkreader/v2 v2.0.1
go: downloading github.com/aws/aws-sdk-go v1.29.15
go: extracting github.com/andybalholm/brotli v1.0.0
go: extracting github.com/golang/snappy v0.0.1
go: extracting github.com/jackc/chunkreader/v2 v2.0.1
go: extracting golang.org/x/text v0.3.3
go: downloading github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c
go: downloading github.com/jackc/pgpassfile v1.0.0
go: downloading github.com/xdg/stringprep v1.0.0
go: extracting github.com/jackc/pgpassfile v1.0.0
go: extracting github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c
go: extracting github.com/xdg/stringprep v1.0.0
go: extracting github.com/klauspost/compress v1.10.11
go: extracting github.com/aws/aws-sdk-go v1.29.15
go: finding github.com/joho/godotenv v1.3.0
go: finding github.com/alexedwards/argon2id v0.0.0-20200802152012-2464efd3196b
go: finding golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
go: finding golang.org/x/sys v0.0.0-20201119102817-f84b799fce68
go: finding go.mongodb.org/mongo-driver v1.4.0
go: finding github.com/go-stack/stack v1.8.0
go: finding github.com/golang/snappy v0.0.1
go: finding github.com/klauspost/compress v1.10.11
go: finding github.com/aws/aws-sdk-go v1.29.15
go: finding github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c
go: finding github.com/xdg/stringprep v1.0.0
go: finding golang.org/x/text v0.3.3
go: finding golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208
go: finding github.com/golang-migrate/migrate/v4 v4.14.2-0.20201125065321-a53e6fc42574
go: finding github.com/hashicorp/go-multierror v1.1.0
go: finding github.com/lib/pq v1.8.0
go: finding github.com/jackc/pgx/v4 v4.11.0
go: finding github.com/jackc/pgconn v1.8.1
go: finding github.com/jackc/chunkreader/v2 v2.0.1
go: finding github.com/jackc/pgio v1.0.0
go: finding github.com/jackc/pgpassfile v1.0.0
go: finding github.com/jackc/pgproto3/v2 v2.0.6
go: finding github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b
go: finding github.com/jackc/pgtype v1.7.0
go: finding github.com/jackc/puddle v1.1.3
build github.com/johejo/golang-migrate-extra/source/iofs: cannot load github.com/johejo/golang-migrate-extra/source/iofs: no Go source files
chchang@hqdc039:~/git/pasty$
" docker: no matching manifest for linux/arm/v7 in the manifest list entries. "
it would be great if we can run it on arm devices.
Pastes may get indexed by search engines. We should definitely add a corresponding robots.txt file preventing this.
pasty had a feature which allowed users to highlight specific lines some time ago, but I removed it because of its poorly performing implementation.
However I think it would be nice to implement it with a bit more effort as there really are situations where I wish I had it.
Hey, cool Product!
I try to run it as Sub-path on Apache2 Server e.g. https://FQDN/pasty/
with few rewrite rules, but not really successful.
version: "3.6"
services:
pasty:
image: ghcr.io/lus/pasty:latest
container_name: pasty
restart: unless-stopped
environment:
- PASTY_AUTODELETE="true"
- PASTY_AUTODELETE_LIFETIME="336h"
- PASTY_AUTODELETE_TASK_INTERVAL="24h"
ports:
- "9016:8080"
localhost:9016
#Pasty
<Location /api/v2/>
RewriteEngine on
RewriteRule /api/v2/(.*) http://localhost:9016/api/v2/$1 [P,L]
ProxyPreserveHost On
ProxyPass http://localhost:9016/api/v2/ retry=0 connectiontimeout=5 timeout=30 keepalive=on
ProxyPassReverse http://localhost:9016/api/v2/
RequestHeader set Connection ""
</Location>
Redirect 301 "/pasty" "/pasty/"
<Location /pasty/>
ProxyPreserveHost On
ProxyPass http://localhost:9016/ retry=0 connectiontimeout=5 timeout=30 keepalive=on
ProxyPassReverse http://localhost:9016/
RequestHeader set Connection ""
</Location>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.