iliafrenkel / go-pb Goto Github PK
View Code? Open in Web Editor NEWPastebin alternative written in Go
License: MIT License
Pastebin alternative written in Go
License: MIT License
Implement api.PasteService
with Sqlite as storage.
Build pipeline:
main
trigger test pipelinemain
triggers the testing pipelinev*
is created on the main
branch trigger test and build pipelinesdarwin/amd64
, darwin/arm64
, windows/amd64
, linux/amd64
, linux/arm64
, freebsd/amd64
amd64
and arm64
architecturesDescribe the bug
When building a page with the list of pastes the result of the query contains full pastes, body included. This can get very big. We don't need the body for pastes list anyway.
Additional context
In the same way, as we have FindRequest
struct, we should define FindResponse
struct that will only contain the fields we need.
The ApiServer.handleCreate
must return 201 Created
on success instead of 200 OK
. It should also update the Location
header to contain the URL to the newly created paste.
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201
And don't forget to update the tests.
Line 78 in 0a33105
Is your feature request related to a problem? Please describe.
At the moment, we only build docker images for amd64
. Many people use ARM systems nowadays - Raspberry Pi, new macs. It'd be nice to have pre-build docker images for arm
and arm64
.
Describe the solution you'd like
GoReleaser supports building multi-platform images: https://goreleaser.com/customization/docker_manifest/
Describe alternatives you've considered
N/A
Additional context
N/A
Implement api.UserService
with Sqlite as storage.
If we want to make our API public we need to implement client authentication and autorisation. I suggest JWT tokens with the RSA signing method that uses asymmetric public/private keys.
In addition to #8.
Currently, the paste view page (/p/:id
) only shows the title, the URL and the content. It'd be nice to see what language has been used for syntax highlighting.
Describe the bug
I cannot paste over 10,240 characters.
To Reproduce
Run the app and try to paste something large.
Expected behaviour
WEB_MAX_BODY_SIZE
or --web-max-body-size
properly controls the maximum paste size.
Screenshots
I cloned, ran make build
(because make
failed), then ran the app:
go-pb$ GOPB_DEBUG=true WEB_MAX_BODY_SIZE=6000000 build/go-pb --web-max-body-size=6000000
go-pb v0.0.9-alpha
2022/01/08 01:58:43.756 [INFO] {cmd/main.go:84 main.main} Options: {Timeouts:{Shutdown:10s HTTPRead:15s HTTPWrite:15s HTTPIdle:1m0s} Web:{Proto:http Host:localhost Port:8080 LogFile: LogMode:production BrandName:Go PB BrandTagline:A nice and simple pastebin alternative that you can host yourself. Assets:./assets Templates:./templates BootstrapTheme:original Logo:bighead.svg MaxBodySize:6000000} DB:{Type:memory Connection:} Auth:{Secret: TokenDuration:5m0s CookieDuration:24h0m0s Issuer:go-pb URL:http://localhost:8080 GitHubCID: GitHubCSEC: GoogleCID: GoogleCSEC: TwitterCID: TwitterCSEC:} Debug:true LogFile:}
Desktop (please complete the following information):
Not sure what else to try.
When viewing a paste with DeleteAfterRead
set to true
, notify the user that the paste was deleted and that if she closes the page, the paste will be gone forever.
The idea is to create a scheduler that will run on a regular interval (or maybe multiple schedulers and multiple intervals) and execute certain tasks:
In addition to that, the API must not show the pastes that have expired already.
Other ideas are more than welcome!
Describe the bug
Dev auth provider should only be available while debugging.
With a regular paste, all you need to know is its URL. I want to set a password on a paste so that the user will need to enter it to view the paste, in addition to knowing the URL.
Password must be stored as a hash. If it is lost, there will be no way to restore it.
Is your feature request related to a problem? Please describe.
As a logged in user I want to be able to see all my pastes. At the moment I can only see the last 10.
Describe the solution you'd like
Implement a paginated list of all user's pastes.
List last 10 (configurable?) pastes for the user when logged in.
Is your feature request related to a problem? Please describe.
As a logged in user there is no way for me to see a list of public pastes.
Describe the solution you'd like
Showing a paginated list of public pastes would be nice. Similar to "My Pastes" list.
Describe alternatives you've considered
There are no alternatives at the moment. You can see the last 10 public pastes when you are not logged in.
Additional context
N/A
Gather some stats for the API calls:
Keep the stats locally or consider some 3rd party service.
If we don't set Content-Type
header, Go will try and guess it from the content. This may take some time, especially for large responses. Since we know that we send HTML pages we can set the header upfront. We can also set the response status code for clarity.
Here:
Line 43 in 4cf70f5
Here:
Line 72 in 4cf70f5
And, most importantly, here:
Line 98 in 4cf70f5
We need an admin interface to manage users and pastes. Also, to see stats and configure whatever is configurable.
A detailed list of features needs to be created.
Add an ability to mark the paste private so that only the person who created the paste could view it.
If we ever going to make our API public we need to be able to protect it. I suggest implementing rate limiting on two levels:
This is in addition to #9.
I'd like to have a logo and some project branding in general:
Any help will be greatly appreciated.
Is your feature request related to a problem? Please describe.
It'd be nice to be able to see how many times a public paste has been viewed.
Describe the solution you'd like
Every time a unique visitor views a paste record it. Show the total count on the paste view and list pages.
Additional context
A unique visitor == one session. All the views within a single session should be counted as one.
At the moment, both API and Web servers just die when you press Ctrl+c
. It will be nice to have a graceful shutdown that allows the servers to finish what they were doing.
I found this article helpful: https://medium.com/rungo/running-multiple-http-servers-in-go-d15300f4e59f
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.