create build process with signature cleaning and adapt signature db paths accordingly

lektura
max.mehl 2017-03-24 01:20:54 +01:00
parent 4eb8b00d13
commit 5bcb0bd4c3
7 changed files with 38 additions and 46 deletions

1
.gitignore vendored 100644
View File

@ -0,0 +1 @@
signatures.json

11
build/build.sh 100755
View File

@ -0,0 +1,11 @@
#!/bin/bash
basedir="${0%/*}/.."
sigdb="$1"
# Clean signatures database
"$basedir/build/clean_database.py" "$sigdb" "$basedir/data/signatures/signatures_clean.json"
# Execute hugo buildrun
cd "$basedir"
hugo

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
import json
import sys
injson = str(sys.argv[1])
outjson = str(sys.argv[2])
def remove_error_info(d):
if not isinstance(d, (dict, list)):
return d
if isinstance(d, list):
return [remove_error_info(v) for v in d]
return {k: remove_error_info(v) for k, v in d.items()
if k not in {'email', 'code', 'permPriv', 'permNews' }}
with open(injson) as json_data:
sigs_full = json.load(json_data)
sigs_clean = remove_error_info(sigs_full)
with open(outjson, 'w') as outfile:
json.dump(sigs_clean, outfile, indent=2)

View File

@ -1,42 +0,0 @@
[
{
"id": 0,
"name": "Max",
"email": "mail@example.com",
"country": "Deutschland",
"zip": "86367",
"perm": "yes",
"code": "630691407558d1cc36a6abb",
"confirmed": "yes"
},
{
"id": 1,
"name": "Cooler Name",
"email": "tech@web.de",
"country": "Schweiz",
"zip": "4404",
"perm": "yes",
"code": "759321396558d1cc8bb57fe",
"confirmed": "yes"
},
{
"id": 2,
"name": "Hengst",
"email": "test@test.com",
"country": "",
"zip": "",
"perm": "yes",
"code": "691034870458d1cd0fdfb2f",
"confirmed": "yes"
},
{
"id": 3,
"name": "Richard Bruce Kopp",
"email": "kopp@test.de",
"country": "Germany ",
"zip": "71522",
"perm": "yes",
"code": "557271457758d1ff356910f",
"confirmed": "no"
}
]

View File

@ -13,9 +13,9 @@
<th>{{ .Site.Params.Subpage.Signatures.country }}</th>
<th>{{ .Site.Params.Subpage.Signatures.zip }}</th>
</tr>
{{ range $.Site.Data.signatures }}
{{ range . }}
{{ if eq .confirmed "yes" }}
{{ range .Site.Data.signatures }}
{{ range sort . "id" "desc" }}
{{ if (eq .confirmed "yes") | and (eq .permPub "yes") }}
<tr>
<td>{{ .id }}</td>
<td>{{ .name }}</td>

View File

@ -3,7 +3,7 @@
$codemod = 2138367; // modificator with which the confirmation ID will be obfuscated
$output = "";
$selfurl = "http://pmpc-test.mehl.mx/cgi/sign.php"; // absolute URL of this PHP script
$db = "../userdata/signatures.json"; // Signature database path
$db = "../../signatures.json"; // Signature database path
// Get info from form
$action = isset($_GET['action']) ? $_GET['action'] : false;