Skip to content

Commit fbaa352

Browse files
committed
chore: prettier
1 parent 9f1f14d commit fbaa352

5 files changed

Lines changed: 23 additions & 24 deletions

File tree

src/controllers/proxy.controller.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ export class ProxyController {
2525
}
2626

2727
// Decode and add proxyData with request headers (used for 'Ranges' in streams)
28-
let proxyDataRaw: ProxyData;
28+
let proxyDataRaw: ProxyData
2929
try {
30-
const decoded = decodeURIComponent(data);
31-
proxyDataRaw = JSON.parse(decoded) as ProxyData;
30+
const decoded = decodeURIComponent(data)
31+
proxyDataRaw = JSON.parse(decoded) as ProxyData
3232
} catch (error) {
3333
return reply.code(400).send({
3434
error: {
3535
code: 'INVALID_PARAMETER',
3636
message: 'Invalid data parameter format',
3737
},
3838
traceId: request.id,
39-
});
39+
})
4040
}
4141

4242
// Inject request headers
@@ -48,20 +48,17 @@ export class ProxyController {
4848
// Forward range headers from client request
4949
...(request.headers.range && { range: request.headers.range }),
5050
...(request.headers.Range && { Range: request.headers.Range }),
51-
}
52-
};
51+
},
52+
}
5353

5454
// Re-encode with enhanced data
55-
const enhancedData = encodeURIComponent(JSON.stringify(proxyData));
55+
const enhancedData = encodeURIComponent(JSON.stringify(proxyData))
5656

57-
const response = await this.proxyService.proxyRequest(enhancedData);
57+
const response = await this.proxyService.proxyRequest(enhancedData)
5858

5959
// Handle streaming response
6060
if (isStreamingResponse(response)) {
61-
reply
62-
.code(response.statusCode)
63-
.headers(response.headers)
64-
.type(response.contentType)
61+
reply.code(response.statusCode).headers(response.headers).type(response.contentType)
6562

6663
return reply.send(response.stream)
6764
}

src/core/server.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,16 @@ export class OMSSServer {
102102
*/
103103
private setupMiddleware(customCorsOptions?: FastifyCorsOptions): void {
104104
// CORS
105-
this.app.register(cors, customCorsOptions || {
106-
origin: '*',
107-
methods: ['GET', 'OPTIONS', 'HEAD'],
108-
allowedHeaders: ['Content-Type', 'Authorization', 'Range', 'Accept'],
109-
exposedHeaders: ['Content-Length', 'Content-Type', 'Content-Range', 'Accept-Ranges'],
110-
credentials: false
111-
})
105+
this.app.register(
106+
cors,
107+
customCorsOptions || {
108+
origin: '*',
109+
methods: ['GET', 'OPTIONS', 'HEAD'],
110+
allowedHeaders: ['Content-Type', 'Authorization', 'Range', 'Accept'],
111+
exposedHeaders: ['Content-Length', 'Content-Type', 'Content-Range', 'Accept-Ranges'],
112+
credentials: false,
113+
}
114+
)
112115

113116
// Request logging
114117
this.app.addHook('onRequest', requestLogger)

src/core/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export interface OMSSConfig {
1515
cacheTTL?: number
1616
}
1717
proxyConfig?: {
18-
knownThirdPartyProxies: Record<string, RegExp[]>;
19-
streamPatterns: RegExp[];
20-
};
18+
knownThirdPartyProxies: Record<string, RegExp[]>
19+
streamPatterns: RegExp[]
20+
}
2121
note?: string
2222
cors?: FastifyCorsOptions
2323
}

src/providers/base-provider.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ export abstract class BaseProvider {
114114
BaseProvider.proxyConfig = config
115115
}
116116

117-
118117
static setGlobalProxyConfig(config: NonNullable<OMSSConfig['proxyConfig']>): void {
119118
BaseProvider.globalProxyConfig = config
120119
}

src/services/proxy.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export class ProxyService {
225225
const TEXT_BASED_MIME_REGEX = /^(text\/.*|application\/(.*\+xml|.*\+json|json|xml|javascript|yaml|x-yaml|x-www-form-urlencoded))(;.*)?$/i
226226
const isTextLike = TEXT_BASED_MIME_REGEX.test(contentType)
227227

228-
return isTextLike || (/application\/(vnd\.apple\.mpegurl|x-mpegurl|dash\+xml)/i.test(contentType) || /\.m3u8(\?.*)?$/.test(url) || /\.mpd(\?.*)?$/.test(url))
228+
return isTextLike || /application\/(vnd\.apple\.mpegurl|x-mpegurl|dash\+xml)/i.test(contentType) || /\.m3u8(\?.*)?$/.test(url) || /\.mpd(\?.*)?$/.test(url)
229229
}
230230

231231
/**

0 commit comments

Comments
 (0)