-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from mborne/22-viewer
restore a basic viewer and upgrade flysystem
- Loading branch information
Showing
25 changed files
with
526 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Note that default is 80 which requires the following systemctl config | ||
# in some environment : config net.ipv4.ip_unprivileged_port_start=0 | ||
Listen 8000 | ||
|
||
<IfModule ssl_module> | ||
Listen 443 | ||
</IfModule> | ||
|
||
<IfModule mod_gnutls.c> | ||
Listen 443 | ||
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# | ||
# Disable access to the entire file system except for the directories that | ||
# are explicitly allowed later. | ||
# | ||
# This currently breaks the configurations that come with some web application | ||
# Debian packages. | ||
# | ||
#<Directory /> | ||
# AllowOverride None | ||
# Require all denied | ||
#</Directory> | ||
|
||
|
||
# Changing the following options will not really affect the security of the | ||
# server, but might make attacks slightly more difficult in some cases. | ||
|
||
# | ||
# ServerTokens | ||
# This directive configures what you return as the Server HTTP response | ||
# Header. The default is 'Full' which sends information about the OS-Type | ||
# and compiled in modules. | ||
# Set to one of: Full | OS | Minimal | Minor | Major | Prod | ||
# where Full conveys the most information, and Prod the least. | ||
#ServerTokens Minimal | ||
ServerTokens Prod | ||
#ServerTokens Full | ||
|
||
# | ||
# Optionally add a line containing the server version and virtual host | ||
# name to server-generated pages (internal error documents, FTP directory | ||
# listings, mod_status and mod_info output etc., but not CGI generated | ||
# documents or custom error documents). | ||
# Set to "EMail" to also include a mailto: link to the ServerAdmin. | ||
# Set to one of: On | Off | EMail | ||
ServerSignature Off | ||
#ServerSignature On | ||
|
||
# | ||
# Allow TRACE method | ||
# | ||
# Set to "extended" to also reflect the request body (only for testing and | ||
# diagnostic purposes). | ||
# | ||
# Set to one of: On | Off | extended | ||
TraceEnable Off | ||
#TraceEnable On | ||
|
||
# | ||
# Forbid access to version control directories | ||
# | ||
# If you use version control systems in your document root, you should | ||
# probably deny access to their directories. For example, for subversion: | ||
# | ||
#<DirectoryMatch "/\.svn"> | ||
# Require all denied | ||
#</DirectoryMatch> | ||
|
||
# | ||
# Setting this header will prevent MSIE from interpreting files as something | ||
# else than declared by the content type in the HTTP headers. | ||
# Requires mod_headers to be enabled. | ||
# | ||
#Header set X-Content-Type-Options: "nosniff" | ||
|
||
# | ||
# Setting this header will prevent other sites from embedding pages from this | ||
# site as frames. This defends against clickjacking attacks. | ||
# Requires mod_headers to be enabled. | ||
# | ||
#Header set X-Frame-Options: "sameorigin" | ||
|
||
|
||
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<VirtualHost *:8000> | ||
DocumentRoot /opt/git-manager/public | ||
|
||
<Directory "/opt/git-manager/public"> | ||
Options -Indexes +FollowSymLinks +MultiViews | ||
AllowOverride All | ||
|
||
Require all granted | ||
</Directory> | ||
|
||
ErrorLog ${APACHE_LOG_DIR}/error.log | ||
CustomLog ${APACHE_LOG_DIR}/access.log combined | ||
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
; config/php.ini | ||
date.timezone = UTC | ||
|
||
opcache.enable = 1 | ||
opcache.enable_cli = 1 | ||
opcache.memory_consumption = 128 | ||
opcache.revalidate_freq = 0 | ||
apc.enable_cli = On | ||
|
||
display_errors = Off | ||
display_startup_errors = Off | ||
|
||
# to avoid problems with symfony | ||
variables_order = "EGPCS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ jobs: | |
|
||
strategy: | ||
matrix: | ||
php-version: [7.4,8.1,8.2] | ||
php-version: [8.1,8.2] | ||
|
||
runs-on: ubuntu-latest | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
twig: | ||
default_path: '%kernel.project_dir%/templates' | ||
debug: '%kernel.debug%' | ||
strict_variables: '%kernel.debug%' | ||
exception_controller: null | ||
# form_themes: | ||
# - 'bootstrap_5_layout.html.twig' | ||
# - 'forms.html.twig' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: "3" | ||
|
||
services: | ||
|
||
git-manager: | ||
image: ghcr.io/mborne/git-manager:latest | ||
build: | ||
context: . | ||
ports: | ||
- 8000:8000 | ||
volumes: | ||
- git-manager-data:/var/git-manager | ||
restart: unless-stopped | ||
|
||
volumes: | ||
git-manager-data: | ||
name: git-manager-data | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Use the front controller as index file. It serves as a fallback solution when | ||
# every other rewrite/redirect fails (e.g. in an aliased environment without | ||
# mod_rewrite). Additionally, this reduces the matching process for the | ||
# start page (path "/") because otherwise Apache will apply the rewriting rules | ||
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). | ||
DirectoryIndex index.php | ||
|
||
# By default, Apache does not evaluate symbolic links if you did not enable this | ||
# feature in your server configuration. Uncomment the following line if you | ||
# install assets as symlinks or if you experience problems related to symlinks | ||
# when compiling LESS/Sass/CoffeScript assets. | ||
# Options +FollowSymlinks | ||
|
||
# Disabling MultiViews prevents unwanted negotiation, e.g. "/index" should not resolve | ||
# to the front controller "/index.php" but be rewritten to "/index.php/index". | ||
<IfModule mod_negotiation.c> | ||
Options -MultiViews | ||
</IfModule> | ||
|
||
<IfModule mod_rewrite.c> | ||
RewriteEngine On | ||
|
||
# Determine the RewriteBase automatically and set it as environment variable. | ||
# If you are using Apache aliases to do mass virtual hosting or installed the | ||
# project in a subdirectory, the base path will be prepended to allow proper | ||
# resolution of the index.php file and to redirect to the correct URI. It will | ||
# work in environments without path prefix as well, providing a safe, one-size | ||
# fits all solution. But as you do not need it in this case, you can comment | ||
# the following 2 lines to eliminate the overhead. | ||
RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$ | ||
RewriteRule .* - [E=BASE:%1] | ||
|
||
# Sets the HTTP_AUTHORIZATION header removed by Apache | ||
RewriteCond %{HTTP:Authorization} .+ | ||
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0] | ||
|
||
# Redirect to URI without front controller to prevent duplicate content | ||
# (with and without `/index.php`). Only do this redirect on the initial | ||
# rewrite by Apache and not on subsequent cycles. Otherwise we would get an | ||
# endless redirect loop (request -> rewrite to front controller -> | ||
# redirect -> request -> ...). | ||
# So in case you get a "too many redirects" error or you always get redirected | ||
# to the start page because your Apache does not expose the REDIRECT_STATUS | ||
# environment variable, you have 2 choices: | ||
# - disable this feature by commenting the following 2 lines or | ||
# - use Apache >= 2.3.9 and replace all L flags by END flags and remove the | ||
# following RewriteCond (best solution) | ||
RewriteCond %{ENV:REDIRECT_STATUS} ="" | ||
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L] | ||
|
||
# If the requested filename exists, simply serve it. | ||
# We only want to let Apache serve files and not directories. | ||
# Rewrite all other queries to the front controller. | ||
RewriteCond %{REQUEST_FILENAME} !-f | ||
RewriteRule ^ %{ENV:BASE}/index.php [L] | ||
</IfModule> | ||
|
||
<IfModule !mod_rewrite.c> | ||
<IfModule mod_alias.c> | ||
# When mod_rewrite is not available, we instruct a temporary redirect of | ||
# the start page to the front controller explicitly so that the website | ||
# and the generated links can still be used. | ||
RedirectMatch 307 ^/$ /index.php/ | ||
# RedirectTemp cannot be used instead | ||
</IfModule> | ||
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
function getLastActivity(repository) { | ||
const dates = Object.keys(repository.activity); | ||
if (dates.length == 0) { | ||
return '0000-00-00'; | ||
} | ||
const lastDate = dates[dates.length - 1]; | ||
return `${lastDate.substring(0, 4)}-${lastDate.substring(4, 6)}-${lastDate.substring(6, 8)}`; | ||
} | ||
|
||
/** | ||
* Load /api/repositories to #repositories tables. | ||
*/ | ||
function loadRepositories() { | ||
fetch('/api/repositories').then(function (response) { | ||
if (response.status != 200) { | ||
throw new Error('fail to fetch repositories'); | ||
} | ||
return response.json(); | ||
}).then(function (items) { | ||
let dataSet = Object.keys(items).map(function (name) { | ||
const item = items[name]; | ||
const sizeMo = (item.size / (1024 * 1024)).toFixed(1); | ||
return [ | ||
`<a href="https://${name}">${name}</a>`, | ||
`<span class="${item.readme ? "text-success" : "text-danger"}">${item.readme ? "FOUND" : "MISSING"}</span>`, | ||
`<span class="${item.license ? "text-success" : "text-danger"}">${item.license ? item.license : "MISSING"}</span>`, | ||
getLastActivity(item), | ||
sizeMo, | ||
]; | ||
}); | ||
$('#repositories').DataTable({ | ||
data: dataSet, | ||
columns: [ | ||
{ title: "Name"}, | ||
{ title: "README" }, | ||
{ title: "LICENSE" }, | ||
{ title: "Last Activity" }, | ||
{ title: "Size (Mo)" }, | ||
], | ||
"paging": false, | ||
"info": false | ||
}); | ||
}).catch(function (error) { | ||
$('#repositories').DataTable({ | ||
data: [[ | ||
`<span class="text-danger">fail to load repositories (run 'bin/console git:stats')</span>`, | ||
]], | ||
columns: [ | ||
{ title: "Error" }, | ||
], | ||
"paging": false, | ||
"info": false | ||
}); | ||
}); | ||
} |
Oops, something went wrong.