Coder Social home page Coder Social logo

132ikl / liteshort Goto Github PK

View Code? Open in Web Editor NEW
59.0 59.0 7.0 75 KB

[MOVED] User-friendly, actually lightweight, and configurable URL shortener

Home Page: https://ls.ikl.sh

License: MIT License

Python 83.28% HTML 10.59% CSS 6.14%
api flask link-shortener website

liteshort's Introduction

I have moved to my own repository hosting. If you would like to create an issue or PR on one of my repositories, please make an account on git.ikl.sh or login using GitHub OAuth and make the issue or PR there.

liteshort's People

Contributors

132ikl avatar eibex avatar kevin-mok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

liteshort's Issues

Docker image

Are there any plans to create a Docker container for this application?

API delete returns success but does not actually delete the URL

Requesting an URL deletion does not work as intended, both with long and short data.

curl -u user:pwd -d 'format=json' -d 'api=delete' -d 'long=https://longurl.com' https://example.com

This does not seem to do anything even though it returns success. The links that point to this URL keep working.

curl -u user:pwd -d 'format=json' -d 'api=delete' -d 'short=short4chars' https://example.com

This deletes the shorturl, but a new one is created if you try to delete the long URL it was pointing to.

Logging location

I am trying to install this package via pip. I can get it installed, and I can set up the nginx proxy, but I get 500 Internal Server Error messages. I cannot figure out where to find the logs so I can troubleshoot this problem.

I also see that no database is being created. In the YAML file do I need to specify a full path to the database? It looks like there should be something in /var/lib/liteshort, but there is nothing there.

Add optional link expiration

I find myself often creating a short link only to delete it after no longer having a need for it or not wanting people to still access it.

Therefore, I thought of adding a link expiration dropdown menu could be beneficial. The idea I have in mind is very similar to the one of that andreimarcu/linx-server implemented it (see screenshot). The dropdown could default to "Never", but show choices such as as 1 hour, 1 day, etc.

image

Question : maximum combinations of short links

random_length: 4

with that value set as default, does the random URL generator generate only 4 characters, or switches to more than 4 characters when all 4 character combinations are exhausted?

in other words, what's the maximum combinations that can be generated with liteshort?

Add option to disable link to latest URL generated

Being able to access the latest URLs does not seem very privacy friendly. I am currently using a dirty work around that consists of setting the latest option to a randomised 128-character string.

It would be nice if it was possible to avoid generating this link altogether (maybe not specifying anything would result in this instead of defaulting to l?).

Adding a Dockerfile

Hey, I didn't want to register under my real email address on Gitea, sorry.

I wrote a short Dockerfile which seems to do the job for hosting this:

FROM python:3.10-alpine

RUN apk update && apk add uwsgi uwsgi-python3 gcc musl-dev libffi-dev
RUN pip install liteshort requests MarkupSafe==2.0.1

EXPOSE 5000

ENTRYPOINT ["liteshort"]

Note that MarkupSafe has to be version-pinned there because of the removal of soft_unicode (source).

BasicAuth API requests returning HTTP?

I'm trying to get the list of links using the list command from the API section, but all I seem to be getting back from the server is the HTTP site. I have the username and hashed password set and enabled the API in the config file. My POST request has the JSON body { "api": "listshort" } and uses BasicAuth.

This is the timeline of the request done in a REST client:

* Preparing request to http://smol.gq/
* Using libcurl/7.61.1 OpenSSL/1.1.0h zlib/1.2.11 nghttp2/1.29.0
* Current time is 2019-09-03T07:16:49.235Z
* Disable timeout
* Enable automatic URL encoding
* Enable SSL validation
* Enable cookie sending with jar of 0 cookies
* Connection 8 seems to be dead!
* Closing connection 8
* Connection 9 seems to be dead!
* Closing connection 9
* TLSv1.2 (OUT), TLS alert, close notify (256):
*   Trying 165.22.239.234...
* TCP_NODELAY set
* Connected to smol.gq (165.22.239.234) port 80 (#10)
* Server auth using Basic with user 'kevin'

> POST / HTTP/1.1
> Host: smol.gq
> Authorization: Basic a2V2aW46bmVvcnU=
> User-Agent: insomnia/6.6.2
> Content-Type: application/json
> Accept: */*
> Content-Length: 23

| {
| 	"api": "listshort"
| }

* upload completely sent off: 23 out of 23 bytes

< HTTP/1.1 301 Moved Permanently
< Server: nginx/1.14.2
< Date: Tue, 03 Sep 2019 07:16:49 GMT
< Content-Type: text/html
< Content-Length: 185
< Connection: keep-alive
< Location: https://smol.gq/


* Ignoring the response-body
* Received 185 B chunk
* Connection #10 to host smol.gq left intact
* Issue another request to this URL: 'https://smol.gq/'
* Switch from POST to GET
*   Trying 165.22.239.234...
* TCP_NODELAY set
* Connected to smol.gq (165.22.239.234) port 443 (#11)
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /tmp/insomnia_6.6.2/2017-09-20.pem
*   CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: CN=smol.gq
*  start date: Aug 20 13:22:19 2019 GMT
*  expire date: Nov 18 13:22:19 2019 GMT
*  subjectAltName: host "smol.gq" matched cert's "smol.gq"
*  issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
*  SSL certificate verify ok.
* Server auth using Basic with user 'kevin'

> GET / HTTP/1.1
> Host: smol.gq
> Authorization: Basic a2V2aW46bmVvcnU=
> User-Agent: insomnia/6.6.2
> Content-Type: application/json
> Accept: */*

< HTTP/1.1 200 OK
< Server: nginx/1.14.2
< Date: Tue, 03 Sep 2019 07:16:49 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 1401
< Connection: keep-alive


* Received 1401 B chunk
* Connection #11 to host smol.gq left intact

Am I missing something here?

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.