Showing 553 changed files with 96,050 additions and 3,632 deletions.
12 changes: 12 additions & 0 deletions .dev/.eslintrc.js
@@ -0,0 +1,12 @@
module.exports = {
"extends": "airbnb-base",
"env": {
"browser": true,
},
"rules": {
"no-param-reassign": 0, // manipulate DOM style properties
"no-restricted-globals": 0, // currently Shaarli uses alert/confirm, could be be improved later
"no-alert": 0, // currently Shaarli uses alert/confirm, could be be improved later
"no-cond-assign": [2, "except-parens"], // assignment in while loops is readable and avoid assignment duplication
}
};
15 changes: 15 additions & 0 deletions .dev/.stylelintrc.js
@@ -0,0 +1,15 @@
module.exports = {
extends: 'stylelint-config-standard',
plugins: [
"stylelint-scss"
],
rules: {
"indentation": [2],
"number-leading-zero": null,
// Replace CSS @ with SASS ones
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true,
// not compatible with SASS apparently
"no-descending-specificity": null
},
}
13 changes: 13 additions & 0 deletions .docker/.htaccess
@@ -0,0 +1,13 @@
<IfModule version_module>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
<IfVersion < 2.4>
Allow from none
Deny from all
</IfVersion>
</IfModule>

<IfModule !version_module>
Require all denied
</IfModule>
60 changes: 60 additions & 0 deletions .docker/nginx.conf
@@ -0,0 +1,60 @@
user nginx nginx;
daemon off;
worker_processes 4;
pid /var/run/nginx.pid;

events {
worker_connections 768;
}

http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 20;

client_max_body_size 10m;

index index.html index.php;

server {
listen 80;
listen [::]:80;
root /var/www/shaarli;

access_log /var/log/nginx/shaarli.access.log;
error_log /var/log/nginx/shaarli.error.log;

location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|oet|woff2?)$ {
# cache static assets
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

location = /favicon.ico {
# serve the Shaarli favicon from its custom location
alias /var/www/shaarli/images/favicon.ico;
}

location /doc/html/ {
default_type "text/html";
try_files $uri $uri/ $uri.html =404;
}

location / {
# Slim - rewrite URLs & do NOT serve static files through this location
try_files _ /index.php$is_args$args;
}

location ~ index\.php$ {
# Slim - split URL path into (script_filename, path_info)
try_files $uri =404;
fastcgi_split_path_info ^(index.php)(/.+)$;

# filter and proxy PHP requests to PHP-FPM
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
}
}
16 changes: 16 additions & 0 deletions .docker/php-fpm.conf
@@ -0,0 +1,16 @@
[global]
daemonize = no

[www]
user = nginx
group = nginx
listen.owner = nginx
listen.group = nginx
catch_workers_output = yes
listen = /var/run/php-fpm.sock
pm = dynamic
pm.max_children = 20
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 2048
2 changes: 2 additions & 0 deletions .docker/services.d/.s6-svscan/finish
@@ -0,0 +1,2 @@
#!/bin/sh
/bin/true
2 changes: 2 additions & 0 deletions .docker/services.d/nginx/run
@@ -0,0 +1,2 @@
#!/bin/execlineb -P
nginx
2 changes: 2 additions & 0 deletions .docker/services.d/php-fpm/run
@@ -0,0 +1,2 @@
#!/bin/execlineb -P
php-fpm82 -F
64 changes: 64 additions & 0 deletions .dockerignore
@@ -0,0 +1,64 @@
# Docker-ignore
.dev
.git
.github
.gitattributes
.gitignore
tests

# Docker related resources are not needed inside the container
.dockerignore
Dockerfile
Dockerfile.armhf

# Docker Compose resources
docker-compose.yml

# Shaarli runtime resources
cache/*
data/*
pagecache/*
tmp/*

# Shaarli's docs are created during the build
doc/html/

# Eclipse project files
.settings
.buildpath
.project

# Raintpl generated pages
*.rtpl.php

# 3rd-party dependencies
vendor/

# Release archives
*.tar.gz
*.zip
inc/languages/*/LC_MESSAGES/shaarli.mo

# Development and test resources
coverage
doxygen
sandbox
phpmd.html

