[Catalog] [Manage]

[Return]
Posting mode: Reply
Name
E-mail
Subject
Message
File
Embed   (paste a YouTube URL)
Password   (for post and file deletion)
  • Supported file types are JPG, PNG, GIF, SWF, AAC, FLAC, OGG, OPUS, MP3, MP4, WAV and WEBM.
  • Images greater than 250x250 will be thumbnailed.

File: 1699539476563.jpg–(88.94KB, 800x800, body-royal-caribbean-icon-of-the-seas-ship.jpg)
No.175
Ok, the search that I created previously may or not work.
this is because of Cross-Origin Resource Sharing (CORS) headers correctly on a server .config.
also the age of the browser may choke. The cross orgin is checked in modern browsers.

you can dig into modifying the server .config file to allow access to the server, but
potentially it creates security issues. WAY too much work IMHO for a dumb reading of a text file.

(the same issue is present with the Gallery, but I got it to work with my browser by ignoring cross-origin warnings (or allowing them) no server mods required)

----

So for existing files check Instead I broke it up into two parts:

One a script that you can run as part of maintainence, IE after you move files to their perma home directories.

Two, a dumb simple html that has a button for each text file the script deposits in new-directory location
that when clicked will open a new TAB in the user's browser, and display the latest ${dir_name}_filelist.txt -results after you run the script.
this should be MUCH more secure, and makes it friggin easy for the user to see what files exist in the archive with one click !!!


Your admin script to run either periodically/scheduled cron, or manually when you are moving vids around:

---------cut here ------------------

#!/bin/bash

# Create a new directory to store the result files
# refered to as new-directory in the script

# List of your 12 directories
directories=("dir1" "dir2" "dir3" "dir4" "dir5" "dir6" "dir7" "dir8" "dir9" "dir10" "dir11" "dir12")

# Loop through each directory
for dir in "${directories[@]}"; do
# Get the name of the current working directory
dir_name=$(basename "$dir")

# Run the command in the directory and save the result to a file with the directory name
(cd "$dir" && ls -lh --time=ctime >> "${dir_name}_filelist.txt")

# Move the resulting filelist.txt to the new directory
mv "${dir}/${dir_name}_filelist.txt" new-directory/

# Add a pause between iterations (adjust the sleep duration as needed)
sleep 2
done


----------------end script -------------------------

Note:

In the "List of your 12 directories," you can specify either the full path or relative path to the directories, depending on where you are executing the script from.

If you provide relative paths, they should be relative to the location of the script. If you provide full paths, they should be the complete paths to the directories. Here's an example with

relative paths:

directories=("relative_path1" "relative_path2" "relative_path3" ... "relative_path12")


-just a space between each set of directory Quotes is needed

an example with full paths:

directories="/full/path/to/directory1 /full/path/to/directory2 /full/path/to/directory3 ... /full/path/to/directory12"


- again just a space between paths is needed, don't forget the closing "

The choice of using relative or full paths depends on your specific requirements and where the script is located.
If your script is located in a parent directory of the directories you want to process, using relative paths can be more convenient.
Otherwise, providing full paths ensures accuracy regardless of the script's location.

==================

Part two:

the HTML for you to insert into the Torrent parent HTML file:

---------cut here ------------------

<!DOCTYPE html>
<html>
<head>
<title>Button Example</title>
</head>
<body>
<h1>Click the Buttons to Open .txt Files</h1>

<button onclick="openTxtFile('file1.txt')">Button 1</button>
<button onclick="openTxtFile('file2.txt')">Button 2</button>
<button onclick="openTxtFile('file3.txt')">Button 3</button>
<button onclick="openTxtFile('file4.txt')">Button 4</button>
<button onclick="openTxtFile('file5.txt')">Button 5</button>
<button onclick="openTxtFile('file6.txt')">Button 6</button>
<button onclick="openTxtFile('file7.txt')">Button 7</button>
<button onclick="openTxtFile('file8.txt')">Button 8</button>
<button onclick="openTxtFile('file9.txt')">Button 9</button>
<button onclick="openTxtFile('file10.txt')">Button 10</button>
<button onclick="openTxtFile('file11.txt')">Button 11</button>
<button onclick="openTxtFile('file12.txt')">Button 12</button>

<script>
function openTxtFile(filename) {
window.open(filename, '_blank');
}
</script>
</body>
</html>

----------------end HTML -------------------------

IE: file1.txt is the resulting ${dir_name}_filelist.txt that the bash script creates.
you should preceede the 'file1.txt' with a path to the New-directory you made to house the total script results.

IE: ('/new-directory/file1.txt')

and rename the Buttons : button 1 to action, button 2 pupets etc


I think if you add the above successfully, it will be server "safe", not opening up security holes,
and fucking with more configurations than are necessary.
there would be no excuse to check for existing files after that IMHO.

Enjoy................
¨ No.178
1699811809491.jpg–(143.01KB, 1061x1138, blyad,club.signal.jpg)
ok so i added my full paths and output directories to test this and running the script throws some errors. my mind is very cloudy right now and im having trouble concentrating or staying awake for long.

im not comfortable posting code or bash results here, an image board is not the place.

would you be happy to move our discussion somewhere more private? im putting a signal link here in case you want to use that, just to arrange something. then we could pastebin stuff back and forth.
i really appreciate the help, and im sure all the other users will as well.

Delete Post