Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scripts][dependency] Update for Elanthia Online #7000

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 4 additions & 83 deletions dependency.lic
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require 'ostruct'
require 'digest/sha1'
require 'monitor'

$DEPENDENCY_VERSION = '1.7.11'
$DEPENDENCY_VERSION = '2.0'
$MIN_RUBY_VERSION = '3.2.2'
DRINFOMON_IN_CORE_LICH ||= false
DRINFOMON_CORE_LICH_DEFINES ||= []
Expand Down Expand Up @@ -196,7 +196,7 @@ class ScriptManager
unless LICH_VERSION.match?(/^5/)
_respond("<pushBold/>*****************************************************************************<popBold/>")
_respond("<pushBold/>* Unsupported Lich versions detected. *<popBold/>")
_respond("<pushBold/>* Please see https://github.com/rpherbig/dr-scripts/wiki/First-Time-Setup *<popBold/>")
_respond("<pushBold/>* See https://github.com/elanthia-online/dr-scripts/wiki/First-Time-Setup *<popBold/>")
MahtraDR marked this conversation as resolved.
Show resolved Hide resolved
_respond("<pushBold/>* For an update path. *<popBold/>")
_respond("<pushBold/>*****************************************************************************<popBold/>")
exit
Expand All @@ -206,9 +206,7 @@ class ScriptManager
@paste_bin_token = 'dca351a27a8af501a8d3123e29af7981'
@paste_bin_url = 'https://pastebin.com/api/api_post.php'
@firebase_url = 'https://dr-scripts.firebaseio.com/'
@status_repo = Settings['status_repo'] || 'rpherbig/dr-scripts'
@status_branch = Settings['status_branch'] || 'main'
update_status_url
@status_url = 'https://api.github.com/repos/elanthia-online/dr-scripts/git/trees/main'
# Gating setting lich_url on lich version

UserVars.autostart_scripts ||= []
Expand Down Expand Up @@ -253,65 +251,6 @@ class ScriptManager
@autostarts = (UserVars.autostart_scripts + Settings['autostart']).uniq
end

def update_status_url
defaulturl = 'https://api.github.com/repos/' + @status_repo + '/git/trees/' + @status_branch
mainurl = 'https://api.github.com/repos/rpherbig/dr-scripts/git/trees/main'
eo_drscripts = 'https://api.github.com/repos/elanthia-online/dr-scripts/git/trees/main'

unless url_exist?(defaulturl)
_respond Lich::Messaging.monsterbold("Default URL #{defaulturl} not responding. Using an alternate repo+branch combination.")
_respond Lich::Messaging.monsterbold("Unsetting custom repo settings, if any.")
Settings['status_repo'] = nil if Settings['status_repo']
Settings['status_branch'] = nil if Settings['status_branch']
Settings.save
end

if url_exist?(defaulturl)
@status_url = defaulturl
_respond Lich::Messaging.monsterbold("Using set Status URL. #{defaulturl}")
elsif url_exist?(mainurl)
_respond Lich::Messaging.monsterbold("Using alternate Status URL. #{mainurl}")
@status_url = mainurl
elsif url_exist?(eo_drscripts)
_respond Lich::Messaging.monsterbold("Using Elanthia Online Status URL. #{eo_drscripts}")
@status_url = eo_drscripts
else
_respond Lich::Messaging.monsterbold("Could not set Status URL. Please seek help on Discord.")
end
end

def url_exist?(url_string)
url = URI.parse(URI::Parser.new.escape(url_string))
req = Net::HTTP.new(url.host, url.port)
req.use_ssl = (url.scheme == 'https')
path = url.path
res = req.request_head(path || '/')
res.code != "404" # false if returns 404 - not found
rescue Errno::ENOENT, URI::InvalidURIError
false # false if can't find the server, or URI invalid somehow
end

def set_custom_status_repo(repo, branch)
@status_repo = repo
@status_branch = branch
update_status_url
end

def set_custom_status_branch(branch)
@status_branch = branch
update_status_url
end

def unset_custom_status
@status_repo = 'rpherbig/dr-scripts'
@status_branch = 'main'
update_status_url
end

def check_custom_status
@status_url
end

def add_global_auto(script)
@add_autos << script
end
Expand Down Expand Up @@ -351,8 +290,6 @@ class ScriptManager

def run_queue
validate_supported_ruby_version
Settings['status_repo'] = @status_repo
Settings['status_branch'] = @status_branch
update = false

unless @add_autos.empty?
Expand Down Expand Up @@ -1637,7 +1574,7 @@ def verify_script(script_names)
.reject { |name| Script.exists?(name) }
.each do |name|
echo "Failed to find a script named '#{name}'"
echo "Please report this to <https://github.com/rpherbig/dr-scripts/issues>"
echo "Please report this to <https://github.com/elanthia-online/dr-scripts/issues>"
echo "or to Discord <https://discord.gg/3UMbxypN>"
MahtraDR marked this conversation as resolved.
Show resolved Hide resolved
state = false
end
Expand Down Expand Up @@ -1728,22 +1665,6 @@ def stop_autostart(script_names)
end
end

def set_custom_status_repo(repo, branch = 'main')
$manager.set_custom_status_repo(repo, branch)
end

def set_custom_status_branch(branch)
$manager.set_custom_status_branch(branch)
end

def unset_custom_status
$manager.unset_custom_status
end

def check_custom_status
echo $manager.check_custom_status
end

def setup_profiles
$manager.setup_profiles
end
Expand Down
Loading