# User plugin configuration
plugins/*/config.php

# 3rd party themes
tpl/*
!tpl/default
!tpl/vintage

# Front end
node_modules
tpl/default/js
tpl/default/css
tpl/default/fonts
tpl/default/img
tpl/vintage/js
tpl/vintage/css
tpl/vintage/img
23 changes: 23 additions & 0 deletions .editorconfig
@@ -0,0 +1,23 @@
# EditorConfig: http://EditorConfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[*.{htaccess,html,scss,js,json,xml,yml}]
indent_size = 2

[*.php]
max_line_length = 120

[Dockerfile]
max_line_length = 80

[Makefile]
indent_style = tab
47 changes: 47 additions & 0 deletions .gitattributes
@@ -0,0 +1,47 @@
# Set default behavior
* text=auto eol=lf

# Ensure sources are processed
*.conf text
*.css text
*.html text diff=html
*.js text
*.md text
*.php text diff=php
Dockerfile text

# Do not alter images nor minified scripts nor fonts
*.ico binary
*.jpg binary
*.png binary
*.svg binary
*.otf binary
*.eot binary
*.woff binary
*.woff2 binary
*.ttf binary
*.min.css binary
*.min.js binary
*.mo binary

# Exclude from Git archives
.editorconfig export-ignore
.dev export-ignore
.gitattributes export-ignore
.github export-ignore
.gitignore export-ignore
.travis.yml export-ignore
doc/**/*.json export-ignore
doc/**/*.md export-ignore
.docker/ export-ignore
.dockerignore export-ignore
docker-compose.* export-ignore
Dockerfile* export-ignore
Doxyfile export-ignore
Makefile export-ignore
node_modules/ export-ignore
doc/conf.py export-ignore
doc/requirements.txt export-ignore
doc/html/.doctrees/ export-ignore
phpunit.xml export-ignore
tests/ export-ignore
22 changes: 22 additions & 0 deletions .github/mailmap
@@ -0,0 +1,22 @@
ArthurHoaro <arthur@hoa.ro> <arthur.hoareau@wizacha.com>
ArthurHoaro <arthur@hoa.ro> Arthur
Florian Eula <eula.florian@gmail.com> feula
Florian Eula <eula.florian@gmail.com> <mr.pikzen@gmail.com>
Immánuel Fodor <immanuelfactor+github@gmail.com>
Immánuel Fodor <immanuelfactor+github@gmail.com> Immánuel! <21174107+immanuelfodor@users.noreply.github.com>
kalvn <kalvnthereal@gmail.com> <kalvn@users.noreply.github.com>
kalvn <kalvnthereal@gmail.com> <kalvn@pm.me>
Neros <contact@neros.fr> <NerosTie@users.noreply.github.com>
Nicolas Danelon <hi@nicolasmd.com.ar> nicolasm
Nicolas Danelon <hi@nicolasmd.com.ar> <nda@3818.com.ar>
Nicolas Danelon <hi@nicolasmd.com.ar> <nicolasdanelon@gmail.com>
Nicolas Danelon <hi@nicolasmd.com.ar> <nicolasdanelon@users.noreply.github.com>
Sébastien Sauvage <sebsauvage@sebsauvage.net>
Sébastien NOBILI <code@pipoprods.org> <s-code-github@pipoprods.org>
Timo Van Neerden <fire@lehollandaisvolant.net>
Timo Van Neerden <fire@lehollandaisvolant.net> lehollandaisvolant <levoltigeurhollandais@gmail.com>
VirtualTam <virtualtam@flibidi.net> <tamisier.aurelien@gmail.com>
VirtualTam <virtualtam@flibidi.net> <virtualtam+github@flibidi.net>
VirtualTam <virtualtam@flibidi.net> <virtualtam@flibidi.org>
Willi Eggeling <thewilli@gmail.com> <mail@wje-online.de>
Willi Eggeling <thewilli@gmail.com> <thewilli@users.noreply.github.com>
106 changes: 106 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,106 @@
name: Shaarli CI
on: [push, pull_request]
jobs:
php:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0', '8.1', '8.2']
name: PHP ${{ matrix.php-versions }}
steps:
- name: Set locales
run: |
sudo locale-gen de_DE.utf8 && \
sudo locale-gen en_US.utf8 && \
sudo locale-gen fr_FR.utf8 && \
sudo dpkg-reconfigure --frontend=noninteractive locales
- name: Install Gettext
run: sudo apt-get install gettext

- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: gd, xml, curl, mbstring, intl, gettext
tools: composer:v2

- name: Check PHP version
run: php -v

- name: Setup Composer from PHP version + update
run: composer config --unset platform && composer config platform.php ${{ matrix.php-versions }}

- name: Update dependencies for PHP 8.x
if: ${{ matrix.php-versions == '8.0' || matrix.php-versions == '8.1' }}
run: |
composer update && \
composer remove --dev phpunit/phpunit && \
composer require --dev phpunit/php-text-template ^2.0 && \
composer require --dev phpunit/phpunit ^9.0
- name: Update dependencies for PHP 7.x
if: ${{ matrix.php-versions != '8.0' && matrix.php-versions != '8.1' }}
run: composer update

- name: Clean up
run: make clean

- name: Check permissions
run: make check_permissions

- name: Run PHPCS
run: make code_sniffer

- name: Run tests
run: make all_tests

node:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '14.x'

- name: Yarn install
run: yarnpkg install

- name: Verify successful frontend builds
run: yarnpkg run build

- name: JS static analysis
run: make eslint

- name: Linter for SASS syntax
run: make sasslint

python:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Build documentation
run: make htmldoc

trivy-repo:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Run trivy scanner on repository (non-blocking)
run: make test_trivy_repo TRIVY_EXIT_CODE=0