Skip to content

Commit

Permalink
fix scanner not using self signed certs
Browse files Browse the repository at this point in the history
  • Loading branch information
IrosTheBeggar committed Sep 3, 2024
1 parent 7403afa commit 6c3c753
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/db/scanner.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import mime from 'mime-types';
import axios from 'axios';
import https from 'https';

axios.create({
const ax = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false
})
Expand Down Expand Up @@ -66,7 +66,7 @@ async function insertEntries(song) {

if (song.genre) { data.genre = song.genre };

await axios({
await ax({
method: 'POST',
url: `http${loadJson.isHttps === true ? 's': ''}://localhost:${loadJson.port}/api/v1/scanner/add-file`,
headers: { 'accept': 'application/json', 'x-access-token': loadJson.token },
Expand All @@ -80,7 +80,7 @@ async function run() {
try {
await recursiveScan(loadJson.directory);

await axios({
await ax({
method: 'POST',
url: `http${loadJson.isHttps === true ? 's': ''}://localhost:${loadJson.port}/api/v1/scanner/finish-scan`,
headers: { 'accept': 'application/json', 'x-access-token': loadJson.token },
Expand Down Expand Up @@ -121,7 +121,7 @@ async function recursiveScan(dir) {
continue;
}

const dbFileInfo = await axios({
const dbFileInfo = await ax({
method: 'POST',
url: `http${loadJson.isHttps === true ? 's': ''}://localhost:${loadJson.port}/api/v1/scanner/get-file`,
headers: { 'accept': 'application/json', 'x-access-token': loadJson.token },
Expand Down

0 comments on commit 6c3c753

Please sign in to comment.