1
0
forked from ti-nuage/site

Nouvelle chaîne de traitement de statistiques.

Ceci marque le début du support des fichiers propriétés pour la
fourniture de statistiques à https://stats.chatons.org.

Les fichiers sont traitées au moment de la génération du site pour
compléter les informations pouvant être obtenues automatiquement.
This commit is contained in:
David Soulayrol
2023-02-19 14:52:24 +01:00
parent d0f95cdecf
commit b438d9113f
6 changed files with 260 additions and 1 deletions

View File

@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="300mm"
height="300mm"
viewBox="0 0 300 300"
version="1.1"
id="SVGRoot"
sodipodi:docname="ti-nuage-square.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<defs
id="defs644" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="568.33327"
inkscape:cy="560"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1096"
inkscape:window-x="0"
inkscape:window-y="-16"
inkscape:window-maximized="0" />
<metadata
id="metadata647">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<path
d="m 15.183249,155.10712 v 25.20168 c 0,1.00263 0.300894,1.80546 0.902785,2.40726 0.601789,0.60219 1.780403,0.90279 3.53574,0.90279 h 3.535759 v 5.0403 c -1.655021,0.15072 -3.084377,0.22569 -4.288036,0.22569 -3.009148,0 -5.391379,-0.57724 -7.146715,-1.73036 -1.705195,-1.20368 -2.557776,-3.30995 -2.557776,-6.31909 V 155.10704 H 2.7705559 v -5.26592 H 9.165006 v -10.9833 h 6.018274 v 10.9833 h 7.974253 v 5.26592 z"
fill="#373d3f"
id="path404"
style="stroke-width:2.75187" />
<path
d="m 29.292047,136.60117 h 6.394522 v 7.37215 h -6.394522 z m 0.225696,13.24006 h 6.018337 v 38.81802 h -6.018337 z"
fill="#373d3f"
id="path406"
style="stroke-width:2.75187" />
<path
d="m 24.060226,202.27229 c 4.363285,0 7.723364,1.17861 10.080613,3.53584 2.407338,2.30689 3.610999,5.61714 3.610999,9.93012 v 26.25476 H 31.73351 v -25.65296 c 0,-3.00916 -0.777456,-5.19081 -2.331933,-6.54478 -1.55483,-1.40421 -3.736462,-2.10648 -6.54499,-2.10648 -1.253833,0 -2.532709,0.25065 -3.836684,0.75198 -1.253803,0.45139 -2.382233,1.17862 -3.38526,2.18167 -1.003049,1.00262 -1.830577,2.28193 -2.482568,3.83673 -0.652024,1.5545 -0.977985,3.41031 -0.977985,5.5667 v 21.96682 H 6.155784 v -38.81783 h 5.717392 v 5.7926 c 1.303975,-1.95597 2.984072,-3.5609 5.040323,-4.81461 2.056251,-1.25402 4.438482,-1.88086 7.146705,-1.88086 z"
fill="#373d3f"
id="path408"
style="stroke-width:2.75187" />
<path
d="m 76.908989,203.17518 v 38.81783 h -5.717554 v -5.7924 c -1.303832,1.95576 -2.983846,3.5606 -5.040323,4.8146 -2.056186,1.25382 -4.438485,1.88067 -7.146597,1.88067 -4.363363,0 -7.748435,-1.15364 -10.155763,-3.46053 -2.35725,-2.35723 -3.535875,-5.69245 -3.535875,-10.00543 v -26.25474 h 6.018325 v 25.65285 c 0,3.00914 0.77746,5.21588 2.332212,6.62019 1.554533,1.35418 3.736219,2.03117 6.544768,2.03117 1.253744,0 2.507509,-0.22571 3.761524,-0.67711 1.303843,-0.5013 2.457422,-1.254 3.460486,-2.25706 1.003043,-1.00263 1.830538,-2.28182 2.482444,-3.83662 0.651927,-1.55462 0.977989,-3.41041 0.977989,-5.5668 v -21.96672 z"
fill="#373d3f"
id="path410"
style="stroke-width:2.75187" />
<path
d="m 119.86756,237.10318 v 4.88983 c -0.95292,0.15089 -2.05646,0.22568 -3.31022,0.22568 -2.15663,0 -3.76124,-0.45139 -4.81465,-1.35386 -1.00306,-0.95272 -1.57986,-2.35723 -1.73012,-4.21282 -2.70838,4.16249 -6.92121,6.24399 -12.638497,6.24399 -4.262914,0 -7.623213,-0.97769 -10.080624,-2.93405 -2.407343,-1.95576 -3.61101,-4.7643 -3.61101,-8.42567 0,-1.50447 0.250659,-2.93373 0.752384,-4.28802 0.501413,-1.35418 1.303833,-2.55755 2.407323,-3.61095 1.153589,-1.05317 2.63299,-1.93068 4.438495,-2.63304 1.855593,-0.70205 4.112392,-1.20357 6.770422,-1.50437 l 5.567027,-0.60221 c 1.95602,-0.25065 3.46046,-0.75197 4.51361,-1.50468 1.05342,-0.80293 1.57984,-2.08128 1.57984,-3.83664 0,-2.05621 -0.62685,-3.58575 -1.88062,-4.5888 -1.25376,-1.00262 -3.53587,-1.50468 -6.84582,-1.50468 -3.310227,0 -5.717277,0.55228 -7.221993,1.65498 -1.504456,1.10351 -2.357266,3.10961 -2.557858,6.01829 h -6.018062 c 0.09982,-1.90564 0.451282,-3.636 1.053142,-5.19082 0.601786,-1.5545 1.504434,-2.90866 2.708101,-4.06232 1.253754,-1.15324 2.858636,-2.03117 4.814677,-2.63295 1.956016,-0.65214 4.363366,-0.97769 7.221993,-0.97769 2.70811,0 4.99025,0.27564 6.84582,0.82792 1.85559,0.55124 3.36031,1.3291 4.51361,2.33216 1.15357,1.00263 1.98109,2.20672 2.48274,3.61103 0.50141,1.35418 0.75208,2.85866 0.75208,4.51362 v 21.66593 c 0,1.25382 0.70225,1.88067 2.10654,1.88067 z m -22.192707,0.6771 c 1.45465,0 2.883967,-0.22571 4.288247,-0.6771 1.45437,-0.45139 2.75819,-1.12828 3.91178,-2.03116 1.15357,-0.90278 2.08123,-2.05623 2.78351,-3.46044 0.70195,-1.40431 1.05314,-3.05927 1.05314,-4.96521 v -4.58903 c -1.15358,0.90278 -2.85864,1.45466 -5.11544,1.65529 l -5.642147,0.67708 c -3.51085,0.40146 -5.892861,1.20368 -7.146887,2.40736 -1.253755,1.15365 -1.880637,2.68308 -1.880637,4.58903 0,1.90572 0.601807,3.46044 1.805505,4.66412 1.253754,1.15364 3.234829,1.73017 5.942929,1.73017 z"
fill="#373d3f"
id="path412"
style="stroke-width:2.75187" />
<path
d="m 159.64224,203.17518 v 37.31335 c 0,2.50753 -0.37621,4.81472 -1.12855,6.92098 -0.70204,2.10658 -1.80549,3.91204 -3.30994,5.41649 -1.50444,1.50438 -3.38535,2.68309 -5.64215,3.53586 -2.25681,0.85285 -4.91483,1.27877 -7.97436,1.27877 -5.01502,0 -8.92706,-1.15355 -11.73563,-3.46044 -2.80855,-2.25685 -4.41343,-5.26601 -4.81465,-9.02754 h 6.01833 c 0.40127,2.45749 1.47968,4.28803 3.23482,5.49159 1.80549,1.25381 4.23787,1.88099 7.29713,1.88099 3.91206,0 6.89617,-1.00265 8.95237,-3.00914 2.05619,-1.95608 3.08429,-4.96523 3.08429,-9.02756 v -3.76154 c -1.45436,1.95608 -3.2849,3.48581 -5.49161,4.58902 -2.20675,1.05319 -4.71424,1.57987 -7.5228,1.57987 -2.70838,0 -5.19084,-0.47635 -7.44766,-1.42936 -2.20671,-0.95272 -4.11265,-2.3071 -5.71755,-4.06223 -1.55452,-1.75544 -2.7582,-3.88707 -3.61099,-6.3946 -0.85256,-2.50773 -1.27881,-5.31635 -1.27881,-8.42565 0,-3.10931 0.42623,-5.91782 1.27881,-8.42566 0.85275,-2.50752 2.05647,-4.63905 3.61099,-6.39429 1.6049,-1.75533 3.51084,-3.10951 5.71755,-4.06252 2.25682,-0.95271 4.73928,-1.42928 7.44766,-1.42928 2.90873,0 5.49163,0.57724 7.74844,1.73037 2.25681,1.10322 4.11238,2.70805 5.56702,4.81463 v -5.64211 z m -18.28065,34.30421 c 3.76152,0 6.7707,-1.30417 9.0275,-3.91184 2.30715,-2.60789 3.46046,-6.26927 3.46046,-10.98351 0,-4.71425 -1.15331,-8.37532 -3.46046,-10.98321 -2.2568,-2.60798 -5.26598,-3.91204 -9.0275,-3.91204 -3.76126,0 -6.79547,1.35419 -9.10264,4.06223 -2.25679,2.65833 -3.38535,6.26905 -3.38535,10.83302 0,4.56396 1.12856,8.20006 3.38535,10.9081 2.30717,2.65803 5.34138,3.98725 9.10264,3.98725 z"
fill="#373d3f"
id="path414"
style="stroke-width:2.75187" />
<path
d="m 202.51441,224.6906 h -29.48957 c 0.30078,4.41316 1.50445,7.64799 3.61072,9.70443 2.15665,2.0061 4.94017,3.00926 8.35056,3.00926 2.7582,0 4.99023,-0.65214 6.69529,-1.95607 1.70506,-1.30415 2.90871,-3.05927 3.611,-5.266 h 6.24399 c -0.4513,1.80557 -1.15359,3.48549 -2.10656,5.04031 -0.90258,1.55459 -2.05619,2.90877 -3.46048,4.06232 -1.40427,1.10321 -3.0342,1.98103 -4.88979,2.63295 -1.85558,0.65214 -3.93709,0.97769 -6.24399,0.97769 -2.65803,0 -5.09041,-0.4514 -7.29712,-1.35418 -2.20672,-0.95272 -4.11267,-2.3069 -5.71728,-4.06235 -1.60489,-1.75544 -2.85892,-3.88676 -3.76152,-6.39449 -0.85257,-2.50751 -1.2788,-5.34109 -1.2788,-8.50085 0,-3.05927 0.42622,-5.81767 1.2788,-8.27515 0.85254,-2.50751 2.05619,-4.63906 3.611,-6.3945 1.60488,-1.80546 3.4855,-3.18438 5.64215,-4.13741 2.20671,-1.00265 4.66412,-1.50469 7.37225,-1.50469 2.90901,0 5.46659,0.55125 7.6733,1.65518 2.20673,1.05318 4.06257,2.50751 5.56704,4.36312 1.50444,1.80547 2.63297,3.9371 3.38533,6.3945 0.80243,2.45738 1.20368,5.09044 1.20368,7.89895 z m -17.82935,-16.92651 c -3.05925,0 -5.61711,0.95272 -7.67331,2.85866 -2.0562,1.90572 -3.33499,4.78933 -3.83664,8.65135 h 22.86966 c -0.15052,-1.60484 -0.50164,-3.10962 -1.05342,-4.51394 -0.55145,-1.40419 -1.30383,-2.60787 -2.2568,-3.61092 -0.95271,-1.05318 -2.10628,-1.88067 -3.46048,-2.48246 -1.30384,-0.6022 -2.83361,-0.90278 -4.58901,-0.90278 z"
fill="#373d3f"
id="path416"
style="stroke-width:2.75187" />
<path
d="m 65.948861,144.41671 c 1.927951,-7.5214 5.646,-14.46497 10.836848,-20.23915 5.190848,-5.7743 11.700935,-10.20783 18.975234,-12.92283 7.274557,-2.71492 15.097287,-3.63102 22.802237,-2.66978 7.70468,0.96103 15.0629,3.77078 21.44723,8.18976 2.60245,-13.84954 9.09493,-26.671909 18.71793,-36.966592 9.62274,-10.294872 21.97834,-17.636459 35.62126,-21.166058 13.64268,-3.529609 28.00854,-3.101305 41.41672,1.234886 13.40849,4.336285 25.30453,12.40103 34.29708,23.251 8.99147,10.849761 14.70983,24.035954 16.48205,38.015934 1.77218,13.98027 -0.47335,28.17606 -6.4724,40.92655 -6.00073,12.75083 -15.50788,23.52933 -27.40971,31.07467 -11.90182,7.54512 -25.7063,11.54526 -39.79834,11.53206"
stroke="#373d3f"
stroke-width="10.4008"
stroke-linecap="round"
stroke-linejoin="round"
id="path418"
style="opacity:1;stroke-width:10.401;stroke-miterlimit:4;stroke-dasharray:none;stroke-linecap:round;stroke:#373d3f;stroke-opacity:0.80000001;fill:none" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@@ -0,0 +1,45 @@
# [File]
file.class = organization
file.protocol = ChatonsInfos-0.5
file.datetime =
file.generator =
# [Organisation]
organization.name = Ti Nuage
organization.country.code = FR
organization.country.name = France
organization.description = Hébergeur associatif, transparent, éthique, militant et solidaire dans le Trégor.
organization.type = ASSOCIATION
organization.website = https://www.ti-nuage.fr
organization.chatrooms.xmpp = ti-nuage@muc.ti-nuage.fr
organization.contact.url = https://www.ti-nuage.fr/mentions_legales.html
organization.contact.email = contact@ti-nuage.fr
organization.funding.helloasso = https://www.helloasso.com/associations/ti-nuage/adhesions/adhesion-1
organization.geolocation.address = Mairie, 11 places aux Chevaux, 22420 Le Vieux Marché
organization.geolocation.latitude = 48.60736
organization.geolocation.longitude = -3.45054
organization.guide.technical = https://wiki.ti-nuage.fr/fr/Administration/Infrastructure
organization.guide.user = https://wiki.ti-nuage.fr/
organization.legal.url = https://www.ti-nuage.fr/mentions_legales.html
organization.logo = https://www.ti-nuage.fr/images/logo-tinuage-square.svg
organization.memberof.chatons.startdate = 21/12/2022
organization.memberof.chatons.status.level = ACTIVE
organization.memberof.chatons.status.description =
organization.socialnetworks.mastodon = https://hostux.social/@tinuage
organization.socialnetworks.peertube = https://video.tedomum.net/a/tinunu/video-channels
organization.startdate = 15/10/2021
organization.status.description =
organization.status.level = ACTIVE
# [Subs]
subs.foo1 =
# [Metrics]

