mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: update service worker generation timestamp and cache version in sw.js; improve protobuf handling in OpenTelemetryRequestMiddleware
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -140,3 +140,4 @@ terraform.tfstate.backup
|
||||
.terraform/
|
||||
.terraform.lock.hcl
|
||||
.claude/worktrees/**
|
||||
App/FeatureSet/Dashboard/public/sw.js
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Generated Service Worker for OneUptime Dashboard
|
||||
*
|
||||
* Generated at: 2026-03-04T18:04:01.216Z
|
||||
* Generated at: 2026-03-05T14:58:16.272Z
|
||||
* App Version: 0.1.0
|
||||
* Git SHA: fda87057
|
||||
* Git SHA: b592a7c5
|
||||
*
|
||||
* DO NOT EDIT THIS FILE DIRECTLY
|
||||
* Edit the template file instead and run the generator script
|
||||
@@ -19,7 +19,7 @@ console.log('[ServiceWorker] OneUptime PWA Service Worker Loaded');
|
||||
// Cache configuration - Updated dynamically during build
|
||||
// Version format: oneuptime-v{APP_VERSION}-{GIT_SHA}
|
||||
// This ensures cache invalidation on every deployment
|
||||
const CACHE_VERSION = 'oneuptime-v0.1.0-fda87057'; // Auto-generated version
|
||||
const CACHE_VERSION = 'oneuptime-v0.1.0-b592a7c5'; // Auto-generated version
|
||||
const STATIC_CACHE = `${CACHE_VERSION}-static`;
|
||||
const DYNAMIC_CACHE = `${CACHE_VERSION}-dynamic`;
|
||||
|
||||
|
||||
@@ -43,20 +43,22 @@ export default class OpenTelemetryRequestMiddleware {
|
||||
const contentType: string | undefined = req.headers["content-type"];
|
||||
const isProtobuf: boolean =
|
||||
req.body instanceof Uint8Array &&
|
||||
(!contentType || contentType.includes("application/x-protobuf") || contentType.includes("application/protobuf"));
|
||||
(!contentType ||
|
||||
contentType.includes("application/x-protobuf") ||
|
||||
contentType.includes("application/protobuf"));
|
||||
|
||||
if (req.url.includes("/otlp/v1/traces")) {
|
||||
if (isProtobuf) {
|
||||
req.body = TracesData.decode(req.body);
|
||||
} else if (req.body instanceof Uint8Array) {
|
||||
req.body = JSON.parse(req.body.toString("utf-8"));
|
||||
req.body = JSON.parse(Buffer.from(req.body).toString("utf-8"));
|
||||
}
|
||||
productType = ProductType.Traces;
|
||||
} else if (req.url.includes("/otlp/v1/logs")) {
|
||||
if (isProtobuf) {
|
||||
req.body = LogsData.decode(req.body);
|
||||
} else if (req.body instanceof Uint8Array) {
|
||||
req.body = JSON.parse(req.body.toString("utf-8"));
|
||||
req.body = JSON.parse(Buffer.from(req.body).toString("utf-8"));
|
||||
}
|
||||
|
||||
productType = ProductType.Logs;
|
||||
@@ -64,7 +66,7 @@ export default class OpenTelemetryRequestMiddleware {
|
||||
if (isProtobuf) {
|
||||
req.body = MetricsData.decode(req.body);
|
||||
} else if (req.body instanceof Uint8Array) {
|
||||
req.body = JSON.parse(req.body.toString("utf-8"));
|
||||
req.body = JSON.parse(Buffer.from(req.body).toString("utf-8"));
|
||||
}
|
||||
productType = ProductType.Metrics;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user