From fd4a47e9ed748e19673529337f98721baf4e22d5 Mon Sep 17 00:00:00 2001 From: coulisse Date: Thu, 18 Nov 2021 16:41:49 +0000 Subject: [PATCH] templates and build --- SECURITY.md | 2 +- docs/CHANGELOG.md | 3 +- scripts/build.sh | 30 +++++ static/html/offline.html | 177 ++++++++++--------------- static/html/replace_version.sh | 1 - static/html/templates/_base.html | 1 + static/html/templates/offline.html | 1 + templates/_base.html | 188 +++++++++++++++++++++++++++ templates/callsign.html | 137 ++++--------------- templates/cookies.html | 101 +++------------ templates/index.html | 202 ++++------------------------- templates/offline.html | 35 +++++ templates/plots.html | 111 ++++------------ templates/privacy.html | 102 +++------------ templates/replace_version.sh | 30 ----- test.sh | 1 + webapp.py | 9 +- 17 files changed, 430 insertions(+), 701 deletions(-) create mode 100755 scripts/build.sh delete mode 120000 static/html/replace_version.sh create mode 120000 static/html/templates/_base.html create mode 120000 static/html/templates/offline.html create mode 100644 templates/_base.html create mode 100644 templates/offline.html delete mode 100755 templates/replace_version.sh create mode 100755 test.sh diff --git a/SECURITY.md b/SECURITY.md index 0d58383..e4730c3 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -3,4 +3,4 @@ ## Reporting a Vulnerability Reporting a Vulnerability Please report (suspected) security vulnerabilities to . -You will receive a response as soon as possible. If the issue is confirmed, we will release a patch. +You will receive a response as soon as possible. If the issue is confirmed, we will try to release a patch. diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d66bed8..b94b70f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,8 +1,9 @@ ### Change log -13/11/2021: 2.0.3 +xx/xx/2021: 2.1 - jquery upgraded to 3.6 - bootstrap upgraded to 5.0.2 - managed connection error to telnet host +- used a base template in order to put all csv/scripts on a page ___ 16/05/2021: 2.0.2 - Fixed frequency mode on 40 meters diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..10b8bc8 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,30 @@ +path_templates='../templates' +base_template='_base.html' +path_static_html='../static/html' + +echo '*** SPIDERWEB building process ***' +echo 'get version from git' +ver=`git tag|tail -1` +if [ "$?" != "0" ]; then + echo 'ERROR on get version from git' + exit 1 +fi +if [ ${ver} == "" ]; then + echo 'ERROR git version is empty' + exit 1 +fi +echo 'version: '${ver} + +echo 'writing version in '${base_template} '...' +sed -i 's/v.*<\/span>/'$ver'<\/span>/g' ${path_templates}/${base_template} +if [ "$?" != "0" ]; then + echo 'ERROR writing version in '${base_template} + exit 1 +fi + +echo 'generating static pages...' +staticjinja build --srcpath=${path_static_html}/templates/ --outpath=${path_static_html}/ +if [ "$?" != "0" ]; then + echo 'ERROR generating static pages' + exit 1 +fi diff --git a/static/html/offline.html b/static/html/offline.html index 920e255..1a7c30c 100644 --- a/static/html/offline.html +++ b/static/html/offline.html @@ -1,44 +1,53 @@ - - DX Cluster from IU1BOW + + DX Cluster from IU1BOW: OFFLINE + + + + - - + + + + + + + + + +
- + +
- +
-

WEB DX Cluster

-

Spots list

-

 

-

 

+ +

WEB DX Cluster

+

Spots list

+ +

Telnet access:

+

For connect your cluster, write to

-
-
- -
-
-
- -
- - -

-
- Mode -
- -

-
DE
DX
-
-
- -
-
- -
-
-

- - -
+ + -
- - - - - - - - - - - - - - -
DX DeFreqDXCountryCommentsUTC
-
-
+ + + +
-
-

Sorry, but you are off-line: check your connectivity.

