Sign. Part 3
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -36,3 +36,5 @@ gem "sequel", "~> 5.89"
|
||||
gem "ffi", "~> 1.17"
|
||||
|
||||
gem "ptools", "~> 1.5"
|
||||
|
||||
gem "ostruct", "~> 0.6.1"
|
||||
|
||||
@@ -103,6 +103,7 @@ GEM
|
||||
mustermann (3.0.3)
|
||||
ruby2_keywords (~> 0.0.1)
|
||||
nio4r (2.7.4)
|
||||
ostruct (0.6.1)
|
||||
ptools (1.5.0)
|
||||
public_suffix (6.0.1)
|
||||
puma (6.6.0)
|
||||
@@ -175,6 +176,7 @@ DEPENDENCIES
|
||||
ffi (~> 1.17)
|
||||
inifile (~> 3.0)
|
||||
json (~> 1.8)
|
||||
ostruct (~> 0.6.1)
|
||||
ptools (~> 1.5)
|
||||
puma (~> 6.6)
|
||||
rackup (~> 2.2)
|
||||
|
||||
42
app.rb
42
app.rb
@@ -19,6 +19,16 @@ require_relative "classes/utilities"
|
||||
require_relative "classes/projects"
|
||||
require_relative "classes/configs"
|
||||
|
||||
configure do
|
||||
log_file = File.new("logs/actions.log", "a+")
|
||||
|
||||
STDOUT.reopen(log_file)
|
||||
STDERR.reopen(log_file)
|
||||
|
||||
STDOUT.sync = true
|
||||
STDERR.sync = true
|
||||
end
|
||||
|
||||
def print_error_page(error_status, error_meaasge)
|
||||
@page_name = "Ошибка выполнения"
|
||||
@status_err = error_status
|
||||
@@ -1339,8 +1349,7 @@ get "/prjsignview/:id" do
|
||||
else
|
||||
gpgKeys = RepoManagerKeys.new(cfg.get_keys_path)
|
||||
if gpgKeys.check_key_exists
|
||||
sign_path = prj.get_sign_path(params["id"])
|
||||
send_file File.join(sign_path, "index.html")
|
||||
redirect "/prjsignview/#{params["id"]}/"
|
||||
else
|
||||
@page_name = "Ошибка подписания проекта #{prj_info[:projname]}"
|
||||
erb :gpgerror
|
||||
@@ -1350,7 +1359,34 @@ get "/prjsignview/:id" do
|
||||
end
|
||||
|
||||
get "/prjsignview/:id/*" do
|
||||
"test"
|
||||
data_path = params[:splat]
|
||||
pp data_path
|
||||
if data_path.nil? || data_path.first.strip == ""
|
||||
data_path = "index.html"
|
||||
end
|
||||
prj = ProjectsActions.new(cfg.get_projects_path, db)
|
||||
if prj.path.nil?
|
||||
print_error_page(503, "Путь к проектам не существует")
|
||||
else
|
||||
prj_info = prj.get_project(params["id"])
|
||||
if prj_info.nil?
|
||||
print_error_page(503, "Путь к проектам не существует")
|
||||
else
|
||||
gpgKeys = RepoManagerKeys.new(cfg.get_keys_path)
|
||||
if gpgKeys.check_key_exists
|
||||
sign_path = prj.get_sign_path(params["id"])
|
||||
f_path = File.join(sign_path, data_path)
|
||||
if File.exist? (f_path)
|
||||
send_file f_path
|
||||
else
|
||||
status 404
|
||||
end
|
||||
else
|
||||
@page_name = "Ошибка подписания проекта #{prj_info[:projname]}"
|
||||
erb :gpgerror
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
not_found do
|
||||
|
||||
@@ -97,6 +97,7 @@ class RepoManager
|
||||
end
|
||||
pkg_info = {}
|
||||
pkg_info[:fname] = fileName
|
||||
pkg_info[:aname] = item
|
||||
pkg_info[:stat] = File.stat(full_rpm_path).ctime
|
||||
if info[:error].nil?
|
||||
pkg_info[:chlog] = info[:pkginfo].changelog.first(5)
|
||||
@@ -116,7 +117,7 @@ class RepoManager
|
||||
end
|
||||
data_keys.sort!
|
||||
data_keys.each do |item|
|
||||
repo_data << result[item]
|
||||
repo_data << [result[item], item]
|
||||
end
|
||||
tpl_file = File.join(template_dir, "template.erb")
|
||||
template = File.read(tpl_file)
|
||||
|
||||
0
logs/empty
Normal file
0
logs/empty
Normal file
19
mockgui.service
Normal file
19
mockgui.service
Normal file
@@ -0,0 +1,19 @@
|
||||
[Unit]
|
||||
Description=MockGUI application server
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=alexey
|
||||
Group=alexey
|
||||
Environment=RACK_ENV=production
|
||||
WorkingDirectory=/home/mock-gui/mock-gui
|
||||
ExecStart=/home/alexey/.rvm/gems/ruby-3.3.7/bin/bundle exec /home/alexey/.rvm/rubies/ruby-3.3.7/bin/ruby app.rb
|
||||
UMask=0002
|
||||
RestartSec=1
|
||||
Restart=on-failure
|
||||
SyslogIdentifier=mockgui_server
|
||||
LimitNOFILE=15360
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -36,26 +36,27 @@ gpgcheck=1" > /etc/yum.repos.d/<%= repo_name %>.repo
|
||||
<h2 class="accordion-header">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#id<%= index %>" aria-expanded="false" aria-controls="id<%= index %>">
|
||||
SRPMS
|
||||
<%= item[1] %>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="id<%= index %>" class="accordion-collapse collapse" data-bs-parent="#dirInfo">
|
||||
<div class="accordion-body">
|
||||
<div class="accordion accordion-flush" id="rpmInfo">
|
||||
<% item.each_with_index do |idata, jndex| %>
|
||||
<% item[0].each_with_index do |idata, jndex| %>
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
<button class="accordion-button collapsed" type="button"
|
||||
data-bs-toggle="collapse" data-bs-target="#rid<%= jndex %>" aria-expanded="false"
|
||||
aria-controls="rid<%= jndex %>">
|
||||
<%= idata[:fname] %> (<%= idata[:stat]%>)
|
||||
<%= idata[:fname] %> (<%= idata[:stat]%>)
|
||||
</button>
|
||||
</h2>
|
||||
<div id="rid<%= jndex %>" class="accordion-collapse collapse" data-bs-parent="#rpmInfo">
|
||||
<div class="accordion-body">
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item list-group-item-warning"> Скачать пакет - <a href="<%= idata[:aname] %>"><%= idata[:fname] %></a> </li>
|
||||
<% idata[:chlog].each do |chlg| %>
|
||||
<li class="list-group-item list-group-item-warning"> - <%= chlg.text %> </li>
|
||||
<li class="list-group-item list-group-item-warning"> <%= chlg.text %> </li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user