From 35efdddcae0f38df621280e5188ef7455decc547 Mon Sep 17 00:00:00 2001 From: Humdinger Date: Sun, 3 Nov 2019 11:11:42 +0100 Subject: [PATCH] Change online service to 'Linx' Since the "Null Pointer" at https://0x0.st has been unreliable, switch to "Linx" at https://linx.li . Expiration time is currently hardcoded to 1 day. --- ReadMe.md | 37 +++++++------------------------------ UploadIt.rdef | 2 +- main.cpp | 6 +++++- 3 files changed, 13 insertions(+), 32 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index 6d311d5..1a1d934 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,35 +1,8 @@ # UploadIt -UploadIt is a Tracker Add-On that uploads a single file to the online service *The Null Pointer* at https://0x0.st . The URL for the uploaded file is put into the clipboard after the upload has finished, ready to be pasted into an email, a chat window or forum post. +UploadIt is a Tracker Add-On that uploads a single file to the online service *Linx* at https://linx.li. The URL for the uploaded file is put into the clipboard after the upload has finished, ready to be pasted into an email, a chat window or forum post. -According to *The Null Pointer* website: - -* Maximum file size: 512.0 MiB -* Not allowed: application/x-dosexec, child pornography -* File URLs are valid for at least 30 days and up to a year, depending on file size: -``` - days - 365 | \ - | \ - | \ - | \ - | \ - | \ - | .. - | \ - 197.5 | ----------..------------------------------------------- - | .. - | \ - | .. - | ... - | .. - | ... - | .... - | ...... - 30 | .................... - 0 256 512 - MiB -``` +Currently the expiration time for the uploaded file is hard-coded to 1 week. ### Tips @@ -38,9 +11,13 @@ According to *The Null Pointer* website: * UploadIt uses a curl command line that does all the work. You can put the line into your ```~/config/settings/profile``` and use "upload" from Terminal: ``` function upload() { - curl -F'file=@'$1 https://0x0.st | clipboard -i + curl -H "Linx-Expiry: 604800" -T "$1" https://linx.li/upload/ | clipboard -i + clipboard -p } ``` + +The number for *Linx-Expiry* is the expiration time in seconds (604800 = 1 week). + ### Manual build/install * Build with a simple "make". diff --git a/UploadIt.rdef b/UploadIt.rdef index 537a3a5..6a97c6d 100644 --- a/UploadIt.rdef +++ b/UploadIt.rdef @@ -4,7 +4,7 @@ resource app_flags B_SINGLE_LAUNCH; resource app_version { major = 1, - middle = 0, + middle = 1, minor = 0, /* 0 = development 1 = alpha 2 = beta diff --git a/main.cpp b/main.cpp index 5994261..5524b1f 100644 --- a/main.cpp +++ b/main.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -79,7 +80,10 @@ process_refs(entry_ref directoryRef, BMessage* msg, void*) } else { entry.GetPath(&path); BString command( - "curl -F'file=@'\"%FILENAME%\" https://0x0.st | clipboard -i ; " +// 0x0.st has been quite unreliable +// "curl -F'file=@'\"%FILENAME%\" https://0x0.st | clipboard -i ; " +// switching to linx.li instead (expire in one week (60*60*24*7) + "curl -H \"Linx-Expiry: 604800\" -T \"%FILENAME%\" https://linx.li/upload/ | clipboard -i ; " "exit"); command.ReplaceAll("%FILENAME%", path.Path()); system(command.String());