-
- +
+ +
+ + + + + + + diff --git a/static/html/replace_version.sh b/static/html/replace_version.sh deleted file mode 120000 index e4eb095..0000000 --- a/static/html/replace_version.sh +++ /dev/null @@ -1 +0,0 @@ -../../templates/replace_version.sh \ No newline at end of file diff --git a/static/html/templates/_base.html b/static/html/templates/_base.html new file mode 120000 index 0000000..c83d2f5 --- /dev/null +++ b/static/html/templates/_base.html @@ -0,0 +1 @@ +../../../templates/_base.html \ No newline at end of file diff --git a/static/html/templates/offline.html b/static/html/templates/offline.html new file mode 120000 index 0000000..efae0ad --- /dev/null +++ b/static/html/templates/offline.html @@ -0,0 +1 @@ +../../../templates/offline.html \ No newline at end of file diff --git a/templates/_base.html b/templates/_base.html new file mode 100644 index 0000000..9431d7c --- /dev/null +++ b/templates/_base.html @@ -0,0 +1,188 @@ + + + + {% block title %} + {% endblock title %} + {% block head %} + + + + + + + + + + + + + + + + + + {% endblock head %} + + +
+ {% block menu %} + + + {% endblock menu %} +
+ +
+
+ {% block titles %} + {% endblock %} +

Telnet access: {{ telnet }}

+

For connect your cluster, write to {{ mail }}

+
+ {% block filters %} +
+
+ +
+
+
+ +
+
+ +

+
+ Mode +
+ +

+
DE
DX
+
+
+ +
+
+ +
+
+

+ +
+
+ {% endblock filters %} + + {% block contents %} +
+ + + + + + + + + + + + + + +
DX DeFreqDXCountryCommentsUTC
+
+
+ {% endblock contents %} +
+
+ +
+ + + + + {% block app_scripts %} + + {% endblock app_scripts %} + + + diff --git a/templates/callsign.html b/templates/callsign.html index b32a313..d751fb3 100644 --- a/templates/callsign.html +++ b/templates/callsign.html @@ -1,117 +1,24 @@ - - - - Spot search for a specific Callsign - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
-
-

{{callsign}}

-

Some statistics about this callsign

-

Telnet access: dxcluster.iu1bow.it 7300

-

For connect your cluster, write to corrado.gerbaldo@gmail.com

-
-
- -
- - - - - - - - - - - - - - -
DX DeFreqDXCountryCommentsUTC
-
-
-
-
- -
- - - - - - - - - - + {% endblock app_data %} + {% block app_scripts %} + {{ super() }} + + {% endblock app_scripts %} diff --git a/templates/cookies.html b/templates/cookies.html index 4214e8d..75a8c3e 100644 --- a/templates/cookies.html +++ b/templates/cookies.html @@ -1,76 +1,19 @@ - - +{% extends "_base.html" %} - - DX Cluster from IU1BOW: Cookies - - - - - - - - - - - - + {% block title %} + DX Cluster from IU1BOW: Cookies + {% endblock %} + {% block head %} + {{ super() }} + {% endblock %} - -
- - - -
-
- -
-
+ {% block titles %}

COOKIES

WEB DX Cluster For HAM Radio

-

Telnet access: dxcluster.iu1bow.it 7300

-

For connect your cluster, write to corrado.gerbaldo@gmail.com

-
-
+ {% endblock %} + {% block filters %} + {% endblock %} + {% block contents %}

Cookies are small text files that can be used by websites to make a user's experience more efficient. This site uses different types of cookies. You can at any time change or withdraw your consent from the Cookies page on my website. Some cookies are placed by third party services that appear on our pages, for example if you view or listen to any embedded audio or video content. I don't control the setting of these cookies, so @@ -83,18 +26,8 @@ valuable for publishers and third party advertisers.

Unclassified cookies are cookies that we are in the process of classifying, together with the providers of individual cookies.

- - - -
-
- -
- - - - + {% endblock %} + {% block app_data %} + {% endblock %} + {% block app_scritps %} + {% endblock %} diff --git a/templates/index.html b/templates/index.html index 066bf7c..32337f0 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,183 +1,27 @@ - - - - DX Cluster / DX Spot for Hamradio - - - - - - - - - - - - - - - - - - - - -
- - -
- -
-
-

WEB DX Cluster

-

Spots list

-

Telnet access: {{ telnet }}

-

For connect your cluster, write to {{ mail }}

-
-
-
- -
-
-
- -
-
- -

-
- Mode -
- -

-
DE
DX
-
-
- -
-
- -
-
-

