add initial frame, kodi api module, static serve module, settings, etc.

This commit is contained in:
Jurgis Sakalauskas
2022-12-05 09:59:18 +02:00
parent 40e9244e31
commit 1ad27b4e8f
24 changed files with 15285 additions and 0 deletions
@@ -0,0 +1,24 @@
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
import RequestRangeBytes from './request-range-bytes.class';
export const RequestRange = createParamDecorator(
(data: string, ctx: ExecutionContext): RequestRangeBytes | null => {
const request = ctx.switchToHttp().getRequest().headers;
const range = request['range'];
if (!range) {
return null;
}
const array = range.split(/bytes=([0-9]*)-([0-9]*)/);
let start = parseInt(array[1]);
let end = parseInt(array[2]);
//both isNaN? -> incorrect request header, response with everything we have
start = isNaN(start) ? null : start; //isNaN? -> only num of end bytes requested
end = isNaN(end) ? null : end; //isNaN? -> everything from start to the end requested
return new RequestRangeBytes(start, end);
},
);