gitea token
This commit is contained in:
@@ -138,6 +138,17 @@ in {
|
||||
--synchronize-users
|
||||
''}
|
||||
|
||||
PSQL="${pkgs.postgresql}/bin/psql -U postgres"
|
||||
TOKEN_STRING="$HOMEPAGE_VAR_GITEA_API"
|
||||
SALT=$(${nixpkgs.coreutils}/bin/cat /dev/urandom | ${nixpkgs.gnugrep}/bin/tr -dc 'a-zA-Z0-9' | ${nixpkgs.coreutils}/bin/head -c 10)
|
||||
COMBINED_STRING="${SALT}${TOKEN_STRING}"
|
||||
HASH=$(echo -n "$COMBINED_STRING" | ${nixpkgs.openssl}/bin/openssl dgst -sha256 | ${nixpkgs.coreutils}/bin/cut -d' ' -f2)
|
||||
LAST_8="${TOKEN_STRING: -8}"
|
||||
NOW=$(${nixpkgs.coreutils}/bin/date +%s)
|
||||
$PSQL -d "gitea_db" -e \
|
||||
"INSERT INTO access_token (uid, name, token_hash, token_salt, token_last_eight, created_unix, updated_unix) \
|
||||
VALUES (1, 'homepage-dashboard', '$HASH', '$SALT', '$LAST_8', $NOW, $NOW);"
|
||||
|
||||
|
||||
echo "Completed Gitea Setup"
|
||||
'';
|
||||
|
||||
@@ -173,7 +173,6 @@ in {
|
||||
INSERT OR IGNORE INTO ApiKeys (Id, AccessToken, Name, DateCreated, DateLastActivity)
|
||||
VALUES ( 1, "$HOMEPAGE_VAR_JELLYFIN_API", 'Home', strftime('%Y-%m-%d %H:%M:%S', 'now'), strftime('%Y-%m-%d %H:%M:%S', 'now'));
|
||||
EOF
|
||||
|
||||
echo "Completed Setup"
|
||||
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user