Merge branch 'pre_trustie_server' into trustie_server

This commit is contained in:
xxq250 2025-03-13 14:08:12 +08:00
commit 756ed9152e
16 changed files with 107 additions and 34 deletions

View File

@ -1,11 +1,3 @@
GIT
remote: https://gitlink.org.cn/KingChan/sonarqube.git
revision: 80f07d427322ef02c0714c77a382e87aed0bef81
specs:
sonarqube (1.3.0)
httparty (~> 0.14, >= 0.14.0)
terminal-table (~> 1.5, >= 1.5.1)
GEM GEM
remote: https://mirrors.cloud.tencent.com/rubygems/ remote: https://mirrors.cloud.tencent.com/rubygems/
specs: specs:
@ -107,6 +99,7 @@ GEM
archive-zip (~> 0.10) archive-zip (~> 0.10)
nokogiri (~> 1.8) nokogiri (~> 1.8)
chunky_png (1.3.11) chunky_png (1.3.11)
coderay (1.1.3)
concurrent-ruby (1.1.6) concurrent-ruby (1.1.6)
connection_pool (2.2.2) connection_pool (2.2.2)
crass (1.0.6) crass (1.0.6)
@ -143,7 +136,7 @@ GEM
fugit (1.4.1) fugit (1.4.1)
et-orbi (~> 1.1, >= 1.1.8) et-orbi (~> 1.1, >= 1.1.8)
raabro (~> 1.4) raabro (~> 1.4)
gitea-client (1.4.6) gitea-client (1.5.9)
rest-client (~> 2.1.0) rest-client (~> 2.1.0)
globalid (0.4.2) globalid (0.4.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
@ -156,11 +149,8 @@ GEM
hashie (3.6.0) hashie (3.6.0)
htmlentities (4.3.4) htmlentities (4.3.4)
http-accept (1.7.0) http-accept (1.7.0)
http-cookie (1.0.5) http-cookie (1.0.8)
domain_name (~> 0.5) domain_name (~> 0.5)
httparty (0.21.0)
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
i18n (1.8.2) i18n (1.8.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
io-like (0.3.1) io-like (0.3.1)
@ -189,7 +179,8 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2) ruby_dep (~> 1.2)
loofah (2.4.0) logger (1.6.6)
loofah (2.20.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.7.1)
@ -198,9 +189,10 @@ GEM
mimemagic (~> 0.3.2) mimemagic (~> 0.3.2)
maruku (0.7.3) maruku (0.7.3)
method_source (0.9.2) method_source (0.9.2)
mime-types (3.5.2) mime-types (3.6.0)
logger
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2024.0507) mime-types-data (3.2025.0220)
mimemagic (0.3.10) mimemagic (0.3.10)
nokogiri (~> 1) nokogiri (~> 1)
rake rake
@ -255,6 +247,11 @@ GEM
popper_js (1.16.0) popper_js (1.16.0)
powerpack (0.1.2) powerpack (0.1.2)
prettier (0.18.2) prettier (0.18.2)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (4.0.3) public_suffix (4.0.3)
puma (5.6.5) puma (5.6.5)
nio4r (~> 2.0) nio4r (~> 2.0)
@ -448,8 +445,6 @@ GEM
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thor (1.0.1) thor (1.0.1)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.10) tilt (2.0.10)
@ -460,9 +455,7 @@ GEM
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (4.2.0) uglifier (4.2.0)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
unf (0.1.4) unf (0.2.0)
unf_ext
unf_ext (0.0.9.1)
unicode-display_width (1.6.1) unicode-display_width (1.6.1)
web-console (3.7.0) web-console (3.7.0)
actionview (>= 5.0) actionview (>= 5.0)
@ -504,7 +497,7 @@ DEPENDENCIES
enumerize enumerize
faraday (~> 0.15.4) faraday (~> 0.15.4)
font-awesome-sass (= 4.7.0) font-awesome-sass (= 4.7.0)
gitea-client (~> 1.4.3) gitea-client (~> 1.5.8)
grape-entity (~> 0.7.1) grape-entity (~> 0.7.1)
groupdate (~> 4.1.0) groupdate (~> 4.1.0)
harmonious_dictionary (~> 0.0.1) harmonious_dictionary (~> 0.0.1)
@ -514,6 +507,7 @@ DEPENDENCIES
kaminari (~> 1.1, >= 1.1.1) kaminari (~> 1.1, >= 1.1.1)
letter_avatar letter_avatar
listen (>= 3.0.5, < 3.2) listen (>= 3.0.5, < 3.2)
loofah (~> 2.20.0)
mysql2 (>= 0.4.4, < 0.6.0) mysql2 (>= 0.4.4, < 0.6.0)
oauth2 oauth2
omniauth (~> 1.9.0) omniauth (~> 1.9.0)
@ -526,6 +520,7 @@ DEPENDENCIES
parallel (~> 1.19, >= 1.19.1) parallel (~> 1.19, >= 1.19.1)
pdfkit pdfkit
prettier prettier
pry-rails
puma (~> 5.6.5) puma (~> 5.6.5)
rack-cors rack-cors
rails (~> 5.2.0) rails (~> 5.2.0)
@ -552,7 +547,6 @@ DEPENDENCIES
simple_xlsx_reader (~> 1.0.4) simple_xlsx_reader (~> 1.0.4)
sinatra sinatra
solargraph (~> 0.38.0) solargraph (~> 0.38.0)
sonarqube!
spreadsheet spreadsheet
spring spring
spring-watcher-listen (~> 2.0.0) spring-watcher-listen (~> 2.0.0)

