Compare commits
2 Commits
709705282a
...
b8f4513640
Author | SHA1 | Date | |
---|---|---|---|
b8f4513640 | |||
e9b4276698 |
36
readme.md
Normal file
36
readme.md
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# revelation
|
||||||
|
|
||||||
|
this app triggers the dbus filepicker to select a file, then uploads it to a pastebin service.
|
||||||
|
|
||||||
|
## how it works
|
||||||
|
|
||||||
|
- when you run the app, it opens the system filepicker using dbus.
|
||||||
|
|
||||||
|
- after selecting a file, the app uploads it to the pastebin service.
|
||||||
|
|
||||||
|
- the app returns the URL of the uploaded file.
|
||||||
|
|
||||||
|
## requirements
|
||||||
|
|
||||||
|
- dbus (for the filepicker)
|
||||||
|
|
||||||
|
- a pastebin service like [0x0.st](https://0x0.st)
|
||||||
|
|
||||||
|
## usage
|
||||||
|
|
||||||
|
1. set the AUTH_KEY and AUTH_PARAM environment variable if your pastebin service requires an API key.
|
||||||
|
|
||||||
|
1. run the app:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go run .
|
||||||
|
```
|
||||||
|
|
||||||
|
1. select a file using the filepicker.
|
||||||
|
|
||||||
|
1. the app will copy the url of the uploaded file to clipboard
|
||||||
|
|
||||||
|
## notes
|
||||||
|
|
||||||
|
- this app is designed for linux systems with dbus support.
|
||||||
|
- make sure the pastebin service is accessible and the API key is valid.
|
@ -16,10 +16,11 @@ import (
|
|||||||
|
|
||||||
var pasteURL = os.Getenv("PASTEBIN_URL")
|
var pasteURL = os.Getenv("PASTEBIN_URL")
|
||||||
var key = os.Getenv("AUTH_KEY")
|
var key = os.Getenv("AUTH_KEY")
|
||||||
|
var authParam = os.Getenv("AUTH_PARAM")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if pasteURL == "" || key == "" {
|
if pasteURL == "" {
|
||||||
fmt.Println("Please set PASTEBIN_URL and AUTH_KEY environment variables")
|
fmt.Println("Please set PASTEBIN_URL environment variable")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +81,7 @@ func uploadFile(file string) (*http.Request, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set headers
|
// set headers
|
||||||
req.Header.Set("X-Auth", key)
|
req.Header.Set(authParam, key)
|
||||||
req.Header.Set("Content-Type", writer.FormDataContentType())
|
req.Header.Set("Content-Type", writer.FormDataContentType())
|
||||||
|
|
||||||
return req, nil
|
return req, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user