Skip to content

Commit

Permalink
add experimental support for iframes
Browse files Browse the repository at this point in the history
  • Loading branch information
cshagen committed Jan 2, 2025
1 parent de2a1c1 commit abcf539
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class Config {
private _showPrices = false
private _showInverters = false
private _alternativeEnergy = false
private _sslPrefs: boolean = false
private _debug: boolean = false
private _lowerPriceBound = 0
private _upperPriceBound = 0
Expand Down Expand Up @@ -203,6 +204,16 @@ export class Config {
setShowClock(mode: string) {
this._showClock = mode
}
get sslPrefs() {
return this._sslPrefs
}
set sslPrefs(on: boolean) {
this._sslPrefs = on
savePrefs()
}
setSslPrefs(on: boolean) {
this.sslPrefs = on
}
get debug() {
return this._debug
}
Expand Down Expand Up @@ -482,6 +493,7 @@ interface Preferences {
altEngy?: boolean
lowerP?: number
upperP?: number
sslPrefs?: boolean
debug?: boolean
}

Expand Down Expand Up @@ -514,12 +526,14 @@ function writeCookie() {
prefs.altEngy = globalConfig.alternativeEnergy
prefs.lowerP = globalConfig.lowerPriceBound
prefs.upperP = globalConfig.upperPriceBound
prefs.sslPrefs = globalConfig.sslPrefs
prefs.debug = globalConfig.debug

document.cookie =
'openWBColorTheme=' +
JSON.stringify(prefs) +
';max-age=16000000;samesite=none'
';max-age=16000000;' +
(globalConfig.sslPrefs ? 'SameSite=None;Secure' : 'SameSite=Strict')
}

function readCookie() {
Expand Down Expand Up @@ -609,6 +623,9 @@ function readCookie() {
if (prefs.upperP !== undefined) {
globalConfig.setUpperPriceBound(prefs.upperP)
}
if (prefs.sslPrefs !== undefined) {
globalConfig.setSslPrefs(prefs.sslPrefs)
}
if (prefs.debug !== undefined) {
globalConfig.setDebug(prefs.debug)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,5 @@ export const topVehicles = computed(() => {
if (v2 != -1) {
result.push(v2)
}
console.log(result)
return result
})
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@
:options="clockModes"
></RadioInput>
</ConfigItem>
</div>
<div class="settingscolumn">
<ConfigItem
:fullwidth="true"
title="Kompakte Ladepunktliste"
Expand All @@ -103,6 +101,9 @@
:options="shortListOptions"
/>
</ConfigItem>

</div>
<div class="settingscolumn">
<ConfigItem
:fullwidth="true"
title="Buttonleiste für Ladepunkte"
Expand Down Expand Up @@ -143,8 +144,6 @@
>
<SwitchInput v-model="globalConfig.showAnimations" />
</ConfigItem>
</div>
<div class="settingscolumn">
<ConfigItem
:fullwidth="true"
title="Zähler anzeigen"
Expand All @@ -169,7 +168,25 @@
>
<SwitchInput v-model="globalConfig.showStandardVehicle" />
</ConfigItem>
</div>
<div class="settingscolumn">
<ConfigItem
:fullwidth="true"
title="Wechselrichter-Details anzeigen"
icon="fa-solar-panel"
infotext="Zeige Details zu den einzelnen Wechselrichtern"
>
<SwitchInput v-model="globalConfig.showInverters" />
</ConfigItem>
<ConfigItem
:fullwidth="true"
title="Alternatives Energie-Widget"
icon="fa-chart-area"
infotext="Horizontale Darstellung der Energie-Werte"
>
<SwitchInput v-model="globalConfig.alternativeEnergy" />
</ConfigItem>
<ConfigItem
:fullwidth="true"
title="Preistabelle anzeigen"
icon="fa-car"
Expand Down Expand Up @@ -209,21 +226,14 @@
unit="ct"
/>
</ConfigItem>

<ConfigItem
:fullwidth="true"
title="Wechselrichter-Details anzeigen"
icon="fa-solar-panel"
infotext="Zeige Details zu den einzelnen Wechselrichtern"
title="IFrame-Support für Einstellungen (Experimentell)"
icon="fa-gear"
infotext="Erlaubt das Lesen der Einstellungen, wenn das UI in andere Applikationen eingebettet ist (z.B. HomeAssistant). Erfordert SSL. Experimentelles Feature."
>
<SwitchInput v-model="globalConfig.showInverters" />
</ConfigItem>
<ConfigItem
:fullwidth="true"
title="Alternatives Energie-Widget"
icon="fa-chart-area"
infotext="Horizontale Darstellung der Energie-Werte"
>
<SwitchInput v-model="globalConfig.alternativeEnergy" />
<SwitchInput v-model="globalConfig.sslPrefs" />
</ConfigItem>
<ConfigItem
:fullwidth="true"
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

4 changes: 2 additions & 2 deletions packages/modules/web_themes/colors/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
<link rel="apple-touch-icon" sizes="60x60" href="/openWB/web/img/favicons/apple-touch-icon-60x60.png">
<link rel="manifest" href="/openWB/web/manifest.json">
<title>openWB</title>
<script type="module" crossorigin src="/openWB/web/themes/colors/assets/index-c4yweOn4.js"></script>
<script type="module" crossorigin src="/openWB/web/themes/colors/assets/index-Bfmq2pf1.js"></script>
<link rel="modulepreload" crossorigin href="/openWB/web/themes/colors/assets/vendor-CyQtMzsz.js">
<link rel="stylesheet" crossorigin href="/openWB/web/themes/colors/assets/index-C3oaxYqI.css">
<link rel="stylesheet" crossorigin href="/openWB/web/themes/colors/assets/index-CAyRdrFn.css">
</head>

<body>
Expand Down

0 comments on commit abcf539

Please sign in to comment.