View File

@ -67,9 +67,9 @@ class Action::NodeInputsController < ApplicationController
def node_input_params def node_input_params
if params.require(:action_node_input) if params.require(:action_node_input)
params.require(:action_node_input).permit(:name, :input_type, :description, :is_required, :sort_no) params.require(:action_node_input).permit(:name, :input_type, :description, :is_required, :sort_no, :default_value)
else else
params.permit(:name, :input_type, :description, :is_required, :sort_no) params.permit(:name, :input_type, :description, :is_required, :sort_no, :default_value)
end end
end end
end end

View File

@ -47,6 +47,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
interactor = sha.present? ? Gitea::UpdateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("update").merge(sha: sha)) : Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("create")) interactor = sha.present? ? Gitea::UpdateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("update").merge(sha: sha)) : Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("create"))
tip_exception(interactor.error) unless interactor.success? tip_exception(interactor.error) unless interactor.success?
file = interactor.result file = interactor.result
@pipeline.save
render_ok({ pipeline_yaml: pipeline_yaml, pipeline_name: params[:pipeline_name], file_name: @pipeline.file_name, sha: sha.present? ? sha : file['content']['sha'] }) render_ok({ pipeline_yaml: pipeline_yaml, pipeline_name: params[:pipeline_name], file_name: @pipeline.file_name, sha: sha.present? ? sha : file['content']['sha'] })
end end
@ -79,8 +80,8 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
def destroy def destroy
@pipeline = Action::Pipeline.find(params[:id]) @pipeline = Action::Pipeline.find(params[:id])
if pipeline if @pipeline
interactor = Gitea::DeleteFileInteractor.call(current_user.gitea_token, @owner.login, content_params("update")) interactor = Gitea::DeleteFileInteractor.call(current_user.gitea_token, @owner.login, del_content_params.merge(identifier: @project.identifier))
tip_exception(interactor.error) unless interactor.success? tip_exception(interactor.error) unless interactor.success?
@pipeline.destroy! @pipeline.destroy!
end end
@ -114,7 +115,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
def show def show
@pipeline = Action::Pipeline.find_by(id: params[:id]) @pipeline = Action::Pipeline.find_by(id: params[:id])
@pipeline = Action::Pipeline.new(id: 0, pipeline_name: "test-ss", yaml: build_test_yaml) if @pipeline.blank? # @pipeline = Action::Pipeline.new(id: 0, pipeline_name: "test-ss", yaml: build_test_yaml) if @pipeline.blank?
end end
def build_pipeline_yaml_new(pipeline_name, pipeline_json) def build_pipeline_yaml_new(pipeline_name, pipeline_json)
@ -172,6 +173,15 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
} }
end end
def del_content_params(opt)
{
filepath: ".gitea/workflows/#{@pipeline.pipeline_name}.yml",
base64_filepath: Base64.encode64(".gitea/workflows/#{@pipeline.pipeline_name}.yml").gsub(/\n/, ''),
branch: @pipeline.branch,
sha: get_pipeline_file_sha(@pipeline.file_name, @pipeline.branch)
}
end
def build_nodes(params_nodes) def build_nodes(params_nodes)
steps_nodes = [] steps_nodes = []
params_nodes.each do |input_node| params_nodes.each do |input_node|

