From efee30e3cdaffb287dc5eec8aa257706f39edf06 Mon Sep 17 00:00:00 2001 From: dw5 <29355584+dw5@users.noreply.github.com> Date: Thu, 9 May 2024 14:49:37 +0300 Subject: [PATCH] Docs, actual API Usage example, todo bash example --- EXAMPLES.md | 42 ++++++++++++++++++++++++++++++++++++++++++ README.md | 13 ++++++------- SECURITY.md | 5 ----- 3 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 EXAMPLES.md delete mode 100644 SECURITY.md diff --git a/EXAMPLES.md b/EXAMPLES.md new file mode 100644 index 0000000..9393d68 --- /dev/null +++ b/EXAMPLES.md @@ -0,0 +1,42 @@ +powershell.ps1 + +might need a bit of cleanup, but i'll do later.. because learned rust while making this fork in a way... +``` +function swscli ($filename) +{ + $file = Get-Item $filename; + $fileName = Get-Item $filename + $filetxtname = $($fileName.Name) + + $uri = "http://my-simpler-srv.local:8000/" + + $currentPath = Convert-Path . + $filePath="$currentPath\$fileName" + + $fileBin = Get-Content -Path $fileName.FullName -Raw + $boundary = [System.Guid]::NewGuid().ToString() + $LF = "`r`n" + $bodyLines = ( + "--$boundary", + "Content-Disposition: form-data; name=`"files`"; filename=`"$filetxtname`"; csrf=`"notoken`"", + "Content-Type: application/octet-stream$LF", + $fileBin, + "--$boundary--$LF" + ) -join $LF + + $headers = @{ + "Content-Type" = "multipart/form-data; boundary=`"$boundary`"" + } + + Invoke-RestMethod -Uri $uri -Method POST -Headers $headers -Body $bodyLines +} + +function transfersh ($filename) +{ + $file = Get-Item $filename; + (Invoke-WebRequest -Method POST -InFile $file.FullName -Uri http://comapredwith.transfer.sh:8000/$($file.Name)).Content +} + +# Example usage +swscli(".\my-automatic-output.csv") +``` \ No newline at end of file diff --git a/README.md b/README.md index a0744f9..7ffd24c 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ ### Command Line Arguments ``` -Simple HTTP(s) Server 0.6.3 +Simpler HTTP(s) Server 0.6.3 USAGE: - simple-http-server [FLAGS] [OPTIONS] [--] [root] + simpler-http-server [FLAGS] [OPTIONS] [--] [root] FLAGS: --coep Add "Cross-Origin-Embedder-Policy" HTTP header and set it to "require-corp" @@ -46,7 +46,7 @@ OPTIONS: # Installation ### Download binary -[Goto Download](https://github.com/TheWaWaR/simple-http-server/releases) +[Goto Download](https://github.com/dw5/simpler-http-server/releases) - windows-64bit - osx-64bit @@ -59,10 +59,10 @@ OPTIONS: # Install Rust curl https://sh.rustup.rs -sSf | sh -# Install simple-http-server -cargo install simple-http-server +# Install simpler-http-server +cargo install simpler-http-server rehash -simple-http-server -h +simpler-http-server -h ``` # Features @@ -82,7 +82,6 @@ simple-http-server -h - [Range, If-Range, If-Match] => [Content-Range, 206, 416] - [x] (default disabled) Automatic render index page [index.html, index.htm] - [x] (default disabled) Upload file - - A CSRF token is generated when upload is enabled and must be sent as a parameter when uploading a file - [x] (default disabled) HTTP Basic Authentication (by username:password) - [x] Sort by: filename, filesize, modified date - [x] HTTPS support diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index a4b7c1f..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security Policy - -## Reporting a Vulnerability - -Please report security issues to `thewawar@gmail.com`