From 4314ae9b015ed37ac05922706088b9390f250b8c Mon Sep 17 00:00:00 2001 From: ashley Date: Sun, 20 Oct 2024 09:10:10 +0000 Subject: [PATCH] add refresh token --- backend-services/scripts/inv-refresh-token.sh | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 backend-services/scripts/inv-refresh-token.sh diff --git a/backend-services/scripts/inv-refresh-token.sh b/backend-services/scripts/inv-refresh-token.sh new file mode 100644 index 00000000..01e406f1 --- /dev/null +++ b/backend-services/scripts/inv-refresh-token.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# +# Copyright (C) 2024-20xx Poke! (https://codeberg.org/ashley/poke) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +scriptDir=$(dirname "$(readlink -f "$0")") + +output=$(docker run quay.io/invidious/youtube-trusted-session-generator) + +visitor_data=$(echo "$output" | grep -oP '(?<=visitor_data: )[^ ]+') +po_token=$(echo "$output" | grep -oP '(?<=po_token: )[^ ]+') + +if [ -z "$visitor_data" ] || [ -z "$po_token" ]; then + echo "Error: Could not generate visitor_data or po_token." + exit 1 +fi + +sed -i "s/visitor_data: .*/visitor_data: $visitor_data/g" $scriptDir/../services/invidious/docker-compose.yml +sed -i "s/po_token: .*/po_token: $po_token/g" $scriptDir/../services/invidious/docker-compose.yml + +cd $scriptDir/../services/invidious + + docker compose up -d + +echo "Successfully updated visitor_data and po_token on Invidious." +