Skip to content

Commit f52d8f3

Browse files
committed
Added support to HLS streams upload
1 parent e28bf8d commit f52d8f3

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nasriya/hypercloud",
3-
"version": "1.2.8",
3+
"version": "1.2.9",
44
"description": "Nasriya HyperCloud is a lightweight Node.js HTTP2 framework.",
55
"main": "./dist/cjs/hypercloud.js",
66
"module": "./dist/esm/hypercloud.js",

src/data/mimes.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"video/mp4",
3535
"video/mpeg",
3636
"application/vnd.apple.installer+xml",
37+
"application/vnd.apple.mpegurl",
3738
"application/vnd.oasis.opendocument.presentation",
3839
"application/vnd.oasis.opendocument.spreadsheet",
3940
"application/vnd.oasis.opendocument.text",

src/docs/docs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export type NextFunction = () => void;
2626
/**Represents various HTTP request methods. */
2727
export type HttpMethod = | 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'CONNECT';
2828
/**Represents the type of the request body. */
29-
export type RequestBodyType = 'text' | 'javascript' | 'json' | 'formData' | 'buffer' | 'graphql';
29+
export type RequestBodyType = 'text' | 'javascript' | 'json' | 'formData' | 'buffer' | 'graphql' | 'hls';
3030
export type HyperCloudServerHandlers = 'notFound' | 'serverError' | 'unauthorized' | 'forbidden' | 'userSessions' | 'logger' | 'onHTTPError';
3131
export type HttpEquivType = 'content-security-policy' | 'content-type' | 'default-style' | 'x-ua-compatible' | 'refresh';
3232
export type HTMLMetaName = 'application-name' | 'author' | 'description' | 'generator' | 'keywords' | 'referrer' | 'theme-color' | 'color-scheme' | 'viewport' | 'creator' | 'googlebot' | 'publisher' | 'robots' | (string & {});

src/services/handler/assets/handlerHelpers.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,20 @@ export function bodyParser(body: any, contentType: string): BodyParserResult {
9090
if (contentType.includes('application/graphql')) {
9191
request.bodyType = 'graphql';
9292
return request;
93-
}
93+
}
9494

95+
if (contentType.includes('application/vnd.apple.mpegurl')) {
96+
request.bodyType = 'hls';
97+
return request;
98+
}
99+
95100
// Handle other types of raw data
96101
request.bodyType = 'buffer';
97102
return request;
98103
}
99104

100105
/**
101-
* Extract the IP address from the request. If priority of chosing the IP is: 1) `X-Real-IP`, 2) `x-forwarded-for`, and 3) The actual remote address
106+
* Extract the IP address from the request. If priority of choosing the IP is: 1) `X-Real-IP`, 2) `x-forwarded-for`, and 3) The actual remote address
102107
* @param {http2.Http2ServerRequest} req The HTTP2 request
103108
* @param {string[]} [trusted_proxies] The trusted proxy IPs
104109
* @returns {string}

0 commit comments

Comments
 (0)