- -
-
- -
- - - - - - - - - - - - - - -
DX DeFreqDXCountryCommentsUTC
-
-
-
-
- -
- - - - - - - - - + {% endblock app_data %} + {% block app_scripts %} + {{ super() }} + + {% endblock app_scripts %} + + diff --git a/templates/offline.html b/templates/offline.html new file mode 100644 index 0000000..4175618 --- /dev/null +++ b/templates/offline.html @@ -0,0 +1,35 @@ +{% extends "_base.html" %} + + {% block title %} + DX Cluster from IU1BOW: OFFLINE + + {% endblock %} + {% block head %} + {{ super() }} + {% endblock %} + + {% block titles %} +

WEB DX Cluster

+

Spots list

+ {% endblock %} + {% block filters %} + {% endblock %} + {% block contents %} + + + {% endblock %} + {% block app_data %} + {% endblock %} + {% block app_scritps %} + {% endblock %} diff --git a/templates/plots.html b/templates/plots.html index 8915221..d5d1d5b 100644 --- a/templates/plots.html +++ b/templates/plots.html @@ -1,76 +1,20 @@ - - +{% extends "_base.html" %} - Some plots end stats from the dx clustes node - - - - - - - - - - - - - - + {% block title %} + Some plots end stats from the dx clustes node + {% endblock %} + {% block head %} + {{ super() }} + {% endblock %} - -
- - - -
-
- -
-
+ {% block titles %}

PLOTS & STATS

Some statistics about this node

-

Telnet access: dxcluster.iu1bow.it 7300

-

For connect your cluster, write to corrado.gerbaldo@gmail.com

-
-
+ {% endblock %} + {% block filters %} + {% endblock %} + {% block contents %} +
@@ -103,25 +47,14 @@ -
-
- -
- - - - - - - - - + {% endblock app_data %} + + {% block app_scripts %} + {{ super() }} + + {% endblock app_scripts %} diff --git a/templates/privacy.html b/templates/privacy.html index 62cee29..3b7e903 100644 --- a/templates/privacy.html +++ b/templates/privacy.html @@ -1,76 +1,19 @@ - - - +{% extends "_base.html" %} - - DX Cluster from IU1BOW: Cookies - - - - - - - - - - - - + {% block title %} + DX Cluster from IU1BOW: Privacy + {% endblock %} + {% block head %} + {{ super() }} + {% endblock %} - -
- - - -
-
- -
-
+ {% block titles %}

PRIVACY

WEB DX Cluster For HAM Radio

-

Telnet access: dxcluster.iu1bow.it 7300

-

For connect your cluster, write to corrado.gerbaldo@gmail.com

-
-
+ {% endblock %} + {% block filters %} + {% endblock %} + {% block contents %}

Privacy Policy for this web site

At this web site, one of our main priorities is the privacy of our visitors. This Privacy Policy document contains types of information that is collected and recorded by this web site and how we use it.

@@ -125,19 +68,8 @@

this web site does not knowingly collect any Personal Identifiable Information from children under the age of 13. If you think that your child provided this kind of information on our website, we strongly encourage you to contact us immediately and we will do our best efforts to promptly remove such information from our records.

