Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
coulisse committed Mar 10, 2024
2 parents e575129 + 1592993 commit 2102a58
Show file tree
Hide file tree
Showing 20 changed files with 932 additions and 2,220 deletions.
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ keywords:
- dxcluster
- spiderweb
license: GPL-3.0
version: v2.5.2
date-released: 2023-12-02
version: v2.5.3
date-released: 2024-03-10
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![CodeFactor](https://www.codefactor.io/repository/github/coulisse/spiderweb/badge)](https://www.codefactor.io/repository/github/coulisse/spiderweb)


- **Release:** v2.5.2
- **Release:** v2.5.3
- **Author:** Corrado Gerbaldo - [IU1BOW](https://www.qrz.com/db/IU1BOW)
- **Mail:** <[email protected]>
- **Licensing:** Gpl V3.0 see [LICENSE](LICENSE) file.
Expand Down
1 change: 0 additions & 1 deletion cfg/config.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
},
"mycallsign":"XXXXXX",
"mail":"[email protected]",
"mail_token": "foobar",
"enable_cq_filter":"n",
"telnet": {
"host": "mysite",
Expand Down
2 changes: 1 addition & 1 deletion cfg/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.5.2
v2.5.3
12 changes: 10 additions & 2 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
### Change log
Date: 02/12/2023
Date: 10/03/2024
Release: v2.5.3
- adapted card size and text for mobile
- removed monitor
- removed cookie consent banner, since this application uses only technical cookies
- issue [#51] (https://github.com/coulisse/spiderweb/issues/51) -- just for caching
- security [#22] (https://github.com/coulisse/spiderweb/security/dependabot/22)

___
Date: 03/12/2023
Release: v2.5.2
- security issue #46.
- csp report
Expand All @@ -8,7 +17,6 @@ Release: v2.5.2
- Sanitized callsign input
- Added propagation page with MUF Map. Issue [#27](https://github.com/coulisse/spiderweb/issues/27). Thanks to Paul Herman and Andrew Rodland


___
Date: 12/11/2023
Release: v2.4.5.1
Expand Down
191 changes: 191 additions & 0 deletions lib/qry_builder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
# find id in json : ie frequency / continent
def find_id_json(json_object, name):
return [obj for obj in json_object if obj["id"] == name][0]

def query_build_callsign(logger,callsign):

query_string = ""
if len(callsign) <= 14:
query_string = (
"(SELECT rowid, spotter AS de, freq, spotcall AS dx, comment AS comm, time, spotdxcc from spot WHERE spotter='"
+ callsign
+ "'"
)
query_string += " ORDER BY rowid desc limit 10)"
query_string += " UNION "
query_string += (
"(SELECT rowid, spotter AS de, freq, spotcall AS dx, comment AS comm, time, spotdxcc from spot WHERE spotcall='"
+ callsign
+ "'"
)
query_string += " ORDER BY rowid desc limit 10);"
else:
logger.warning("callsign too long")
return query_string


def query_build(logger,parameters,band_frequencies,modes_frequencies,continents_cq,enable_cq_filter):

try:
last_rowid = str(parameters["lr"]) # Last rowid fetched by front end

get_param = lambda parameters, parm_name: parameters[parm_name] if (parm_name in parameters) else []
dxcalls=get_param(parameters, "dxcalls")
band=get_param(parameters, "band")
dere=get_param(parameters, "de_re")
dxre=get_param(parameters, "dx_re")
mode=get_param(parameters, "mode")
exclft8=get_param(parameters, "exclft8")
exclft4=get_param(parameters, "exclft4")

decq = []
if "cqdeInput" in parameters:
decq[0] = parameters["cqdeInput"]

dxcq = []
if "cqdxInput" in parameters:
dxcq[0] = parameters["cqdxInput"]

query_string = ""

#construct callsign of spot dx callsign
dxcalls_qry_string = " AND spotcall IN (" + ''.join(map(lambda x: "'" + x + "'," if x != dxcalls[-1] else "'" + x + "'", dxcalls)) + ")"
# construct band query decoding frequencies with json file
band_qry_string = " AND (("
for i, item_band in enumerate(band):
freq = find_id_json(band_frequencies["bands"], item_band)
if i > 0:
band_qry_string += ") OR ("

band_qry_string += (
"freq BETWEEN " + str(freq["min"]) + " AND " + str(freq["max"])
)

band_qry_string += "))"
# construct mode query
mode_qry_string = " AND (("
for i, item_mode in enumerate(mode):
single_mode = find_id_json(modes_frequencies["modes"], item_mode)
if i > 0:
mode_qry_string += ") OR ("
for j in range(len(single_mode["freq"])):
if j > 0:
mode_qry_string += ") OR ("
mode_qry_string += (
"freq BETWEEN "
+ str(single_mode["freq"][j]["min"])
+ " AND "
+ str(single_mode["freq"][j]["max"])
)

mode_qry_string += "))"

#Exluding FT8 or FT4 connection
ft8_qry_string = " AND ("
if exclft8:
ft8_qry_string += "(comment NOT LIKE '%FT8%')"
single_mode = find_id_json(modes_frequencies["modes"], "digi-ft8")
for j in range(len(single_mode["freq"])):
ft8_qry_string += (
" AND (freq NOT BETWEEN "
+ str(single_mode["freq"][j]["min"])
+ " AND "
+ str(single_mode["freq"][j]["max"])
+ ")"
)
ft8_qry_string += ")"

ft4_qry_string = " AND ("
if exclft4:
ft4_qry_string += "(comment NOT LIKE '%FT4%')"
single_mode = find_id_json(modes_frequencies["modes"], "digi-ft4")
for j in range(len(single_mode["freq"])):
ft4_qry_string += (
" AND (freq NOT BETWEEN "
+ str(single_mode["freq"][j]["min"])
+ " AND "
+ str(single_mode["freq"][j]["max"])
+ ")"
)
ft4_qry_string += ")"

# construct DE continent region query
dere_qry_string = " AND spottercq IN ("
for i, item_dere in enumerate(dere):
continent = find_id_json(continents_cq["continents"], item_dere)
if i > 0:
dere_qry_string += ","
dere_qry_string += str(continent["cq"])
dere_qry_string += ")"

# construct DX continent region query
dxre_qry_string = " AND spotcq IN ("
for i, item_dxre in enumerate(dxre):
continent = find_id_json(continents_cq["continents"], item_dxre)
if i > 0:
dxre_qry_string += ","
dxre_qry_string += str(continent["cq"])
dxre_qry_string += ")"

if enable_cq_filter == "Y":
# construct de cq query
decq_qry_string = ""
if len(decq) == 1:
if decq[0].isnumeric():
decq_qry_string = " AND spottercq =" + decq[0]
# construct dx cq query
dxcq_qry_string = ""
if len(dxcq) == 1:
if dxcq[0].isnumeric():
dxcq_qry_string = " AND spotcq =" + dxcq[0]

if last_rowid is None:
last_rowid = "0"
if not last_rowid.isnumeric():
last_rowid = 0

query_string = "SELECT rowid, spotter AS de, freq, spotcall AS dx, comment AS comm, time, spotdxcc from spot WHERE rowid > "+(str(last_rowid))


if dxcalls:
query_string += dxcalls_qry_string

if len(band) > 0:
query_string += band_qry_string

if len(mode) > 0:
query_string += mode_qry_string

if exclft8:
query_string += ft8_qry_string

if exclft4:
query_string += ft4_qry_string

if len(dere) > 0:
query_string += dere_qry_string

if len(dxre) > 0:
query_string += dxre_qry_string

if enable_cq_filter == "Y":
if len(decq_qry_string) > 0:
query_string += decq_qry_string

if len(dxcq_qry_string) > 0:
query_string += dxcq_qry_string

query_string += " ORDER BY rowid desc limit 50;"

logger.debug (query_string)

except Exception as e:
logger.error(e)
query_string = ""

return query_string


def query_build_callsing_list():
query_string = "SELECT spotcall AS dx FROM (select spotcall from spot order by rowid desc limit 50000) s1 GROUP BY spotcall ORDER BY count(spotcall) DESC, spotcall LIMIT 100;"
return query_string
44 changes: 28 additions & 16 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
blinker==1.7.0
charset-normalizer==3.3.2
click==8.1.7
Flask==3.0.0
Flask-Minify==0.42
Flask-WTF==1.2.1
astroid==2.12.14
blinker==1.6.2
charset-normalizer==2.1.1
click==8.1.3
dill==0.3.6
docopt-ng==0.8.1
easywatch==0.0.5
Flask==2.3.3
Flask-Consent==0.0.3
Flask-Minify==0.41
Flask-WTF==1.1.1
htmlmin==0.1.12
idna==3.4
isort==5.11.4
itsdangerous==2.1.2
Jinja2==3.1.2
Jinja2==3.1.3
jsmin==3.0.1
lazy-object-proxy==1.9.0
lesscpy==0.15.1
MarkupSafe==2.1.3
markup==0.2
MarkupSafe==2.1.1
mccabe==0.7.0
mysql-connector-python>=8.2.0
numpy==1.26.1
pandas==2.1.3
numpy==1.24.1
pandas==1.5.2
platformdirs==2.6.2
ply==3.11
protobuf==4.21.12
python-dateutil==2.8.2
pytz==2023.3.post1
rcssmin==1.1.2
pytz==2022.7
rcssmin==1.1.1
requests==2.31.0
six==1.16.0
tzdata==2023.3
tomlkit==0.11.6
urllib3==2.0.7
Werkzeug==3.0.1
WTForms==3.1.1
watchdog==3.0.0
Werkzeug==2.3.8
wrapt==1.14.1
WTForms==3.0.1
xmltodict==0.13.0
xxhash==3.4.1
xxhash==3.1.0
Loading

0 comments on commit 2102a58

Please sign in to comment.