[Feat] Local images building

This commit is contained in:
Ducko 2021-06-24 14:00:00 +01:00 committed by Alyxia Sother
parent 4adf688ee8
commit 0300abe06e
No known key found for this signature in database
GPG Key ID: 355968D14144B739
4 changed files with 316 additions and 0 deletions

1
dist/.gitkeep vendored
View File

@ -0,0 +1 @@

45
src/imageCdn.js Normal file
View File

@ -0,0 +1,45 @@
import { createWriteStream, mkdirSync, copyFileSync, rmSync } from 'fs';
import { join } from 'path';
import { exec } from 'child_process';
import axios from 'axios';
export default (manifest) => {
return manifest.images ? Promise.all(manifest.images.map(async (x, i) => {
const baseDir = join(distDir, 'img', manifest.name);
const rawFile = join(baseDir, x.split('/').pop());
const rawExt = rawFile.split('.').pop();
const finalName = `${i}.${rawExt === 'gif' ? 'gif' : 'png'}`;
const finalFile = join(baseDir, finalName);
mkdirSync(baseDir, { recursive: true });
console.log(x, i, rawFile, finalFile);
const writer = createWriteStream(rawFile);
const resp = await axios.get(x, {
responseType: 'stream'
});
resp.data.pipe(writer);
await new Promise((res, rej) => {
writer.on('finish', res);
writer.on('error', rej);
});
if (rawExt !== 'gif') {
await new Promise((res) => exec(`convert "${rawFile}" -resize x720 -quality 90 "${finalFile}"`, res));
} else {
copyFileSync(rawFile, finalFile);
}
try {
rmSync(rawFile);
} catch (e) { }
return `/img/${manifest.name}/${finalName}`;
})) : [];
};

View File

