diff --git a/twtxt_template.txt b/twtxt_template.txt deleted file mode 100644 index 330a06d..0000000 --- a/twtxt_template.txt +++ /dev/null @@ -1,34 +0,0 @@ -# | |___ _| |___ _| |_ -# | __\ \ /\ / / __\ \/ / __| -# | |_ \ V V /| |_ > <| |_ -# \__| \_/\_/ \__/_/\_\\__| -# -# Twtxt is an open, distributed and decentralized microblogging platform -# for hackers and friends that uses raw text files, easy to read by humans, -# and with common protocols and free and open. -# -# Using twtxt-php from: https://github.com/eapl-gemugami/twtxt-php -# Know more about twtxt here: https://github.com/buckket/twtxt -# Using the following extensions: -# https://github.com/eapl-gemugami/twtxt-php/blob/master/docs/02-metadata-extension.md -# -# nick = timeline -# url = http://example.com/timeline/twtxt.txt -# avatar = http://example.com/timeline/avatar.png -# emoji = 👾 -# link = -# lang = -# description = -# discovery = -# -# following = 123 -# follow = eapl.me https://eapl.me/twtxt.txt -# follow = eapl.mx https://eapl.mx/twtxt.txt -# follow = lyse https://lyse.isobeef.org/twtxt.txt -# follow = prologic https://twtxt.net/user/prologic/twtxt.txt -# follow = sorenpeter http://darch.dk/twtxt.txt -# follow = stigatle https://yarn.stigatle.no/user/stigatle/twtxt.txt -# follow = thecanine https://twtxt.net/user/thecanine/twtxt.txt -#~~~# - -2023-09-10T18:55:27+02:00 Hello twtxt world! diff --git a/views/load_twt_files.php b/views/load_twt_files.php index 81abab6..d183c6f 100644 --- a/views/load_twt_files.php +++ b/views/load_twt_files.php @@ -44,6 +44,7 @@ $fileContent = mb_convert_encoding($fileContent, 'UTF-8'); $fileLines = explode("\n", $fileContent); $twtFollowingList = []; + foreach ($fileLines as $currentLine) { if (str_starts_with($currentLine, '#')) { if (!is_null(getDoubleParameter('follow', $currentLine))) { @@ -54,13 +55,53 @@ foreach ($fileLines as $currentLine) { # Load all the files # Save a flag to know it's loading files in the background +/* foreach ($twtFollowingList as $following) { echo "Updating: $following[1]
\n"; #ob_flush(); + flush(); updateCachedFile($following[1]); } -echo 'Finished'; -#ob_flush(); +*/ +//echo 'Finished'; +//ob_flush(); + +//header('Location: /'); +//exit(); + +/* from: https://github.com/w3shaman/php-progress-bar */ + +echo '
'; + +echo '
'; + + +$i = 1; +foreach ($twtFollowingList as $following) { + $total = count($twtFollowingList); + // Calculate the percentation + $percent = intval($i/$total * 100)."%"; + + // Javascript for updating the progress bar and information + echo ''; + + +// This is for the buffer achieve the minimum size in order to flush data + + echo "Updating: $following[1]"." (".$i."/".$total.")
\n"; + updateCachedFile($following[1]); + +// Send output to browser immediately + flush(); + $i++; +} + +echo 'Finished'; + + +// Tell user that the process is completed +echo ''; -header('Location: /'); -exit();