mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-03-03 02:27:01 +00:00
fix: Setting Status Page Analytics Type to "None" fails with SQLite constraint violation (#7043)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -338,6 +338,10 @@ module.exports.statusPageSocketHandler = (socket) => {
|
||||
statusPage.modified_date = R.isoDateTime();
|
||||
statusPage.analytics_id = config.analyticsId;
|
||||
statusPage.analytics_script_url = config.analyticsScriptUrl;
|
||||
const validAnalyticsTypes = ["google", "umami", "plausible", "matomo"];
|
||||
if (config.analyticsType !== null && !validAnalyticsTypes.includes(config.analyticsType)) {
|
||||
throw new Error("Invalid analytics type");
|
||||
}
|
||||
statusPage.analytics_type = config.analyticsType;
|
||||
|
||||
await R.store(statusPage);
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
class="form-select"
|
||||
data-testid="analytics-type-select"
|
||||
>
|
||||
<option>{{ $t("None") }}</option>
|
||||
<option :value="null">{{ $t("None") }}</option>
|
||||
<option value="google">{{ $t("Google") }}</option>
|
||||
<option value="umami">{{ $t("Umami") }}</option>
|
||||
<option value="plausible">{{ $t("Plausible") }}</option>
|
||||
@@ -688,7 +688,9 @@ export default {
|
||||
enableEditMode: false,
|
||||
enableEditIncidentMode: false,
|
||||
hasToken: false,
|
||||
config: {},
|
||||
config: {
|
||||
analyticsType: null,
|
||||
},
|
||||
selectedMonitor: null,
|
||||
incident: null,
|
||||
previousIncident: null,
|
||||
|
||||
Reference in New Issue
Block a user