Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9406cfa0e2 | |||
| 1f310ef8f1 | |||
| 9cd10118e3 | |||
| 6308e0126d |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@api.global/typedserver",
|
||||
"version": "7.8.3",
|
||||
"version": "7.8.5",
|
||||
"description": "A TypeScript-based project for easy serving of static files with support for live reloading, compression, and typed requests.",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
|
||||
@@ -11,7 +11,7 @@ export class TypedRequestController {
|
||||
this.typedRouter = typedRouter;
|
||||
}
|
||||
|
||||
@plugins.smartserve.Post('/')
|
||||
@plugins.smartserve.Post('')
|
||||
async handleTypedRequest(ctx: plugins.smartserve.IRequestContext): Promise<Response> {
|
||||
try {
|
||||
const response = await this.typedRouter.routeAndAddResponse(ctx.body as plugins.typedrequestInterfaces.ITypedRequest);
|
||||
@@ -31,4 +31,15 @@ export class TypedRequestController {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@plugins.smartserve.Head('')
|
||||
async handleTypedRequestHead(): Promise<Response> {
|
||||
// HEAD request for online checking from service worker
|
||||
return new Response(null, {
|
||||
status: 200,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ export class NetworkManager {
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch('/sw-typedrequest', {
|
||||
const response = await fetch('/typedrequest', {
|
||||
method: 'HEAD',
|
||||
cache: 'no-cache'
|
||||
});
|
||||
|
||||
@@ -177,7 +177,7 @@ export class UpdateManager {
|
||||
try {
|
||||
const getAppHashRequest = new plugins.typedrequest.TypedRequest<
|
||||
interfaces.serviceworker.IRequest_Serviceworker_Backend_VersionInfo
|
||||
>('/sw-typedrequest', 'serviceworker_versionInfo');
|
||||
>('/typedrequest', 'serviceworker_versionInfo');
|
||||
|
||||
// Use networkManager for the request with retries and timeout
|
||||
const response = await getAppHashRequest.fire({});
|
||||
|
||||
Reference in New Issue
Block a user