@ -1,6 +1,10 @@
import ModuleRepos from './modules/index.js';
import AutoTag from './autoTag.js';
<<<<<<< HEAD
import WebhookSend from './webhook.js';
=======
import ImageCDN from './imageCdn.js';
>>>>>>> 606a100 ([Feat] Local images building)
import Parcel from 'parcel-bundler';
import axios from 'axios';
@ -27,6 +31,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
const clonesDir = `${__dirname.replace('/src', '')}/clones`;
const distDir = `${__dirname.replace('/src', '')}/dist`;
global.distDir = distDir;
const modulesDir = `${distDir}/module`;
@ -217,6 +222,8 @@ for (const parentRepo of ModuleRepos) {
if (manifest.images) manifestJson.images = manifest.images;
if (manifest.dependencies) manifestJson.dependencies = manifest.dependencies;
manifestJson.images = await ImageCDN(manifestJson);
moduleJson.modules.push(manifestJson);

View File

@ -7,7 +7,270 @@ export default [
['keanuplayz/usrbg', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['717352467280691331']
}],
<<<<<<< HEAD
['lexisother/dotfiles-discord-theme', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['465702500146610176', '364720702252908544']
}]
];
=======
['j0lol/i-fixed-discord', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['363437829507776513']
}],
['Discord-Theme-Addons/bottom-bar', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['399416615742996480'],
images: ['https://raw.githubusercontent.com/Discord-Theme-Addons/bottom-bar/default/screenshots/preview.png']
}],
['Discord-Theme-Addons/gradientbuttons-v2', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['399416615742996480'],
images: [
'https://raw.githubusercontent.com/Discord-Theme-Addons/gradientbuttons-v2/main/screenshots/message-menu.gif',
'https://raw.githubusercontent.com/Discord-Theme-Addons/gradientbuttons-v2/main/screenshots/server-menu.gif',
'https://raw.githubusercontent.com/Discord-Theme-Addons/gradientbuttons-v2/main/screenshots/statuspicker-menu.gif'
]
}],
['Discord-Theme-Addons/modern-channel-indicators', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['399416615742996480'],
images: ['https://raw.githubusercontent.com/Discord-Theme-Addons/modern-channel-indicators/main/screenshots/preview.png']
}],
['doggybootsy/NsfwSfwTags', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['515780151791976453'],
images: ['https://i.imgur.com/SCObryS.png']
}],
['doggybootsy/bubblecord', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['515780151791976453'],
images: [
'https://raw.githubusercontent.com/doggybootsy/bubblecord/main/screenshots/1.png',
'https://raw.githubusercontent.com/doggybootsy/bubblecord/main/screenshots/2.png',
'https://raw.githubusercontent.com/doggybootsy/bubblecord/main/screenshots/3.png',
'https://raw.githubusercontent.com/doggybootsy/bubblecord/main/screenshots/4.png',
'https://raw.githubusercontent.com/doggybootsy/bubblecord/main/screenshots/5.png',
'https://raw.githubusercontent.com/doggybootsy/bubblecord/main/screenshots/6.png',
'https://raw.githubusercontent.com/doggybootsy/bubblecord/main/screenshots/7.png'
]
}],
['doggybootsy/Mobile_Messages', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['515780151791976453'],
images: ['https://i.imgur.com/VBE49wL.png']
}],
['Fahrenheit/Semi-Stock-Discord', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['239824092239233024'],
images: ['https://raw.githubusercontent.com/Fahrenheit/Semi-Stock-Discord/main/Windows%20Preview.png']
}],
['Freeplayg/Discord-TeardropMessages', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['158296466119458816'],
images: ['https://media.discordapp.net/attachments/755005710323941386/811325025025785886/2021-02-16_14-51.png']
}],
['BrendanWalter/Nebula4', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['597072695875600385'],
images: ['https://i.imgur.com/vcoREaX.png']
}],
['cainy-a/LunaCord', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['435026627907420161']
}],
['yellowsink/SmolCord', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['435026627907420161']
}],
['yellowsink/Diskai', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['435026627907420161'],
images: ['https://raw.githubusercontent.com/cainy-a/Diskai/master/screenshots/User%20Settings.png', 'https://raw.githubusercontent.com/cainy-a/Diskai/master/screenshots/Voice%20Settings.png']
}],
['Awish-Senpai/ForgottenKeep', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['671355502399193128'],
images: ['https://i.imgur.com/VEyRqDR.png', 'https://i.imgur.com/wQ4wqeh.gif', 'https://i.imgur.com/URYSqL5.gif']
}],
['leeprky/Slook', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['224524143482241035'],
images: [
'https://raw.githubusercontent.com/leeprky/slook_theme/main/previews/dark1.jpg',
'https://raw.githubusercontent.com/leeprky/slook_theme/main/previews/dark2.jpg',
'https://raw.githubusercontent.com/leeprky/slook_theme/main/previews/dark3.png',
'https://raw.githubusercontent.com/leeprky/slook_theme/main/previews/dark4.jpg',
'https://raw.githubusercontent.com/leeprky/slook_theme/main/previews/light1.jpg',
'https://raw.githubusercontent.com/leeprky/slook_theme/main/previews/light2.jpg',
'https://raw.githubusercontent.com/leeprky/slook_theme/main/previews/light3.png',
'https://raw.githubusercontent.com/leeprky/slook_theme/main/previews/light4.jpg'
]
}],
['sneexy-boi/material-cord', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['468894601542107146', '452289159399342090'],
images: ['https://raw.githubusercontent.com/sneexy-boi/material-cord/main/docs/screenshot.png']
}],
['leeprky/Naive', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['224524143482241035'],
images: ['https://raw.githubusercontent.com/leeprky/Naive/main/previews/cherry-glasscord.jpg']
}],
['LuckFire/midnight-mars', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["399416615742996480"],
images: []
}],
['LuckFire/amoled-cord', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["399416615742996480"],
images: ['https://raw.githubusercontent.com/LuckFire/amoled-cord/main/screenshots/main-preview.png']
}],
['Freeplayg/discord-serverlist-drawer', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["158296466119458816"],
images: ["https://codeberg.org/Freeplay/UserStyles/raw/branch/main/images/discord_serverlist-drawer-1.png"]
}],
['Freeplayg/discord-AnotherSidebar', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["158296466119458816"],
images: ["https://i.imgur.com/J95Re46.png"]
}],
['LuckFire/Discord-Revamp', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['399416615742996480'],
images: ['https://raw.githubusercontent.com/LuckFire/discord-revamp/master/screenshots/preview.png']
}],
['Awish-Senpai/Evernight', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["671355502399193128"],
images: ["https://i.imgur.com/5eF3dAE.png","https://i.imgur.com/yD7IAEe.png","https://i.imgur.com/bEgMxYm.png"]
}],
['spinfish/kaleidoscope', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["574870314928832533"],
images: ["https://cdn.discordapp.com/attachments/715106442406920273/835786520216338452/kaleidoscope_preview_one.png","https://cdn.discordapp.com/attachments/715106442406920273/835786531616063538/kaleidoscope_preview_two.png","https://cdn.discordapp.com/attachments/715106442406920273/835786526864441344/kaleidoscope_preview_three.png"]
}],
['leeprky/Lode', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["224524143482241035"],
images: ["https://raw.githubusercontent.com/leeprky/Lode/main/default/images/LodeTheme.png"]
}],
['spinfish/midnight-candy-powercord', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["574870314928832533"],
images: ["https://media.discordapp.net/attachments/678012423067926539/837311603954941962/midnight_candy_main_preview.png","https://media.discordapp.net/attachments/678012423067926539/837312429749829713/midnight_candy_preview_two.png","https://media.discordapp.net/attachments/678012423067926539/837312453544902706/midnight_candy_preview_three.png"]
}],
['NYRI4/LilyPichu', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["265924886461939712"],
images: ["https://nyri4.github.io/LilyPichu/assets/capture.png"]
}],
['NYRI4/Discolored', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["265924886461939712"],
images: ["https://nyri4.github.io/Discolored/assets/screenshot.png"]
}],
['DiscordStyles/DarkMatter', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["254362351170617345"],
images: ["https://i.imgur.com/xSG96qa.png"]
}, true],
['Goose-Nest/GT-RevertRebrand', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["506482395269169153"],
images: ['https://raw.githubusercontent.com/Goose-Nest/GT-RevertRebrand/main/screenshots/message_revert.png']
}],
['Goose-Nest/GT-VSCHighContrast', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["506482395269169153"],
images: []
}],
['doggybootsy/Dribbblish', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["515780151791976453"],
images: ["https://media.discordapp.net/attachments/755005710323941386/842483963900723200/Screen_Shot_2021-05-13_at_12.29.50_PM.png"]
}],
['leeprky/Quarrel', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["224524143482241035"],
images: ["https://i.imgur.com/6bvkEoD.png"]
}],
['Discord-Theme-Addons/refined-user-connections', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['399416615742996480'],
images: ['https://raw.githubusercontent.com/Discord-Theme-Addons/refined-user-connections/main/screenshots/preview.png']
}],
['Discord-Theme-Addons/compact-userarea', '', '/powercord_manifest.json', 'pcTheme', {
authors: ['399416615742996480'],
images: ['https://raw.githubusercontent.com/Discord-Theme-Addons/compact-userarea/main/screenshots/preview.png']
}],
['4n4hits/ForestFrost', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["812815155288473630"],
images: ["https://i.vgy.me/k2KPcP.png"]
}],
['kreat0/the-nightowl', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["647480386577760256"],
images: ["https://raw.githubusercontent.com/kreat0/the-nightowl/master/assets/screenshot.png"]
}],
['kixt0/shuttle', '', '/manifest.json', 'pcTheme', {
authors: ["452289159399342090"],
images: ["https://raw.githubusercontent.com/kixt0/shuttle/main/docs/screenshot.png"]
}],
['mr-miner1/Better-Badges', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["678541597654253600"],
images: ["https://i.imgur.com/0Fkk8TL.gif"]
}],
['schnensch0/zelk', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["652801938374656013"],
images: ["https://raw.githubusercontent.com/schnensch0/zelk/main/preview/chat.png","https://raw.githubusercontent.com/schnensch0/zelk/main/preview/profile.png","https://raw.githubusercontent.com/schnensch0/zelk/main/preview/settings.png"]
}],
['NYRI4/Couve', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["264062457448759296","265924886461939712"],
images: ["https://cdn.discordapp.com/attachments/539180316447997974/725737819015872562/unknown.png"]
}],
['PhoenixAceVFX/Aroma-White', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["461440763042201620"],
images: ["https://raw.githubusercontent.com/PhoenixAceVFX/Aroma-White/main/BDx3p2gh.png"]
}],
['XYZenix/DTM-08', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["211270674482724864"],
images: ["https://cdn.discordapp.com/attachments/733624227378495488/839835186211717120/unknown.png"]
}],
['XYZenix/DTM-16', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["211270674482724864"],
images: ["https://media.discordapp.net/attachments/755005710323941386/771068422079250432/unknown.png"]
}],
['leeprky/Ovel', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["224524143482241035"],
images: ["https://media.discordapp.net/attachments/828218219927306261/853635731581960192/Ovel_v1.0.0.png","https://i.imgur.com/3BMUuND.png","https://i.imgur.com/csW8EoK.png","https://i.imgur.com/Otv0JjS.png"]
}],
['CorellanStoma/CreArts', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["288362986991648778"],
images: ["https://user-images.githubusercontent.com/58918358/122546272-14722f80-d02f-11eb-9025-f6f351d24fbe.png","https://user-images.githubusercontent.com/58918358/122546285-16d48980-d02f-11eb-86a7-0eee638561d3.png"]
}],
['mr-miner1/Deep-Dark', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["678541597654253600"],
images: ["https://i.imgur.com/erTtLUi.gif"]
}],
['PrincessAkira/Green-Akali', '', '/powercord_manifest.json', 'pcTheme', {
authors: ["202740603790819328"],
images: ["https://host.snens.team/i/FcLwBnjmIqWo.png","https://host.snens.team/i/5EdBAjhcNzmk.png"]
}],
];
>>>>>>> 606a100 ([Feat] Local images building)