mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-04-21 01:41:54 +02:00
use url instead
This commit is contained in:
parent
bb666b5e1a
commit
4e88147058
1 changed files with 10 additions and 2 deletions
|
@ -31,7 +31,7 @@ let rawdata = fs.readFileSync(usersFolderPath + 'users.json');
|
|||
let users = JSON.parse(rawdata);
|
||||
let userDict = {}
|
||||
for (var i in users) {
|
||||
userDict[users[i].title.replaceAll("/", "-")] = true;
|
||||
userDict[parseDirname(users[i])] = true;
|
||||
}
|
||||
|
||||
const files = fs.readdirSync(usersFolderPath);
|
||||
|
@ -54,6 +54,14 @@ for (file in files) {
|
|||
|
||||
var cache = {};
|
||||
|
||||
function parseDirname(user) {
|
||||
return user.url
|
||||
.split("//")
|
||||
.at(1) // take everything after protocol
|
||||
.replaceAll('/', '-') // and replace every slash with hyphen
|
||||
.replace(/-$/, ''); // and remove the trailing hyphen if there is one
|
||||
}
|
||||
|
||||
async function convert(text, from, to) {
|
||||
var options = {
|
||||
from: from,
|
||||
|
@ -121,7 +129,7 @@ puppeteer
|
|||
layoutBackgroundHeaderSpace: false\n\
|
||||
\r---\n";
|
||||
|
||||
var dir = usersFolderPath + users[i].url.split("//").at(1).replaceAll('/', '');
|
||||
var dir = usersFolderPath + parseDirname(users[i]);
|
||||
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir);
|
||||
|
|
Loading…
Add table
Reference in a new issue