diff --git a/README.md b/README.md index 1965978..5494093 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Head to [the release page](https://git.mylloon.fr/Anri/dsr/releases/latest). - [x] Support drag&drop - [x] Keep the video under 25mb (discord limitation) - [x] If already under the limit, the file won't be compressed + - [x] Nitro suppport via `/nitro` flag - [x] Merge all audio files into one track, while keeping the original ones (keeping track's title too) - [x] Support multiples files diff --git a/src/scripts/renderer.ts b/src/scripts/renderer.ts index 7119760..b3ab544 100644 --- a/src/scripts/renderer.ts +++ b/src/scripts/renderer.ts @@ -17,9 +17,12 @@ let internals: { /** Search for files */ const getFiles = async () => { const allowedExtensions = (await internals.allowedExtensions()).extensions; - const argv = await internals.argv(); - if (argv.length >= 2) { - const files = argv.slice(1); + const argvFiles = (await internals.argv()) + .slice(1) + .filter((element) => !element.startsWith("/")); + + if (argvFiles.length > 0) { + const files = argvFiles; // Exit if a file isn't supported in the list if ( @@ -40,6 +43,18 @@ const getFiles = async () => { return files; }; +/** Returns maximum allowed size for files in MB */ +const fetchMaxSize = async () => { + const argv = await internals.argv(); + if (argv.includes("/nitro")) { + // Nitro user + return 500; + } + + // Free user + return 25; +}; + /** Either replace the message, or add some info */ enum Mode { Write, @@ -71,7 +86,7 @@ const updateMessage = ( /** Main function */ const main = async () => { - const maxSizeDiscord = 25; + const maxSizeDiscord = await fetchMaxSize(); updateMessage("Récupération des fichiers..."); const files = await getFiles(); let processedFiles = "";