Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions config/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

default['git']['dir']['app'] = '/app/git'
default['git']['dir']['home'] = Dir.home(node['app']['user']) || ENV['HOME'] || '/app'
default['git']['dir']['custom'] = "#{node['git']['dir']['app']}/custom"
default['git']['dir']['workspace'] = "#{node['git']['dir']['home']}/workspace"

default['git']['port']['http'] = 8080
Expand Down
50 changes: 49 additions & 1 deletion config/recipes/customize.rb
Original file line number Diff line number Diff line change
@@ -1 +1,49 @@
Chef::Log.info("")
require 'base64'

# Images

svg = '<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>'
base = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+X6hQAAAAASUVORK5CYII='

directory (dir_images = ::File.join(node['git']['dir']['custom'], 'public', 'assets', 'img')) do
recursive true
owner node['app']['user']
group node['app']['group']
mode '0755'
end

{ 'logo.svg'=>svg, 'favicon.svg'=>svg }.each do |name, data|
file ::File.join(dir_images, name) do
content data
owner node['app']['user']
group node['app']['group']
mode '0644'
end
end

%w[logo.png avatar_default.png apple-touch-icon.png favicon.png].each do |name|
file ::File.join(dir_images, name) do
content lazy { Base64.decode64(base) }
owner node['app']['user']
group node['app']['group']
mode '0644'
end
end

# Templates

directory (dir_templates = ::File.join(node['git']['dir']['custom'], 'templates', 'custom')) do
recursive true
owner node['app']['user']
group node['app']['group']
mode '0755'
end

%w[header extra_links extra_tabs body_inner_pre body_inner_post body_outer_pre body_outer_post footer].each do |template|
template "#{dir_templates}/#{template}.tmpl" do
source "custom/#{template}.tmpl.erb"
owner node['app']['user']
group node['app']['group']
mode '0644'
end
end
2 changes: 0 additions & 2 deletions config/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@

include_recipe 'config::repo'
include_recipe 'config::task'

include_recipe('config::customize') if node['git']['conf']['customize']
4 changes: 3 additions & 1 deletion config/recipes/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
action :create_if_missing
end

include_recipe('config::customize') if node['git']['conf']['customize']

Common.application(self, 'gitea',
user: node['app']['user'] , cwd: node['git']['dir']['data'],
exec: "#{node['git']['dir']['app']}/gitea web --config #{node['git']['dir']['app']}/app.ini",
exec: "#{node['git']['dir']['app']}/gitea web --config #{node['git']['dir']['app']}/app.ini --custom-path #{node['git']['dir']['custom']}",
unit: { 'Service' => { 'Environment' => "USER=#{node['app']['user'] } HOME=#{node['git']['dir']['home']}" } },
subscribe: ["template[#{node['git']['dir']['app']}/app.ini]", "remote_file[#{node['git']['dir']['app']}/gitea]"] )
66 changes: 66 additions & 0 deletions config/templates/custom/css/gitea.css.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
:root {
--bg: #fff;
--fg: #0f172a;
--muted: #64748b;
--line: #e5e7eb;
--primary: #f5f5f5;
--r: 3px;
}

html,
body {
background: var(--bg);
color: var(--fg);
font-size: 14.5px;
line-height: 1.5;
}

#navbar .navbar-left,
#navbar .navbar-right {
display: flex;
align-items: center;
gap: .25rem;
}

#navbar .item:hover,
#navbar .item.active {
color: var(--muted);
background: transparent;
}

#navbar {
display: flex;
align-items: center;
}

.repository .repo-header,
.repo-header,
.header-wrapper {
display: flex;
flex-wrap: wrap;
gap: .5rem;
align-items: center;
}

.repo-title {
font-size: 1.25rem;
font-weight: 700;
}

.repository .meta,
.repo-meta {
color: var(--muted);
}

.repository .labels .label {
margin-right: .25rem;
margin-bottom: .25rem;
}

.repo-list .item,
.repositories .item {
border: 1px solid var(--line);
border-radius: var(--r);
padding: .9rem;
margin-bottom: .7rem;
}
11 changes: 11 additions & 0 deletions config/templates/custom/css/hide.css.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#navbar .item[href$="/issues"]{display:none!important}
#navbar .item[href$="/pulls"]{display:none!important}
#navbar .item[href$="/milestones"]{display:none!important}
#navbar .item[href$="/explore/repos"]{display:none!important}
#navbar .item[href$="/explore/organizations"]{display:none!important}
#navbar .item[href$="https://docs.gitea.com"]{display:none!important}

.ui.menu .item:has(.resize-for-semibold[data-text="Aktivität"]){display:none!important}
.ui.menu .item:has(.resize-for-semibold[data-text="Activity"]){display:none!important}

#user-heatmap,.total-contributions,.vch__legend{display:none!important}
4 changes: 4 additions & 0 deletions config/templates/custom/css/logo.css.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#navbar-logo img{display:none!important}
#navbar-logo{display:flex;align-items:center;gap:.5rem}
#navbar-logo::after{content:"Proxmox-GitOps";font-weight:600;font-size:1.05rem;line-height:1;color:inherit;letter-spacing:.2px;white-space:nowrap}
@media (max-width: 767.98px){#navbar-logo::after{font-size:.95rem}}
Empty file.
Empty file.
Empty file.
Empty file.
4 changes: 4 additions & 0 deletions config/templates/custom/templates/extra_links.tmpl.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<% (node['git']['org'] || {}).values.compact.each do |org| %>
<a class="item" href="{{AppSubUrl}}/<%= org %>"><%= org %></a>
<% end %>
<a class="item" href="{{AppSubUrl}}/main/config">monorepo</a>
Empty file.
Empty file.
9 changes: 9 additions & 0 deletions config/templates/custom/templates/header.tmpl.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<link rel="stylesheet" href="/assets/css/gitea.css" type="text/css">
<link rel="stylesheet" href="/assets/css/logo.css">
<link rel="stylesheet" href="/assets/css/hide.css" type="text/css">

<style>
img[src^="{{AppSubUrl}}/avatars/"]{width:1px;height:1px;opacity:0}
.ui.avatar,img.avatar,.avatar{width:1px!important;height:1px!important;opacity:0!important}
</style>

5 changes: 5 additions & 0 deletions config/templates/git_app.ini.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ REPOSITORY_AVATAR_FALLBACK = none
DISABLE_STARS = true
DISABLE_MIGRATIONS = true

[ui]
ENABLE_USER_HEATMAP = false
ONLY_SHOW_RELEVANT_REPOS = true
EXPLORE_PAGING_DEFAULT_SORT = alphabetically

[service]
ENABLE_REGISTERATION_CAPTCHA = false
DISABLE_GRAVATAR = true
Expand Down