@irfanshadikrishad/anilist 2.0.0-forbidden.0 → 2.0.0-forbidden.1
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.
- package/README.md +9 -0
- package/bin/helpers/auth.js +19 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -268,4 +268,13 @@ Since you are creating your own API client for login no else else can get your c
|
|
|
268
268
|
|
|
269
269
|
Want to contribute to the project? Check out complete guideline [here](CONTRIBUTING.md).
|
|
270
270
|
|
|
271
|
+
#### Publish
|
|
272
|
+
|
|
273
|
+
• Bump the version (since you have real changes since 2.0.0-forbidden was published, you can't republish that exact version):
|
|
274
|
+
`npm version prerelease --preid=forbidden --no-git-tag-version`
|
|
275
|
+
This takes 2.0.0-forbidden → 2.0.0-forbidden.0, matching the pattern of past releases (1.1.0-forbidden.0, .7, etc.).
|
|
276
|
+
• Build: `npm run build`
|
|
277
|
+
• Publish under the forbidden tag, not latest:
|
|
278
|
+
`npm publish --tag forbidden`
|
|
279
|
+
|
|
271
280
|
#### _Thanks for visiting 💙_
|
package/bin/helpers/auth.js
CHANGED
|
@@ -984,17 +984,32 @@ class Social {
|
|
|
984
984
|
});
|
|
985
985
|
});
|
|
986
986
|
spinner.stop(`Fetched ${allFollowingUsers.length} following user(s). Checking their last activity...`);
|
|
987
|
-
const
|
|
987
|
+
const inactivityWindow = months * 30 * 24 * 60 * 60;
|
|
988
|
+
const cutoff = Math.floor(Date.now() / 1000) - inactivityWindow;
|
|
989
|
+
// Users active within this many seconds *after* the cutoff are "almost"
|
|
990
|
+
// stale (within 20% of the inactivity window) and get a soft warning.
|
|
991
|
+
const nearCutoff = cutoff + inactivityWindow * 0.2;
|
|
988
992
|
const staleUsers = [];
|
|
993
|
+
// Fixed-width columns so rows line up regardless of name/index length
|
|
994
|
+
const maxIndexLength = `[${allFollowingUsers.length}/${allFollowingUsers.length}]`.length;
|
|
995
|
+
const maxNameLength = Math.max(...allFollowingUsers.map(({ name }) => name.length));
|
|
989
996
|
let checked = 0;
|
|
990
997
|
for (const user of allFollowingUsers) {
|
|
991
998
|
checked++;
|
|
992
999
|
const activityResponse = yield fetcher(specificUserActivitiesQuery, { userId: user.id, page: 1, perPage: 1 });
|
|
993
1000
|
const lastActiveAt = (_d = (_c = (_b = (_a = activityResponse === null || activityResponse === void 0 ? void 0 : activityResponse.data) === null || _a === void 0 ? void 0 : _a.Page) === null || _b === void 0 ? void 0 : _b.activities) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.createdAt;
|
|
994
|
-
|
|
1001
|
+
const isStale = !lastActiveAt || lastActiveAt < cutoff;
|
|
1002
|
+
const isNearStale = !isStale && lastActiveAt < nearCutoff;
|
|
1003
|
+
const activityLabel = lastActiveAt
|
|
995
1004
|
? timestampToTimeAgo(lastActiveAt)
|
|
996
|
-
: 'no activity found'
|
|
997
|
-
|
|
1005
|
+
: 'no activity found';
|
|
1006
|
+
const coloredActivityLabel = isStale
|
|
1007
|
+
? colorize.Red(activityLabel)
|
|
1008
|
+
: isNearStale
|
|
1009
|
+
? colorize.Yellow(activityLabel)
|
|
1010
|
+
: activityLabel;
|
|
1011
|
+
responsiveOutput(`${`[${checked}/${allFollowingUsers.length}]`.padEnd(maxIndexLength)}\t${user.name.padEnd(maxNameLength)}\t${coloredActivityLabel}`);
|
|
1012
|
+
if (isStale) {
|
|
998
1013
|
staleUsers.push({ id: user.id, name: user.name });
|
|
999
1014
|
}
|
|
1000
1015
|
// avoiding rate-limit
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@irfanshadikrishad/anilist",
|
|
3
3
|
"description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
|
|
4
4
|
"author": "Irfan Shadik Rishad",
|
|
5
|
-
"version": "2.0.0-forbidden.
|
|
5
|
+
"version": "2.0.0-forbidden.1",
|
|
6
6
|
"main": "./bin/index.js",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"types": "./bin/index.d.ts",
|