This commit is contained in:
Alexey Berezhok
2026-05-03 16:32:53 +03:00
parent 8add078e7c
commit a3888d10b4
10 changed files with 267 additions and 5 deletions

View File

@@ -189,6 +189,22 @@ class BunkerwebWorker < Kernel::ModuleCoreWorker
puts output
ACTION_OK
end
when "alias"
m_domain = args[1].strip unless args[1].nil?
m_alias = args[2].strip unless args[1].nil?
if m_domain.nil?
log_return("Domain should be specified. #{args}")
else
log("add alias to domain to bunkerweb protection")
output = `/usr/local/hestia/bin/v-bunkerweb-module alias #{m_domain} "#{m_alias}" shell`
exit_status = $?.exitstatus
if exit_status != 0
log_return("Command failed with status #{exit_status}")
else
ACTION_OK
end
end
when "help"
puts "#{$0} bunkerweb_module COMMAND [OPTIONS] [json|csv|plain]"
puts "COMMANDS:"

View File

@@ -2,6 +2,7 @@
require 'pathname'
require 'fileutils'
require 'digest'
class UpdateWorker < Kernel::ModuleCoreWorker
MODULE_ID = "update_module"
@@ -17,7 +18,6 @@ class UpdateWorker < Kernel::ModuleCoreWorker
end
def file_changed?(new_file, old_file)
require 'digest/sha256'
return true unless File.exist?(old_file)
new_hash = Digest::SHA256.file(new_file).hexdigest
old_hash = Digest::SHA256.file(old_file).hexdigest
@@ -80,6 +80,9 @@ class UpdateWorker < Kernel::ModuleCoreWorker
result = []
result = list.map do |new_dir, new_file, old_file|
file_name = Pathname.new(new_file).relative_path_from(Pathname.new(new_dir)).to_s
dir_name = File.basename(new_dir)
relative_path = Pathname.new(new_file).relative_path_from(Pathname.new(new_dir)).to_s
file_name = File.join(dir_name, relative_path)
{
"FILE_NAME" => file_name,
"NEW_SIZE" => File.size(new_file),