From f4fa3585f9aa0c15baf2f20bd6bc1ddd186f7094 Mon Sep 17 00:00:00 2001 From: Administrator Date: Sat, 7 Oct 2023 13:46:29 +0000 Subject: [PATCH] first commit --- build.py | 26 ++++++++++++++++++++++++++ src/src.csv | 2 ++ template/template.html | 25 +++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 build.py create mode 100644 src/src.csv create mode 100644 template/template.html diff --git a/build.py b/build.py new file mode 100644 index 0000000..8fff7db --- /dev/null +++ b/build.py @@ -0,0 +1,26 @@ +import csv +import logging + +def wrap_url(u): + if u.startswith("http"): + return u + return f'http://{u}' + + +if __name__ == '__main__': + subst = '' + with open('src/src.csv') as file: + logging.info('reading csv') + reader = csv.DictReader(file) + for row in reader: + subst += f'{row['service']}' + f'{row["url"]}' + f'{row["ip"]}' + f'{row["comment"]}' + + logging.info('write file') + with open('template/template.html') as inf: + with open('public/index.html', 'w') as outf: + outf.write(inf.read().replace('',subst)) + + logging.info('done') diff --git a/src/src.csv b/src/src.csv new file mode 100644 index 0000000..f699646 --- /dev/null +++ b/src/src.csv @@ -0,0 +1,2 @@ +service,url,ip,comment +Resilio Sync,,10.80.15.3:8080, \ No newline at end of file diff --git a/template/template.html b/template/template.html new file mode 100644 index 0000000..f165716 --- /dev/null +++ b/template/template.html @@ -0,0 +1,25 @@ + + + + + + + Service List + + +

Service List

+ + + + + + + + + + + + +
ServiceURLIPComment
+ + \ No newline at end of file