Coder Social home page Coder Social logo

Comments (9)

abemassry avatar abemassry commented on May 12, 2024 1

this can be a very simple script like:

#!/bin/bash
id=$(curl -s -X POST -d "[email protected]" -d "password=passwd" https://wsend.net/login_cli)
curl -F "uid=$id" -F "filehandle=@$1" https://wsend.net/upload_cli

if you were to save this somewhere and chmod +x it would probably work ok
the problem is you'd have to log in every time so you might want to do some checking like this

#!/bin/bash
if [[ ! -e "./wsend_id" ]]; then
  read -p "email: " entered_email
  stty -echo
  read -p "Password: " passw; echo
  stty echo
  id=$(curl -s -X POST -d "email=$entered_email" -d "password=$passw" https://wsend.net/login_cli)
  echo "$id" > ./wsend_id
fi
uid=$(cat ./wsend_id)
curl -F "uid=$uid" -F "filehandle=@$1" https://wsend.net/upload_cli

if you chmod +x ed that it would work you could save it to something like wsend and then run:

./wsend file.txt

we can develop it further if its something you think you might like

from wsend.

kkarhan avatar kkarhan commented on May 12, 2024

The workaround using curl -F is something I have used in the past with other sites, which officially support this and showcased it exemplary in this code.

That being said that I only use wsend for bona-fide purposes and said code is a learning example...

My suggestion would be to enable login via some sort of "API Key" instead of the account credentials in plaintext.
Said API key would be easier to replace and could also enable to setup retention limits [i.e. 24 hours or 1 download - whichever happens first] on the webinterface...

For paying/premium users, multiple API keys with different retention settings could be enabled.

How does that sound?

from wsend.

abemassry avatar abemassry commented on May 12, 2024

do you mean API keys have retention settings or the files have retention settings, because we have a --ttl option for files

from wsend.

kkarhan avatar kkarhan commented on May 12, 2024

Not solely for TTL settings, but rather as replacement for plaintext logins so that one can't take control over an account just by finding those logins in .bash_history

from wsend.

abemassry avatar abemassry commented on May 12, 2024

I tested this by trying a login in bash, if done in an interactive terminal the command wsend --login is the only thing that shows up in the .bash_history
In the scrollback of the terminal the password is hidden, but the email address is shown.
After logging in, in the terminal a ~/.wsend/.id file is produced which can be used like an API key, but you're correct in that it doesn't expire

from wsend.

abemassry avatar abemassry commented on May 12, 2024

I've started working on this issue again, how were you envisioning this part to work:

Said API key would be easier to replace and could also enable to setup retention limits [i.e. 24 hours or 1 download - whichever happens first] on the webinterface...

for the 1 download, would an API token be used for a download? currently downloading files doesn't check an api token, they are only used to upload files or pull other account specific information

from wsend.

abemassry avatar abemassry commented on May 12, 2024

This feature is done and has been implemented for paying users, like you have suggested.
Let me know what you think,
Thanks!

from wsend.

abemassry avatar abemassry commented on May 12, 2024

image

from wsend.

kkarhan avatar kkarhan commented on May 12, 2024

Seems like a good option to do so if someone wants to use wsend to automate stuff.
Paywall is a sadly yet necessary means to avoid abuse.

For everyone else, this workaround of yours should be sufficient.

Thanks for implementing the feature.

from wsend.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.