forestnode-io / oneshot Goto Github PK
View Code? Open in Web Editor NEWA first-come first-served single-fire HTTP server. Easily transfer files to and from your terminal and any browser.
Home Page: https://www.oneshot.uno
License: MIT License
A first-come first-served single-fire HTTP server. Easily transfer files to and from your terminal and any browser.
Home Page: https://www.oneshot.uno
License: MIT License
Describe the bug
I don't know if this is in purpose, but I've been using oneshot for a while now and it's always used my computers private IP address (LAN). I downloaded oneshot-bin via paru today and ran it trying to transfer a pdf file and it opened the server on my LAN's public_ip:8080 instead of my machine's private_ip:8080.
To Reproduce
oneshot send "path/to/file.pdf"
Expected behavior
listening on http://private_ip:8080
Output and error messages
listening on http://public_ip:8080
Desktop
When doing development / debug / testing of oauth/openid flows - the interactive web browser portion finishes with a redirect to a URL that is meant to receive the authorisation code in a URL param (at which point it will go and do some code exchanges).
Scripting testing of this in something like bash is painful - but I think oneshot with very minimal additions could help out.
As a proof of concept - I used oneshot like this
oneshot -D -S 'echo "$QUERY_STRING"'
and set up my oauth redirect to http://127.0.0.1:8080
.
I initiated my oauth flow in bash, launched a browser to do the login portion, and see that the page then redirects to oneshot with a GET of
http://127.0.0.1:8080?code=ABCDEFGH&state=XYZ
(i.e. the browser shows the output of the shell/CGI and then exits .. code=ABCDEFGH&state=XYZ)
However, I have no way of getting that information out of the invocation of oneshot in my bash script. I was thinking of a series of command line flags that would instruct oneshot to print this information on the end of the request.
So something like
--echo-from-client query_string
where the sky is the limit for what details of the client could be shown. I'd possibly start with any of the variables that are in the environment of the CGI launch.
query_string
http_user_agent
remote_host
http_accept
So the expected invocation pattern would be
QUERY=$(oneshot -q -D -S 'echo "Thanks"' --echo-from-client query_string)
I realise this is a bit outside the box from what oneshot was intended for - but does fall into the category of things that I need a http server that only responds once for!
When the -s flag is used to pass in a shell to use, oneshot parses the path as having double slashes. This then leads to a 'file not found' error.
example: C:\Windows\System32\WindowsPowerShell\v1\powershell.exe -> C:\Windows\System32\WindowsPowerShell\v1\powershell.exe
I attempted to compile it from source. I ran git clone https://github.com/raphaelreyna/oneshot.git && cd oneshot && sudo make install
and I got the following output:
go build -ldflags "-X github.com/raphaelreyna/oneshot/cmd.version=`git describe --tags --abbrev=0` -X github.com/raphaelreyna/oneshot/cmd.date="`date +"%d-%B-%Y"`" -s -w" .
go: downloading github.com/raphaelreyna/ez-cgi v0.7.3
go: downloading github.com/google/uuid v1.2.0
go: downloading github.com/spf13/cobra v1.0.0
go: downloading github.com/jf-tech/iohelper v1.0.2
go: downloading github.com/grandcat/zeroconf v1.0.0
go: downloading github.com/gorilla/mux v1.7.4
go: downloading github.com/spf13/pflag v1.0.3
go: extracting github.com/raphaelreyna/ez-cgi v0.7.3
go: extracting github.com/gorilla/mux v1.7.4
go: extracting github.com/grandcat/zeroconf v1.0.0
go: downloading github.com/cenkalti/backoff v2.2.1+incompatible
go: downloading github.com/miekg/dns v1.1.27
go: downloading golang.org/x/net v0.0.0-20200602114024-627f9648deb9
go: extracting github.com/jf-tech/iohelper v1.0.2
go: extracting github.com/spf13/cobra v1.0.0
go: extracting github.com/google/uuid v1.2.0
go: extracting github.com/spf13/pflag v1.0.3
go: extracting github.com/cenkalti/backoff v2.2.1+incompatible
go: extracting github.com/miekg/dns v1.1.27
go: downloading golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
go: downloading golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd
go: extracting golang.org/x/net v0.0.0-20200602114024-627f9648deb9
go: extracting golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
go: extracting golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd
go: finding github.com/grandcat/zeroconf v1.0.0
go: finding github.com/cenkalti/backoff v2.2.1+incompatible
go: finding github.com/miekg/dns v1.1.27
go: finding golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
go: finding golang.org/x/net v0.0.0-20200602114024-627f9648deb9
go: finding golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd
go: finding github.com/google/uuid v1.2.0
go: finding github.com/raphaelreyna/ez-cgi v0.7.3
go: finding github.com/jf-tech/iohelper v1.0.2
go: finding github.com/gorilla/mux v1.7.4
go: finding github.com/spf13/cobra v1.0.0
go: finding github.com/spf13/pflag v1.0.3
build github.com/raphaelreyna/oneshot: cannot load embed: malformed module path "embed": missing dot in first path element
make: *** [Makefile:11: oneshot] Error 1
To Reproduce
Steps to reproduce the behavior:
build github.com/raphaelreyna/oneshot: cannot load embed: malformed module path "embed": missing dot in first path element
make: *** [Makefile:11: oneshot] Error 1
Desktop (please complete the following information):
Currently, oneshot will filter out connections from bots/iMessage/etc. by default; there should be a flag to turn this off.
It would be nice if multiple paths to a mixture of files and directories could be passed to oneshot such that they all get thrown into the root of an archive file.
I'm not entirely sure whats causing this but I think its an issue with goreleaser
Describe the bug
When trying to upload a file, it shows this error:
error :: 2021/08/05 17:17:03 server.go:128: Invalid CSRF token
To Reproduce
Steps to reproduce the behavior:
oneshot -u .
error :: 2021/08/05 17:17:03 server.go:128: Invalid CSRF token
Expected behavior
File Uploaded Successfully.
Output and error messages
error :: 2021/08/05 17:17:03 server.go:128: Invalid CSRF token
Desktop (please complete the following information):
I am running Windows 7 and I can't seem to connect to that machine from other devices. Is it some bug in the program or do I need to manually change some network visibility options?
Video: Bilibili
Text: WeChat article
Your tools are very useful, so I made a special introduction video, welcome to watch ๐น
hi,
oneshot is a cool tool ;-)
we can change the listening port : would it also be possible to change the address ? to bind only localhost for example (e.g. behind apache or nginx).
regards, lacsaP.
Describe the bug
As title
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Version output shows up.
Output and error messages
panic: interface conversion: pflag.Value is *pflag.stringValue, not *flagargs.OutputFormat [recovered]
panic: interface conversion: pflag.Value is *pflag.stringValue, not *flagargs.OutputFormat
goroutine 1 [running]:
main.main.func1()
/Users/rr/Code/ForestNode/oneshot/v2/cmd/main.go:45 +0x73
panic({0x1893aa0?, 0xc0001d1a70?})
/opt/homebrew/Cellar/go/1.21.0/libexec/src/runtime/panic.go:914 +0x21f
github.com/forestnode-io/oneshot/v2/pkg/commands/root.subCommands.(*Cmd).Cobra.func1(0x1b08bc0?, {0xc0003a6120?, 0x0?, 0x213e940?})
/Users/rr/Code/ForestNode/oneshot/v2/pkg/commands/version/cobra.go:30 +0x485
github.com/forestnode-io/oneshot/v2/pkg/commands/root.(*rootCommand).setSubCommands.func2(0xc0003a4300, {0x213e940, 0x0, 0x0})
/Users/rr/Code/ForestNode/oneshot/v2/pkg/commands/root/entry.go:128 +0x6f
github.com/spf13/cobra.(*Command).execute(0xc0003a4300, {0x213e940, 0x0, 0x0})
/Users/rr/go/pkg/mod/github.com/spf13/[email protected]/command.go:944 +0x863
github.com/spf13/cobra.(*Command).ExecuteC(0xc000290000)
/Users/rr/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
/Users/rr/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
github.com/spf13/cobra.(*Command).ExecuteContext(...)
/Users/rr/go/pkg/mod/github.com/spf13/[email protected]/command.go:985
github.com/forestnode-io/oneshot/v2/pkg/commands/root.ExecuteContext({0x1b08d80, 0xc0001caac0})
/Users/rr/Code/ForestNode/oneshot/v2/pkg/commands/root/entry.go:81 +0x698
main.main()
/Users/rr/Code/ForestNode/oneshot/v2/cmd/main.go:77 +0x2ed
Desktop (please complete the following information):
Additional context
None
Describe the bug
while sending folders as zip files the structure of zip files is broken
say for example i'm sending a folder Downloads/folder
then the zip file structure while extracting is folder/folder/*.*
To Reproduce
Steps to reproduce the behavior:
oneshot -a zip path to any folder
Expected behavior
the file structure while extracting should be like folder/*.*
instead of folder/folder/*.*
Desktop:
Describe the bug
When receiving to stdout, the progress update that gets printed to Stderr overwrites some of the output from Stdout.
This only happens when both Stderr and Stdout are writing to the same TTY.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The stdout output is fully visible.
Automatic redirection, because some websites will verify the URL
example: The URL you have entered ends in an extension that we do not support. We only accept image files that end in gz, bz2, vmdk, vhdx, qcow, qcow2, vdi, raw, img, xz. (.zip is not supported).
so i don't know what to do
Currently, oneshot responds to bots/iMessage/etc. with an empty page and 200 OK status.
It'd be nice be able to pass in a flag with a path to a file that will be served to bots/iMessage/etc.
Also, I'm not sure if 200 OK is the most appropriate response; any thoughts or input on this would be greatly appreciated.
https://github.com/raphaelrena/oneshot/blob/0e1007a910ec6ef0670cccfc557b39b4b6f2394d/install.sh#L18
The above line results current_version being v1.1.3.
The actual link to the download file is
https://github.com/raphaelreyna/oneshot/releases/download/v1.1.3/ oneshot_1.1.3.linux-arm.tar.gz.
But as your substituing the value of the current_version variable, the URL becomes:
https://github.com/raphaelreyna/oneshot/releases/download/v1.1.3/ oneshot_v1.1.3.linux-arm.tar.gz.
(extra 'v' in the URL) which results in an error while the script is trying to download the tar file.
Currently, oneshot will start serving HTTP as soon as it can and will hold a clients connection until it receives an EOF from stdin (if serving from stdin). It'd be nice to be able to turn this off in order to reuse ports in a scenario like:
$ oneshot -u | oneshot
When creating release archives for various architectures could you also add the recompiled man page to the archive :)
When a URL is sent over iMessage, it hits up the url to create a preview of the site; this really goes against the "one-and-done" behavior of oneshot.
By the time the user taps on the link, oneshot has exited.
Describe the bug
Certain errors are never written to stderr so the user never sees them unless they check the logs.
Noticed this when trying to bind oneshot to a port that's already in use.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The error should be visible to the user.
Zip files are empty
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.