SyncTube icon indicating copy to clipboard operation
SyncTube copied to clipboard

disable salt login

Open 89891383 opened this issue 1 year ago • 5 comments

How to disable the need to have "salt"? because in render.com I do not have access to Shell, and there I only want to host synctube. I just want to be able to log in by "hash".

89891383 avatar Jan 22 '24 19:01 89891383

Do you mean admin login? Can you try creating an admin locally with access to the server CLI, and then commit the user/users.json file to render.com? Then your admin will have to stay between restarts. Or maybe I misunderstood your task.

RblSb avatar Jan 22 '24 19:01 RblSb

ohhh.. yes login admin, but i dont have CLI

89891383 avatar Jan 22 '24 19:01 89891383

Are you sure you cannot install nodejs on your pc, open synctube project folder in terminal and run npm i ws and then run it with node build/server.js? Then you will get access to /addAdmin command in terminal and will add your admin to user/users.json file, and then commit that file to render without problems. If you cannot do that, i can provide you some custom instructions how to make that users.json file with your admin and password, but you still will need to change it a little and then push to your render.com repo.

RblSb avatar Jan 23 '24 20:01 RblSb

Yeah, if you can give me instructions, so far I have something like this in users.json

{
	"admins": [
		{
			"name": "test",
			"hash": "test"
		}
	]
}

the problem is that when I try to log in it shows me the wrong password - then I have to log in through devtools in local storage. Is there perhaps some other solution?

89891383 avatar Jan 24 '24 13:01 89891383

File like this is generated when you do /addAdmin in server cli in and close server:

{
	"admins": [
		{
			"name": "Moka",
			"hash": "SOME_HASH"
		}
	],
	"bans": [],
	"salt": "9821079f7b9cf9bffacd5e06db534c549c7da9d1a2e41e14de63e4ea1685b9fc"
}

Here is generator to replace user SOME_HASH, update name/password vars as you like, click Build and Run and copy "hash" value from output: https://try.haxe.org/#8FC4a0fF

Then save json above as user/users.json

Script backup
import haxe.crypto.Sha256;
class Test {
    static function main() {
        var name = "Asuka";
        var password = "1234";
        var salt = "9821079f7b9cf9bffacd5e06db534c549c7da9d1a2e41e14de63e4ea1685b9fc";
        
        trace(haxe.Json.stringify({
			name: name,
			hash: Sha256.encode(password + salt)
		}, "\t"));
    }
}

RblSb avatar Jan 24 '24 17:01 RblSb

I think this is solved, don't see a easier solution for safe admin creation.

RblSb avatar Jan 25 '25 13:01 RblSb

Completed with https://github.com/RblSb/SyncTube/pull/62

RblSb avatar Apr 07 '25 14:04 RblSb