View File

@ -4,4 +4,8 @@ class LicensesController < ApplicationController
q = License.ransack(name_cont: params[:name]) q = License.ransack(name_cont: params[:name])
@licenses = q.result(distinct: true) @licenses = q.result(distinct: true)
end end
def show
@license = License.find(params[:id])
end
end end

View File

@ -263,7 +263,7 @@ class UsersController < ApplicationController
begin begin
@user = current_user @user = current_user
begin begin
result = Notice::Read::CountService.call(current_user.id) result = EduSetting.get("notice_disable").to_s == "true" ? nil : Notice::Read::CountService.call(current_user.id)
@message_unread_total = result.nil? ? 0 : result[2]["unread_notification"] @message_unread_total = result.nil? ? 0 : result[2]["unread_notification"]
rescue rescue
@message_unread_total = 0 @message_unread_total = 0

View File

@ -33,7 +33,7 @@ class Action::Pipeline < ApplicationRecord
belongs_to :user, optional: true belongs_to :user, optional: true
belongs_to :project belongs_to :project
validates :name, presence: { message: "不能为空" } validates :pipeline_name, presence: { message: "不能为空" }
validates :json, length: { maximum: 65535, too_long: "不能超过65535个字符"} validates :json, length: { maximum: 65535, too_long: "不能超过65535个字符"}
validates :yaml, length: { maximum: 65535, too_long: "不能超过65535个字符"} validates :yaml, length: { maximum: 65535, too_long: "不能超过65535个字符"}
end end

View File

@ -23,6 +23,10 @@
<%= form.label :description, "描述" %> <%= form.label :description, "描述" %>
<%= form.text_area :description, rows: 5, :style => 'width:800px;' %> <%= form.text_area :description, rows: 5, :style => 'width:800px;' %>
</div> </div>
<div class="field">
<%= form.label :default_value, "默认值" %>
<%= form.text_field :default_value %>
</div>
<div class="field"> <div class="field">
<%= form.label :is_required, "是否必填项" %> <%= form.label :is_required, "是否必填项" %>
<%= form.check_box("is_required", {}, "true", "false") %> <%= form.check_box("is_required", {}, "true", "false") %>

View File

@ -1,4 +1,4 @@
json.extract! node_input, :id, :name, :input_type, :description json.extract! node_input, :id, :name, :input_type, :description, :is_required, :default_value
if node_input.input_type.to_s == "select" if node_input.input_type.to_s == "select"
json.select node.action_node_selects do |node_select| json.select node.action_node_selects do |node_select|
json.partial! "node_select", locals: { node_select: node_select, node: node } json.partial! "node_select", locals: { node_select: node_select, node: node }

View File

@ -27,6 +27,10 @@
<%= form.label :description, "描述" %> <%= form.label :description, "描述" %>
<%= form.text_area :description, rows: 5, :style => 'width:800px;' %> <%= form.text_area :description, rows: 5, :style => 'width:800px;' %>
</div> </div>
<div class="field">
<%= form.label :default_value, "默认值" %>
<%= form.text_field :default_value %>
</div>
<div class="field"> <div class="field">
<%= form.label :is_required, "是否必填项" %> <%= form.label :is_required, "是否必填项" %>
<%= form.check_box("is_required", {}, "true", "false") %> <%= form.check_box("is_required", {}, "true", "false") %>

View File

