Skip to content

Commit

Permalink
Fix to Readdirp handling after migration to v.4.0
Browse files Browse the repository at this point in the history
Fix to Readdirp handling after migration to v4.0:
- let {readdirp} = require('readdirp');
- var localfiles = await new Promise((resolve, reject) => {  ... }
Workflows added

Signed-off-by: Milosz Linkiewicz <[email protected]>
  • Loading branch information
Mionsz committed Sep 24, 2024
1 parent ebc001a commit b1e06ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
11 changes: 9 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var http = require('http').Server(app);
var io = require('socket.io')(http, {path: baseurl + 'socket.io'});
var isBinaryFile = require("isbinaryfile").isBinaryFile;
var path = require('path');
var readdirp = require('readdirp');
let {readdirp} = require('readdirp');
var fetch = require('node-fetch');
var si = require('systeminformation');
const util = require('util');
Expand Down Expand Up @@ -182,7 +182,14 @@ io.on('connection', function(socket){
var remotemenuversion = fs.readFileSync('/config/menuversion.txt', 'utf8');
var endpointsfile = fs.readFileSync('/config/endpoints.yml');
var endpoints = yaml.load(endpointsfile);
var localfiles = await readdirp.promise('/assets/.');
// Wrap readdirp in a promise
var localfiles = await new Promise((resolve, reject) => {
const entries = [];
readdirp('/assets/.')
.on('data', (entry) => entries.push(entry))
.on('end', () => resolve(entries))
.on('error', (error) => reject(error));
});
var assets = [];
if (localfiles.length != 0){
for (var i in localfiles){
Expand Down
11 changes: 0 additions & 11 deletions root/defaults/default
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@ server {
listen ${NGINX_PORT};
location / {
root /assets;
try_files $uri $uri/ @github;
autoindex on;
}

location @github {
rewrite ^ /netbootxyz$uri break;

proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;

proxy_pass https://github.com;
}
}

0 comments on commit b1e06ab

Please sign in to comment.