Skip to content

Commit

Permalink
v4.0.20-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
jemu75 committed Feb 26, 2024
1 parent efa6bc8 commit e21bd86
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 29 deletions.
3 changes: 3 additions & 0 deletions public/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v4.0.20-beta (26.02.2024)
## Core
- csrf handling changed
# v4.0.19-beta (25.02.2024)
## Core
- Bugfix for Navigation if panel is not showed
Expand Down
4 changes: 0 additions & 4 deletions src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@
"title": "Verbindung zu FHEM fehlgeschlagen",
"text": "Prüfe ob FHEM erreichbar ist oder die URL Verbindungsparameter (?protocol=...&server=...&port=...&path=...) korrekt sind, falls diese angegeben wurden."
},
"csrf": {
"title": "Abruf des CSRF Token fehlgeschlagen",
"text": "Prüfe ob FHEM erreichbar ist und lade FHEMapp neu. Wenn der Fehler erneut auftritt, prüfe ob die FHEM Einstellungen für CSRF Token kerrekt sind."
},
"wrongDevice": {
"title": "FHEM Config Device nicht gefunden",
"text": "Das FHEM Device das in der URL angegeben wurde (http://url/index.html#/fhemappdevice/...) konnte nicht gefunden werden."
Expand Down
4 changes: 0 additions & 4 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@
"title": "Connection to FHEM failed",
"text": "Check if FHEM is reachable or if the URL connection parameters (?protocol=...&server=...&port=...&path=...) are correct, if specified."
},
"csrf": {
"title": "Failed to retrieve the CSRF token",
"text": "Check if FHEM is reachable and reload FHEMapp. If the error occurs again, check whether the FHEM settings for CSRF tokens are correct."
},
"wrongDevice": {
"title": "FHEM Config Device not found",
"text": "The FHEM device specified in the URL (http://url/index.html#/fhemappdevice/...) could not be found."
Expand Down
16 changes: 4 additions & 12 deletions src/stores/fhem.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,13 @@ export const useFhemStore = defineStore('fhem', () => {
options = { method: 'POST' },
result

if(type !== 'token') params += '&fwcsrf=' + stat.csrf
if(type !== 'token' && stat.csrf) params += '&fwcsrf=' + stat.csrf
if(cmd) options.body = 'cmd=' + cmd

log(4, 'Request send to FHEM.', { url: createURL(params), options })

return await fetch(createURL(params), options)
.then((res) => {
.then((res) => {
if(type === 'token') result = res.headers.get('x-fhem-csrftoken')
if(type === 'json') result = res.json()
if(type === 'text') result = res.text()
Expand All @@ -218,16 +218,8 @@ export const useFhemStore = defineStore('fhem', () => {

//coreFunction fill settings (session)
async function getToken() {
let res = await request('token')

if(typeof res === 'string' && res.length > 0) {
stat.csrf = res
log(4, 'CSRF Token retrieved.', res)
return res
} else {
if(!res) res = log(2, 'No CSRF Token received.', 'csrf')
return false
}
stat.csrf = await request('token')
return true
}

//coreFunction convert String to JSON
Expand Down
3 changes: 3 additions & 0 deletions www/fhemapp4/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v4.0.20-beta (26.02.2024)
## Core
- csrf handling changed
# v4.0.19-beta (25.02.2024)
## Core
- Bugfix for Navigation if panel is not showed
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e21bd86

Please sign in to comment.