@ -1,4 +1,4 @@
json.extract! node_input, :id, :name, :input_type, :description, :is_required json.extract! node_input, :id, :name, :input_type, :description, :is_required, :default_value
if node_input.input_type.to_s == "select" if node_input.input_type.to_s == "select"
json.select node.action_node_selects do |node_select| json.select node.action_node_selects do |node_select|
json.partial! "node_select", locals: { node_select: node_select, node: node } json.partial! "node_select", locals: { node_select: node_select, node: node }

View File

@ -30,7 +30,7 @@
<li><%= sidebar_item(admins_project_ignores_path, '忽略文件', icon: 'git', controller: 'admins-project_ignores', has_permission: current_user.admin?) %></li> <li><%= sidebar_item(admins_project_ignores_path, '忽略文件', icon: 'git', controller: 'admins-project_ignores', has_permission: current_user.admin?) %></li>
<% end %> <% end %>
</li> </li>
<!-- <li><%#= sidebar_item(admins_laboratories_path, '导航栏配置', icon: 'cloud', controller: 'admins-laboratories', has_permission: current_user.admin?) %></li>--> <li><%= sidebar_item(admins_laboratories_path, '导航栏配置', icon: 'cloud', controller: 'admins-laboratories', has_permission: current_user.admin?)%></li>
<li> <li>
<%= sidebar_item_group('#setting-system', '开发者配置', icon: 'wrench', has_permission: current_user.admin?) do %> <%= sidebar_item_group('#setting-system', '开发者配置', icon: 'wrench', has_permission: current_user.admin?) do %>
<li><%= sidebar_item(admins_sites_path, 'setting接口配置', icon: 'deaf', controller: 'admins-sites', has_permission: current_user.admin?) %></li> <li><%= sidebar_item(admins_sites_path, 'setting接口配置', icon: 'deaf', controller: 'admins-sites', has_permission: current_user.admin?) %></li>

View File

@ -0,0 +1,3 @@
json.id @license.id
json.name @license.name
json.content @license.content

View File

@ -10,6 +10,7 @@ json.projects @projects do |project|
json.praises_count project.praises_count.to_i json.praises_count project.praises_count.to_i
json.forked_count project.forked_count.to_i json.forked_count project.forked_count.to_i
json.is_public project.is_public json.is_public project.is_public
json.license_id project.license_id
json.mirror_url project.repository&.mirror_url json.mirror_url project.repository&.mirror_url
json.type project&.numerical_for_project_type json.type project&.numerical_for_project_type
json.last_update_time render_unix_time(project.updated_on) json.last_update_time render_unix_time(project.updated_on)

View File

@ -66,6 +66,7 @@ else
json.private !@project.is_public json.private !@project.is_public
end end
json.license_name @project.license_name json.license_name @project.license_name
json.license_id @project.license_id
json.branches_count @result[:branch_tag_total_count].present? ? (@result[:branch_tag_total_count]['branch_count'] || 0) : 0 json.branches_count @result[:branch_tag_total_count].present? ? (@result[:branch_tag_total_count]['branch_count'] || 0) : 0
json.tags_count @result[:branch_tag_total_count].present? ? (@result[:branch_tag_total_count]['tag_count'] || 0) : 0 json.tags_count @result[:branch_tag_total_count].present? ? (@result[:branch_tag_total_count]['tag_count'] || 0) : 0
# json.contributors do # json.contributors do

47
config/puma.rb.example Normal file
View File

@ -0,0 +1,47 @@
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 8 }
threads threads_count, threads_count * 2
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch("PORT") { 4000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 8 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
# preload_app!
before_fork do
require 'puma_worker_killer'
PumaWorkerKiller.config do |config|
config.ram = 2048 # mb
config.frequency = 20 # seconds
config.percent_usage = 0.98
#config.rolling_restart_frequency = 12 * 3600 # 12 hours in seconds, or 12.hours if using Rails
end
PumaWorkerKiller.start
end
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart

View File

@ -0,0 +1,5 @@
class AddActionNodeInputDefaultValue < ActiveRecord::Migration[5.2]
def change
add_column :action_node_inputs, :default_value, :string
end
end