From aa5d8e2be2037d713e6591737c664aff28ca55f7 Mon Sep 17 00:00:00 2001 From: coulisse Date: Sat, 26 Sep 2020 16:07:19 +0000 Subject: [PATCH] 1.2.1 --- CODE_OF_CONDUCT.md | 76 +++++++++++++++++++++++++ README.md | 10 +++- cfg/config.json.example | 14 ----- cfg/config.json.template | 22 +++++++ docs/CHANGELOG.md | 6 ++ docs/TODO.md | 8 +++ docs/dxspider_connect.txt | 1 + static/js/application.js | 2 + static/js/min/application.min.js | 2 +- templates/callsign.html | 26 ++++----- {static/html => templates}/cookies.html | 26 ++++----- templates/index.html | 30 +++++----- templates/plots.html | 26 ++++----- webapp.py | 16 +++--- 14 files changed, 180 insertions(+), 85 deletions(-) create mode 100644 CODE_OF_CONDUCT.md delete mode 100644 cfg/config.json.example create mode 100644 cfg/config.json.template rename {static/html => templates}/cookies.html (90%) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..0552743 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at corrado.gerbaldo@gmail.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/README.md b/README.md index 1308bbc..8011062 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ Then you have to install also **python-dev, ssl and mysql libraries**: foo@bar:~$ sudo apt-get install python-dev default-libmysqlclient-dev libssl-dev foo@bar:~$ sudo -H pip install flask_mysqldb --system ``` + Finally you have to install matplotlib in order to plots some graphics ```console foo@bar:~$ sudo apt-get install python-matplotlib @@ -61,11 +62,11 @@ foo@bar:~$ sudo -H pip install --upgrade matplotlib ``` **4) Configuration** -In the path `spiderweb/cfg/` rename `config.json.example` in `config.json`: +In the path `spiderweb/cfg/` rename `config.json.template` in `config.json`: ```console -foo@bar:~$ mv config.json.example config.json +foo@bar:~$ mv config.json.template config.json ``` -then edit it and set the user and password of your database +then edit it and set the user and password of your database and the menu items In order to show the right plots, you have to generate them! To do so you have to run *.sh* files inside *scripts* folders, or the better way is to **schedule** them with your **crontab** @@ -103,10 +104,13 @@ Screenshot ---------- +

+

+ ### TODO see it on file ["TODO.md"](docs/TODO.md) diff --git a/cfg/config.json.example b/cfg/config.json.example deleted file mode 100644 index cec316b..0000000 --- a/cfg/config.json.example +++ /dev/null @@ -1,14 +0,0 @@ -{ - "mysql":{ - "host":"localhost", - "user":"foo", - "passwd":"bar", - "db":"dxcluster" - }, - "timer":{ - "interval":30000 - }, - "plot_refresh_timer":{ - "interval":450000 - } -} diff --git a/cfg/config.json.template b/cfg/config.json.template new file mode 100644 index 0000000..0da8cf3 --- /dev/null +++ b/cfg/config.json.template @@ -0,0 +1,22 @@ +{ + "mysql":{ + "host":"localhost", + "user":"foo", + "passwd":"bar", + "db":"dxcluster" + }, + "timer":{ + "interval":30000 + }, + "plot_refresh_timer":{ + "interval":450000 + }, + "mycallsign":"XXXXXX", + "menu": { + "menu_list": [ + {"label":"Plots", "link": "/plots.html", "external": false}, + {"label":"Sources", "link": "https://github.com/coulisse/spiderweb/" , "external": true}, + {"label":"Cookies policy", "link": "/cookies.html", "external": false} + ] + } +} diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 6ea7c49..f7d8c4e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,11 @@ ### Change log ___ +21/10/2020: 1.2.1 +- Added country column (only on desktop version) +- Added external configurable menu +- renamed json.config.example json.config.template +- Added code of conduct and issue templates +___ 08/09/2020: 1.2 - Modified cookies.html in order to insert dinamically the host name (instead of dxcluster.iu1bobw.it) - Removed sitemap.xml from git diff --git a/docs/TODO.md b/docs/TODO.md index d8a6fb5..0b56a6d 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -11,4 +11,12 @@ - [ ] testing automation - [ ] add page with connected nodes - [ ] add google analitics include on server side +- [x] add country on desktop version +- [x] add configuration to menu +- [ ] edit configuration with cli interface +- [ ] migrate to python3 +- [ ] migrate to boostrap5 (when ready.. end of 2020?) +- [ ] set default icon image for images not found (es for 4U1UN) +- [ ] implement CSRF protection. See: https://flask-wtf.readthedocs.io/en/stable/csrf.html + diff --git a/docs/dxspider_connect.txt b/docs/dxspider_connect.txt index ceb57de..612a23f 100644 --- a/docs/dxspider_connect.txt +++ b/docs/dxspider_connect.txt @@ -1,5 +1,6 @@ how to connect dx-spider to another cluster node: - login on gnu/linux as sysop user +- go in spider/connect folder and create a file named OTHERCALLSIGN with the connection info of the other node - from your client (IU1BOW) send command: set/spider OHTERCALLSIGN - Open file /spider/local_cmd/crontab ed put 0,10,20,30,40,50 * * * * start_connect('OTHERCALLSIGN') unless connected('OTHERCALLSIGN') diff --git a/static/js/application.js b/static/js/application.js index eebda77..78d7dbb 100644 --- a/static/js/application.js +++ b/static/js/application.js @@ -75,6 +75,8 @@ function buildHtmlTable(selector,data,rl,countries,callsign) { row$.append($('').html(' '+dx+'')); + + row$.append($('').html(country.country)); try { row$.append($('').html(''+country.country+'')); } catch (err) { diff --git a/static/js/min/application.min.js b/static/js/min/application.min.js index 1beffb6..4d1ca32 100644 --- a/static/js/min/application.min.js +++ b/static/js/min/application.min.js @@ -1 +1 @@ -function findCountry(t,a){for(var e=0;e'),g=e.find(t=>t==a[i].rowid);null!=n?n==a[i].de?d=$(''):n==a[i].dx&&(d=$('')):null==g&&e.length>0&&(d=$(''));var m=findCountry(s,a[i].spotdxcc);a[i].de==n?de=""+a[i].de+"":de=a[i].de,d.append($("").html(' '+de+""));var h=Intl.NumberFormat("it-IT",{style:"decimal"}).format(a[i].freq);d.append($("").html(''+h+"")),a[i].dx==n?dx=""+a[i].dx+"":dx=a[i].dx,d.append($("").html(' '+dx+""));try{d.append($("").html(''+m.country+''))}catch(t){d.append($(""))}d.append($('').html(a[i].comm));var u=new Date(1e3*a[i].time),b="00"+u.getUTCHours();b=b.substring(b.length-2,b.length);var _="00"+u.getMinutes();_=_.substring(_.length-2,_.length);var f="00"+u.getUTCDate();f=f.substring(f.length-2,f.length);var v="00"+(Number(u.getUTCMonth())+1);v=v.substring(v.length-2,v.length);var y=u.getUTCFullYear();tm=b+":"+_,(u=f+"/"+v+"/"+y)==dt_current?d.append($("").html(tm)):d.append($("").html('
'+tm+"
"+u+"
")),$(t).append(d)}try{return Array.from(l)}catch(t){return}}function mySearch(t){t.preventDefault(),myTimer()}function myTimer(){var t=new XMLHttpRequest;selectedBands=[].map.call(document.getElementById("band").selectedOptions,t=>t.value),selectedDEre=[].map.call(document.getElementById("de_re").selectedOptions,t=>t.value),selectedDXre=[].map.call(document.getElementById("dx_re").selectedOptions,t=>t.value);var a="",e="";selectedBands.length<14&&(a=selectedBands.map(function(t,a){return"b="+t}).join("&"));var s="";selectedDEre.length<7&&(s=selectedDEre.map(function(t,a){return"e="+t}).join("&")),e=a&&s?a.concat("&".concat(s)):a.concat(s);var n="";selectedDXre.length<7&&(n=selectedDXre.map(function(t,a){return"x="+t}).join("&"));var l="spotlist";(e=e&&n?e.concat("&".concat(n)):e.concat(n))&&(l=l.concat("?".concat(e))),t.open("GET",l,!0),t.onload=function(){try{rows_list=buildHtmlTable("#bodyspot",JSON.parse(this.response),rows_list,my_countries.country_codes)}catch(t){console.log(this.response)}},t.send()}function buildHtmlPlots(t,a){$(t).empty();var e=$('
');e.append($('

').html("Band Activity")),e.append($('propatation heatmap AF')),e.append($('propatation heatmap AN')),e.append($('propatation heatmap AF')),e.append($('propatation heatmap EU')),e.append($('propatation heatmap NA')),e.append($('propatation heatmap OC')),e.append($('propatation heatmap SA')),$(t).append(e),$(t).append($("
"));var s=$('
');s.append($('Qso per months')),$(t).append(s)}function plotsTimer(){var t=new XMLHttpRequest;t.open("GET","plotlist",!0),t.onload=function(){try{plot_list=buildHtmlPlots("#plotlist",JSON.parse(this.response))}catch(t){console.log(t),console.log(this.response)}},t.send()}function myCallsignSearch(){callsign=document.getElementById("callsignInput").value,callsign.replace(/\s/g,"").length>0&&(location.href="/callsign.html?c=".concat(callsign.trim().toUpperCase()))} \ No newline at end of file +function findCountry(t,a){for(var e=0;e'),g=e.find(t=>t==a[i].rowid);null!=n?n==a[i].de?d=$(''):n==a[i].dx&&(d=$('')):null==g&&e.length>0&&(d=$(''));var m=findCountry(s,a[i].spotdxcc);a[i].de==n?de=""+a[i].de+"":de=a[i].de,d.append($("").html(' '+de+""));var h=Intl.NumberFormat("it-IT",{style:"decimal"}).format(a[i].freq);d.append($("").html(''+h+"")),a[i].dx==n?dx=""+a[i].dx+"":dx=a[i].dx,d.append($("").html(' '+dx+"")),d.append($('').html(m.country));try{d.append($("").html(''+m.country+''))}catch(t){d.append($(""))}d.append($('').html(a[i].comm));var u=new Date(1e3*a[i].time),b="00"+u.getUTCHours();b=b.substring(b.length-2,b.length);var _="00"+u.getMinutes();_=_.substring(_.length-2,_.length);var f="00"+u.getUTCDate();f=f.substring(f.length-2,f.length);var v="00"+(Number(u.getUTCMonth())+1);v=v.substring(v.length-2,v.length);var y=u.getUTCFullYear();tm=b+":"+_,(u=f+"/"+v+"/"+y)==dt_current?d.append($("").html(tm)):d.append($("").html('
'+tm+"
"+u+"
")),$(t).append(d)}try{return Array.from(l)}catch(t){return}}function mySearch(t){t.preventDefault(),myTimer()}function myTimer(){var t=new XMLHttpRequest;selectedBands=[].map.call(document.getElementById("band").selectedOptions,t=>t.value),selectedDEre=[].map.call(document.getElementById("de_re").selectedOptions,t=>t.value),selectedDXre=[].map.call(document.getElementById("dx_re").selectedOptions,t=>t.value);var a="",e="";selectedBands.length<14&&(a=selectedBands.map(function(t,a){return"b="+t}).join("&"));var s="";selectedDEre.length<7&&(s=selectedDEre.map(function(t,a){return"e="+t}).join("&")),e=a&&s?a.concat("&".concat(s)):a.concat(s);var n="";selectedDXre.length<7&&(n=selectedDXre.map(function(t,a){return"x="+t}).join("&"));var l="spotlist";(e=e&&n?e.concat("&".concat(n)):e.concat(n))&&(l=l.concat("?".concat(e))),t.open("GET",l,!0),t.onload=function(){try{rows_list=buildHtmlTable("#bodyspot",JSON.parse(this.response),rows_list,my_countries.country_codes)}catch(t){console.log(this.response)}},t.send()}function buildHtmlPlots(t,a){$(t).empty();var e=$('
');e.append($('

').html("Band Activity")),e.append($('propatation heatmap AF')),e.append($('propatation heatmap AN')),e.append($('propatation heatmap AF')),e.append($('propatation heatmap EU')),e.append($('propatation heatmap NA')),e.append($('propatation heatmap OC')),e.append($('propatation heatmap SA')),$(t).append(e),$(t).append($("
"));var s=$('
');s.append($('Qso per months')),$(t).append(s)}function plotsTimer(){var t=new XMLHttpRequest;t.open("GET","plotlist",!0),t.onload=function(){try{plot_list=buildHtmlPlots("#plotlist",JSON.parse(this.response))}catch(t){console.log(t),console.log(this.response)}},t.send()}function myCallsignSearch(){callsign=document.getElementById("callsignInput").value,callsign.replace(/\s/g,"").length>0&&(location.href="/callsign.html?c=".concat(callsign.trim().toUpperCase()))} \ No newline at end of file diff --git a/templates/callsign.html b/templates/callsign.html index c94085a..85d21ae 100644 --- a/templates/callsign.html +++ b/templates/callsign.html @@ -20,25 +20,22 @@