View File

@@ -0,0 +1,3 @@
Contact: mailto:contact@ti-nuage.fr
Expires: Sun, 31 Dec 2023 23:59 +0200
Preferred-Languages: fr, en

View File

@@ -11,7 +11,7 @@
"clean": "rimraf dist",
"dev": "npm run build && nodemon scripts/run.js serve",
"server": "npm run build && http-server dist",
"deploy": "npm run build:prod && cd dist && rsync -v -rlptz --relative -e \"ssh -p $SERVER_PORT\" * $SERVER_PATH",
"deploy": "npm run build:prod && cd dist && rsync -v -rlptz --relative -e \"ssh -p $SERVER_PORT\" ./ $SERVER_PATH",
"lint": "npm run lint:js && npm run lint:css",
"lint:js": "eslint scripts",
"lint:css": "stylelint assets/**/*.css",

View File

@@ -0,0 +1,111 @@
// const { Buffer } = require('node:buffer')
const debug = require('debug')('metalsmith-tinuage-chatons')
const config = require('./config.js')
const fs = require('node:fs')
const path = require('path')
module.exports = plugin
/**
* Un plugin pour Metalsmith qui traite des fichiers de propriétés
* pour StatoolInfos.
*
* @return {Function}
*/
function plugin () {
const Filler = {
init: function (properties) {
this.handlers = {
'file.datetime': this.datetime,
'file.generator': this.generator
}
this.properties = properties
},
complete: function () {
Object.entries(this.properties).forEach(([key, value]) => {
if (value.length === 0) {
if (Object.keys(this.handlers).includes(key)) {
this.properties[key] = this.handlers[key]()
}
}
})
},
export: function () {
return Object
.entries(this.properties)
.filter(([key, value]) => !key.startsWith('meta'))
.map(([key, value]) => key + ' = ' + value)
.reduce((acc, value) => acc + value + '\n', '')
},
datetime: function () {
/* Statools n'attend pas de l'ISO8-601,
* mais le strict format YYYY-MM-DDThh:mm:ss
*/
const d = new Date()
const pad = function (value) { return value.toString().padStart(2, '0') }
const date = [d.getFullYear(), pad(d.getMonth() + 1), pad(d.getDate())]
const time = [d.getHours(), d.getMinutes(), d.getSeconds()]
return date.join('-') + 'T' + time.join(':')
},
generator: function () {
return 'Metalsmith'
}
}
function loadProperties (root, filenames) {
const promises = filenames
.filter(f => { return f.indexOf('.properties') !== -1 })
.map(function (f) {
debug('Loading ' + f)
return fs.promises
.readFile(path.join(root, f), 'utf8')
.then(data => {
const properties = Object.fromEntries(data
.toString()
.split(/(?:\r\n|\r|\n)/g)
.filter(line => line.length > 1 && line[0] !== '#')
.map(line => line.split(/\s*=\s*/, 2)))
properties['meta.filename'] = f
return properties
})
})
return Promise.all(promises)
}
return function (files, metalsmith, done) {
const directory = path.join('.well-known', 'chatonsinfos')
const root = path.join(config.paths.projectRoot, config.paths.metalsmithSource, directory)
debug('Looking for properties files in ' + root)
fs.readdir(root, (err, filenames) => {
if (err) {
console.error('%s: %s', root, err)
} else {
loadProperties(root, filenames)
.then(function (sets) {
sets.forEach(properties => {
const data = files[path.join(directory, properties['meta.filename'])]
const filler = Object.create(Filler)
filler.init(properties)
filler.complete()
data.contents = Buffer.from(filler.export())
})
done()
})
.catch(function (err) {
console.log(err)
})
}
})
}
}

View File

@@ -2,6 +2,7 @@
const assets = require('metalsmith-assets')
const browserify = require('metalsmith-browserify')
const cleanCSS = require('metalsmith-clean-css')
const chatons = require('./metalsmith-tinuage-chatons')
const config = require('./config.js')
const collections = require('@metalsmith/collections')
const excerpts = require('@metalsmith/excerpts')
@@ -83,6 +84,7 @@ module.exports = new Metalsmith(config.paths.projectRoot)
smartypants: true,
xhtml: true
}))
.use(chatons())
.use(services())
.use(excerpts())
.use(permalinks({