bokub / nopaste

:clipboard: Client-side paste service
https://nopaste.boris.sh
MIT License
372 stars 133 forks source link

optional url-shortener api support #2

Closed xakrume closed 3 years ago

xakrume commented 4 years ago

please, add url-shortener button support with predefined link/domain with selfhosted

urlshortener = "https://shortener.example.com/api?link="

and display pasted short link

xakrume commented 4 years ago

I understand that this goes beyond the principles where we do not store anything. But it looks like a nightmare if I post the link in a chat message. Users can still use link shorteners to send a message, but to get short links - users need to do a few additional steps

d3r1n commented 3 years ago

btw kutt.it is great to do this its opensource and free

Alyetama commented 3 years ago
$ pip install requests
$ pip install unu
$ pip install pyperclip

Create a python script (let's name it shortner.py):

from unu import unu
import pyperclip

link = pyperclip.paste()
pyperclip.copy(unu(url=link, action="shorturl", format="simple"))

Then run the command like this:

echo -n 'Hello Short World!' | lzma | base64 | xargs -0 printf "https://nopaste.ml/#%s\n" | pbcopy && python3 shortner.py
ghost commented 3 years ago

That's why I'm using paste.sh.

jzeuzs commented 3 years ago

You could use this: https://github.com/qntm/base65536

xakrume commented 3 years ago

closed because we switched to dpaste. Nopaste offers another idea that I find uncomfortable, because the big text/code in encoding and decoding loads the CPU.