mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-20 03:33:20 +03:00
API key is now passed as a query param
This commit is contained in:
@@ -1246,9 +1246,9 @@ app.use(function(req, res, next) {
|
|||||||
app.use(function(req, res, next) {
|
app.use(function(req, res, next) {
|
||||||
if (!req.path.includes('/api/')) {
|
if (!req.path.includes('/api/')) {
|
||||||
next();
|
next();
|
||||||
} else if (req.headers.authorization === admin_token) {
|
} else if (req.query.apiKey === admin_token) {
|
||||||
next();
|
next();
|
||||||
} else if (req.headers.authorization && config_api.getConfigItem('ytdl_use_api_key') && req.headers.authorization === config_api.getConfigItem('ytdl_api_key')) {
|
} else if (req.query.apiKey && config_api.getConfigItem('ytdl_use_api_key') && req.query.apiKey === config_api.getConfigItem('ytdl_api_key')) {
|
||||||
next();
|
next();
|
||||||
} else if (req.path.includes('/api/video/') || req.path.includes('/api/audio/')) {
|
} else if (req.path.includes('/api/video/') || req.path.includes('/api/audio/')) {
|
||||||
next();
|
next();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {Injectable, isDevMode, Inject} from '@angular/core';
|
import {Injectable, isDevMode, Inject} from '@angular/core';
|
||||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
import 'rxjs/add/operator/map';
|
import 'rxjs/add/operator/map';
|
||||||
import 'rxjs/add/operator/map';
|
import 'rxjs/add/operator/map';
|
||||||
import 'rxjs/add/operator/catch';
|
import 'rxjs/add/operator/catch';
|
||||||
@@ -36,8 +36,8 @@ export class PostsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.httpOptions = {
|
this.httpOptions = {
|
||||||
headers: new HttpHeaders({
|
params: new HttpParams({
|
||||||
'Authorization': '4241b401-7236-493e-92b5-b72696b9d853'
|
fromString: `apiKey=${this.auth_token}`
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user