mad/hosts/lainsafe_onion.sh
kittykat fa83163a58
# 2024.11.18 - [up_fileditch / fileditch] Add fileditch.com as upload and download host
# 2024.11.17 - [innocent] Fix "Fetching file info". Support resume downloads.
# 2024.11.16 - [mad] Fix reload on uploads.txt modified (uploads: filemode)
# 2024.11.16 - [up_*] Fix removal of upload ticket if filesize is not supported
# 2024.11.15 - [familleflender] Add famille-flender.fr as download host
# 2024.11.15 - [up_familleflender] Add famille-flender.fr as upload host
# 2024.11.15 - [up_filehaus] Finish the uploader (the server is back online)
2024-11-18 14:48:48 +00:00

38 lines
2 KiB
Bash

#! Name: lainsafe_onion.sh
#! Author: kittykat
#! Version: 2024.09.13
#! Desc: Add support for downloading and processing of urls for a new host
#! Usage: Copy this file into the ./${ScriptDir}/hosts/ folder
#!
#!
#! ------------ REQUIRED SECTION ---------------
#! @[UPDATE] HostAndDomainRegexes: This string is loaded into mad.sh and allows dynamic handling of new url data
#! Format: '/HostCode/HostNick/HostFuncPrefix:HostDomainRegex@'
#! HostCode: <aUniqueCodeForHost> (ie. 'fh' for filehaus -- cannot be used by other hosts)
#! HostNick: What is displayed throughout MAD output (ie. 'filehaus' -- "urls.txt has 10 filehaus.." will be displayed)
#! HostFuncPrefix: <aUniqueStringThatMustPrefixHostFunctions> (ie. 'fh' -- fh_DownloadFile(), fh_FetchFileInfo() .. )
#! * Note: Must begin with a letter a-z (functions beginning with numbers are no bueno)
#! HostDomainRegex: The regex used to verify matching urls
HostCode='lain'
HostNick='lainsafe.onion'
HostFuncPrefix='lainsafeonion'
HostUrls='lainsafe.kallist4mcluuxbjnr5p2asdlmdhaos3pcrvhk3fbzmiiiftwg6zncid.onion'
HostDomainRegex='^(http|https)://lainsafe.kallist4mcluuxbjnr5p2asdlmdhaos3pcrvhk3fbzmiiiftwg6zncid\.onion/files/'
#!
#! !! DO NOT UPDATE OR REMOVE !!
#! This merges the Required HostAndDomainRegexes into mad.sh
ListHostAndDomainRegexes=${ListHostAndDomainRegexes}'/'${HostCode}'/'${HostNick}'/'${HostFuncPrefix}'/'${HostUrls}':'${HostDomainRegex}'@'
#!
#!
#! ------------ (1) Host Main Download Function --------------- #
#!
#! This is a direct= download host, so all the functions are already in mad.sh
#! Since the HostFuncPrefix is defined above as "direct", nothing further needs to be done as it will
#! call the direct_DownloadFile() function already in mad.sh
lainsafeonion_DownloadFile() {
local pUrl="$1"
local pFileCnt="$2"
local pFileUrl="${pUrl//lainsafe.kallist4mcluuxbjnr5p2asdlmdhaos3pcrvhk3fbzmiiiftwg6zncid\.onion\/files/pomf2.lain.la\/f}"
echo -e "[${BLUE}ModifiedUrl${NC}]: ${pFileUrl}"
direct_DownloadFile "$pUrl" "$pFileCnt" "$pFileUrl"
}