- - - - -
- - - - - + {% endblock %} + {% block app_data %} + {% endblock %} + {% block app_scritps %} + {% endblock %} diff --git a/templates/replace_version.sh b/templates/replace_version.sh deleted file mode 100755 index ae1f474..0000000 --- a/templates/replace_version.sh +++ /dev/null @@ -1,30 +0,0 @@ -make_replace() { - for i in `ls -1 *.html` - do - cp ${i} ${i}.old -#replace css - sed -i 's/5.0.0/5.0.2/g' ${i} - sed -i 's/sha384-wEmeIV1mKuiNpC+IOBjI7aAzPcEZeedi5yW5f2yOq55WWLwNGmvvx4Um1vskeMj0/sha384-EVSTQN3\/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC/g' ${i} - sed -i 's/sha384-p34f1UUtsS3wqzfto5wAAmdvj+osOnFyQFpp4Ua3gs\/ZVWx6oOypYoCJhGGScy+8/sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn\/tWtIaxVXM/g' ${i} - -#replace js - #sed -i 's/sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf/sha384-p34f1UUtsS3wqzfto5wAAmdvj+osOnFyQFpp4Ua3gs\/ZVWx6oOypYoCJhGGScy+8/g' ${i} - echo ${i} - #sed -i 's/"https:\/\/code.jquery.com\/jquery-3.5.1.slim.min.js" integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs="/https:"\/\/cdnjs.cloudflare.com\/ajax\/libs\/jquery\/3.6.0\/jquery.slim.min.js" integrity="sha512-6ORWJX\/LrnSjBzwefdNUyLCMTIsGoNP6NftMy2UAm1JBm6PRZCO1d7OHBStWpVFZLO+RerTvqX\/Z9mBFfCJZ4A=="/g' ${i} - sed -i 's/"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jquery\/3.6.0\/jquery.slim.min.js" integrity="sha512-6ORWJX\/LrnSjBzwefdNUyLCMTIsGoNP6NftMy2UAm1JBm6PRZCO1d7OHBStWpVFZLO+RerTvqX\/Z9mBFfCJZ4A=="/https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jquery\/3.6.0\/jquery.slim.js" integrity="sha512-6ORWJX\/LrnSjBzwefdNUyLCMTIsGoNP6NftMy2UAm1JBm6PRZCO1d7OHBStWpVFZLO+RerTvqX\/Z9mBFfCJZ4A=="/g' ${i} - done -} - - -echo WARNING -echo This script will replace the version of bootrstrap CSS an JS -echo use it only if you know what you are doing -echo -while true; do - read -p "Do you wish to proceed?" yn - case $yn in - [Yy]* ) make_replace; break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..860d1a9 --- /dev/null +++ b/test.sh @@ -0,0 +1 @@ +python3 webapp.py diff --git a/webapp.py b/webapp.py index e9c9a61..b728a5d 100644 --- a/webapp.py +++ b/webapp.py @@ -204,18 +204,18 @@ def plotlist(): def plots(): payload=plotlist() whoj=who_is_connected() - response=flask.Response(render_template('plots.html',mycallsign=cfg['mycallsign'],menu_list=cfg['menu']['menu_list'],payload=payload,timer_interval=cfg['plot_refresh_timer']['interval'],who=whoj)) + response=flask.Response(render_template('plots.html',mycallsign=cfg['mycallsign'],telnet=cfg['telnet'],mail=cfg['mail'],menu_list=cfg['menu']['menu_list'],payload=payload,timer_interval=cfg['plot_refresh_timer']['interval'],who=whoj)) return response @app.route('/cookies.html', methods=['GET']) def cookies(): - response=flask.Response(render_template('cookies.html',mycallsign=cfg['mycallsign'],menu_list=cfg['menu']['menu_list'])) + response=flask.Response(render_template('cookies.html',mycallsign=cfg['mycallsign'],telnet=cfg['telnet'],mail=cfg['mail'],menu_list=cfg['menu']['menu_list'])) return response @app.route('/privacy.html', methods=['GET']) def privacy(): - response=flask.Response(render_template('privacy.html',mycallsign=cfg['mycallsign'],menu_list=cfg['menu']['menu_list'])) + response=flask.Response(render_template('privacy.html',mycallsign=cfg['mycallsign'],telnet=cfg['telnet'],mail=cfg['mail'],menu_list=cfg['menu']['menu_list'])) return response @app.route('/sitemap.xml') @@ -227,7 +227,8 @@ def callsign(): payload=spotquery() country_data=load_country() callsign=request.args.get('c') - response=flask.Response(render_template('callsign.html',mycallsign=cfg['mycallsign'],menu_list=cfg['menu']['menu_list'],payload=payload,country_data=country_data,callsign=callsign,adxo_events=adxo_events)) +# response=flask.Response(render_template('callsign.html',mycallsign=cfg['mycallsign'],menu_list=cfg['menu']['menu_list'],payload=payload,country_data=country_data,callsign=callsign,adxo_events=adxo_events)) + response=flask.Response(render_template('callsign.html',mycallsign=cfg['mycallsign'],telnet=cfg['telnet'],mail=cfg['mail'],menu_list=cfg['menu']['menu_list'],payload=payload,timer_interval=cfg['timer']['interval'],country_data=country_data,callsign=callsign,adxo_events=adxo_events)) return response #@app.route('/who',methods=['GET'])