https://github.com/Kickball/awesome-selfhosted#url-shorteners
Maybe one of these has the feature.
https://github.com/132ikl/liteshort there is this: you can edit function get_long(short) of liteshort.py to be
def get_long(short):
row = query_db('SELECT long FROM urls WHERE short = ?', (short,), True)
if row and row['long']:
delete_url(short)
return row['long']
return None
or call another query:
def get_long(short):
row = query_db('SELECT long FROM urls WHERE short = ?', (short,), True)
if row and row['long']:
get_db().cursor().execute('DELETE FROM urls WHERE short = ?', (deletion,))
get_db().commit()
return row['long']
return None
You can make it a config option and commit to the project if you like it