commit 92075bcd7a89f1e2c316ce1d662cf6fdab373dea Author: Zjamnik Date: Sun Feb 15 22:04:40 2026 +0100 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..77b3ac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +token.txt \ No newline at end of file diff --git a/ZiplineUploader.ahk b/ZiplineUploader.ahk new file mode 100644 index 0000000..0fd60ac --- /dev/null +++ b/ZiplineUploader.ahk @@ -0,0 +1,130 @@ +#Requires AutoHotkey v2.0 +#SingleInstance Force + +; === PARAMETERS === +; A_Args[1] = token +; A_Args[2..n] = files + +if A_Args.Length < 2 { + install := MsgBox("Usage:`nzipline-upload.ahk ...`n`nInstall to windows send to context menu?", "Zipline Uploader", "YN") + + if (install = "Yes") { + if (!DirExist(A_AppData "\ZiplineUploader")) { + DirCreate(A_AppData "\ZiplineUploader") + } + FileCopy(A_ScriptFullPath, A_AppData "\ZiplineUploader\ZiplineUploader.exe", true) + token := "" + if (FileExist(A_WorkingDir "\token.txt")) { + token := FileRead(A_WorkingDir "\token.txt") + } else { + tokenInput := InputBox("Provide your Zipline API token (found in your profile settings):", "Zipline Uploader") + token := tokenInput.Value + } + sendTo := "`"" A_AppData "\ZiplineUploader\ZiplineUploader.exe`"" + FileCreateShortcut(sendTo, A_AppData "\Microsoft\Windows\SendTo\Zipline Uploader.lnk", A_AppData "\ZiplineUploader", token) + } + ExitApp +} + +Token := A_Args[1] +ZiplineURL := "https://zipline.zjamnik.giize.com" + +; Collect files +files := A_Args.Clone() +files.RemoveAt(1) ; remove token +uploadedFiles := 0 +uploadedURLs := "" + +for fil in files { + SplitPath fil, &name, &dir, &ext + + ; Determine MIME type + mime := "application/octet-stream" ; default fallback + + switch ext { + ; Video + case "mp4": mime := "video/mp4" + case "m4v": mime := "video/x-m4v" + case "mov": mime := "video/quicktime" + case "mkv": mime := "video/x-matroska" + case "webm": mime := "video/webm" + case "avi": mime := "video/x-msvideo" + case "wmv": mime := "video/x-ms-wmv" + case "flv": mime := "video/x-flv" + case "mpeg", "mpg": mime := "video/mpeg" + case "3gp": mime := "video/3gpp" + case "3g2": mime := "video/3gpp2" + + ; Audio + case "mp3": mime := "audio/mpeg" + case "wav": mime := "audio/wav" + case "flac": mime := "audio/flac" + case "ogg": mime := "audio/ogg" + case "m4a": mime := "audio/mp4" + case "aac": mime := "audio/aac" + case "opus": mime := "audio/opus" + case "wma": mime := "audio/x-ms-wma" + + ; Images + case "jpg", "jpeg": mime := "image/jpeg" + case "png": mime := "image/png" + case "gif": mime := "image/gif" + case "webp": mime := "image/webp" + case "bmp": mime := "image/bmp" + case "tiff", "tif": mime := "image/tiff" + case "svg": mime := "image/svg+xml" + case "heic": mime := "image/heic" + case "heif": mime := "image/heif" + + ; Documents + case "pdf": mime := "application/pdf" + case "txt": mime := "text/plain" + case "md": mime := "text/markdown" + case "html": mime := "text/html" + case "css": mime := "text/css" + case "csv": mime := "text/csv" + case "json": mime := "application/json" + case "xml": mime := "application/xml" + + ; Archives / binaries + case "zip": mime := "application/zip" + case "rar": mime := "application/vnd.rar" + case "7z": mime := "application/x-7z-compressed" + case "tar": mime := "application/x-tar" + case "gz": mime := "application/gzip" + case "bz2": mime := "application/x-bzip2" + case "exe": mime := "application/vnd.microsoft.portable-executable" + case "bin": mime := "application/octet-stream" + } + + ; Build curl command + cmd := 'curl -s -H "Authorization: ' Token '" ' + cmd .= '-H "x-zipline-original-name: true" ' + cmd .= '-F "file=@' fil ';type=' mime '" ' + cmd .= '-F "filename=' name '" ' + cmd .= '"' ZiplineURL '/api/upload"' + + ; Run curl and capture output + RunWait(A_ComSpec " /c " cmd " | clip", , "Hide") + output := A_Clipboard + + ; Extract URL from JSON + if RegExMatch(output, '"url":"(.*?)"', &m) { + url := m[1] + } else { + MsgBox "Failed to extract URL.`nResponse:`n" output + ExitApp + } + + uploadedURLs .= url "`n" + uploadedFiles++ +} + +; Copy to clipboard +A_Clipboard := uploadedURLs + +; Notification +TrayTip "Zipline Upload", "Uploaded " uploadedFiles " file(s)", 1 + +Sleep 3000 +ExitApp \ No newline at end of file diff --git a/ZiplineUploader.exe b/ZiplineUploader.exe new file mode 100644 index 0000000..b532792 Binary files /dev/null and b/ZiplineUploader.exe differ diff --git a/ZiplineUploader_Compile.ahk b/ZiplineUploader_Compile.ahk new file mode 100644 index 0000000..e136578 --- /dev/null +++ b/ZiplineUploader_Compile.ahk @@ -0,0 +1,7 @@ +RunWait '"C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe"' + . ' /in "C:\Users\Zjamnik\Git\ZiplineUploader\ZiplineUploader.ahk"' + . ' /icon "C:\Users\Zjamnik\Git\ZiplineUploader\favicon.ico"' + . ' /base "C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe"' + . ' /compress 0' + +Run("ZiplineUploader.exe") diff --git a/apple-touch-icon.png b/apple-touch-icon.png new file mode 100644 index 0000000..21476e7 Binary files /dev/null and b/apple-touch-icon.png differ diff --git a/favicon-32x32.png b/favicon-32x32.png new file mode 100644 index 0000000..5355b61 Binary files /dev/null and b/favicon-32x32.png differ diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..ff44f8e Binary files /dev/null and b/favicon.ico differ diff --git a/favicon.svg b/favicon.svg new file mode 100644 index 0000000..ef10eb9 --- /dev/null +++ b/favicon.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +