XBackBone icon indicating copy to clipboard operation
XBackBone copied to clipboard

Change link ID?

Open ItsNoted opened this issue 2 years ago • 5 comments

When XBackBone is setup it creates a uniqe 5 character ID and stores all the images there. Is there any way to change that? I had an older installation and all the links are linking back to that folder ID but I want my new instance to use the same ID if possible?

Example: https://mydomain.com/JipE3/tEMULobI38.png

Jipe3 being the unique ID I want to change so it matches the old ID and so the links I have out there will work again.

FYI I am using docker.

ItsNoted avatar Sep 12 '21 22:09 ItsNoted

Depending how old it is, you should be able to update it to the latest version, no major database changes are done since a good while then. Without the database, the only way is changing manually the user code inside the database, and maybe write a script add the uploads to the uploads table

sergix44 avatar Sep 16 '21 07:09 sergix44

Please add option to edit user code to own text in admin area

anondev-sudo avatar Dec 20 '21 19:12 anondev-sudo

Any news on that topic? Would like to change / update the user codes aswell .. Would be nice if u have a option to choose like the current codes or just the user id like : example.com/1/1337.png

leteaaDEV avatar Jul 29 '22 01:07 leteaaDEV

Silly workaround~

Shutdown your XBackBone Instance down Download /wherever your instance config folder is/www/xbackbone/resources/database/xbackbone.db BACK IT UP JUST IN CASE THIS GOES WRONG FOR YOU Open up https://sqliteonline.com/ File > Open DB > xbackbone.db In the text field put this

-- Update Users Table
UPDATE users
-- Set the user_code to whatever, up to 5 characters, you can use less
SET user_code = "abcde"
-- Find the user with email of this and set the user_code to what is shown in the previous statement
WHERE email = "[email protected]";

Hit Run at the top, fingers crossed no errors 🤞 File > Save DB > Downloads as sqlite.db Upload the new sqlite.db to where xbackbone.db is and restart XBackBone and should have changed the user code. All existing user uploads seem to stick around, I tested my account with 1 image with user code Wapi2, changed code to abcde and the image stuck around, though locally its still under the old code's folder.

Would be nice to be able to change it through the UI, or only let admins change them?

Hi-ImKyle avatar Sep 09 '22 08:09 Hi-ImKyle

I'm using XBackBone on cloudron and it's even simpler - you don't need to shut down the DB. Just open Terminal, then click "MySQL" and hit enter - you are immediately at the SQL prompt.

You can submit show databases; to get the DB list, then use <DBNAME>; to switch to the correct DB.

The following tables were present in my instance:

image

The only tables that contained the user code were:

  • users
  • uploads

The uploads table points to the storage_path, so you can just leave this as it is to avoid renaming the physical folder.

Just run the following (adjust for your needs):

update users set user_code='1' where username='allan';

Uploading a new file will automatically create a new folder with the new user_code.

Note - whilst the physical (server) directory is unchanged, your existing URLs do need to be changed - you will need to use the new, shorter user_code in all your links as the old ones will now return 404s.

Now, we just need a way to automatically reduce the filenames!

allanbowe avatar Sep 14 '22 08:09 allanbowe