aboutsummaryrefslogtreecommitdiff
path: root/communities/red-right-hand/174bg.net/public/terminal/index.html
blob: 64014dfd8c34ea1fa8b94240d1a88f103583a858 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link
      rel="icon"
      type="image/png"
      href="https://media.starcitizen.tools/6/61/UEEtrans.png"
    />
    <style>
      /* set terminal styles */
      :root {
        --terminal-bg-color: #0f2c3e;
        --terminal-fg-color: #54adf7;
        --terminal-font: monospace;
        --terminal-accent-color: white;
        --terminal-error-color: #ff4c4c;
      }

      /* remove body margin and padding */
      body {
        margin: 0;
        padding: 0;
      }

      /* terminal effect */
      body::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: radial-gradient(
          circle at center,
          rgba(255, 255, 255, 0.1) 0%,
          rgba(255, 255, 255, 0) 70%
        );
        pointer-events: none;
        animation: flicker 3s infinite;
      }

      @keyframes flicker {
        0%,
        100% {
          opacity: 0.1;
        }
        50% {
          opacity: 0.2;
        }
      }

      /* add some scan lines */
      body::after {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: repeating-linear-gradient(
          to bottom,
          rgba(255, 255, 255, 0.05),
          rgba(255, 255, 255, 0.05) 1px,
          rgba(255, 255, 255, 0) 1px,
          rgba(255, 255, 255, 0) 2px
        );
        pointer-events: none;
      }
    </style>
  </head>
  <body>
    <script type="module">
      import { initTerminal } from "https://esm.sh/ttty/";

      document.addEventListener("DOMContentLoaded", async () => {
        let secureShell = window.location.hash === "#secure" ? true : false;

        const fingerprint = btoa(navigator.userAgent)
          .replace(/[^a-zA-Z0-9]/g, "")
          .slice(-4)
          .toLowerCase();
        const userId = `user_${fingerprint}`;

        let hostId = `public.174bg.uee`;

        let commonCommands = {
          vitepress: {
            name: "vitepress",
            description: "visit the 174th Battle Group's documentation",
            func: async () => {
              window.open(
                "https://vitepress.red-right-hand.unnamed.group",
                "_blank",
                "noopener noreferrer",
              );
            },
          },
        };

        let commands = {
          ...commonCommands,
          about: {
            name: "about",
            description: "learn more about the 174th Battle Group",
            func: async ({ print, type }) => {
              print("<br>");

              await type(
                "The 174th Battle Group is a logistical support unit of the United Earth Empire's military. It is responsible for providing logistical support to the UEE's forces, including transportation, supply, and maintenance. The 174th Battle Group is known for its efficiency and reliability, and it has played a crucial role in many of the UEE's military campaigns.",
                10,
              );

              print("<br>");
            },
          },
          elevate: {
            name: "elevate",
            description:
              "elevate your security clearance using the credentials you were given by your contact",
            func: async ({ print, start, type }) => {
              start();

              print("<br>");

              await type("Please wait while we verify your credentials...", 10);

              await type("Credentials verified.", 10);
              await type("Your security clearance has been elevated.", 10);

              await type("Redirecting you to a secure shell...", 100);

              window.location.href = "#secure";
              window.location.reload();

              print("<br>");
            },
          },
        };

        if (secureShell) {
          hostId = `secure.rrr.uee`;

          commands = {
            ...commonCommands,
            about: {
              name: "about",
              description: "learn more about the Red Right Hand",
              func: async ({ print, type }) => {
                print("<br>");

                type(
                  "The Red Right Hand is a classified organization within the United Earth Empire. It is responsible for carrying out covert operations and intelligence gathering for the UEE when the situation calls for discretion to avoid diplomatic incidents. The Red Right Hand operates as a decentralized network of self-sufficient cells to minimize the risk of infiltration and compromise. The organization is known for its ruthless efficiency and its willingness to do whatever it takes to achieve its objectives, including assassination, sabotage, and espionage.",
                  10,
                );

                print("<br>");
              },
            },
            join: {
              name: "join",
              description: "join the Red Right Hand as an operative",
              func: async ({ print, type }) => {
                print("<br>");

                await type(
                  "To join the Red Right Hand, you must first connect to our communication platform by following this link:",
                  10,
                );

                print(
                  "<br><a href='https://discord.gg/RGgSfVj4DD' target='_blank'>https://discord.gg/RGgSfVj4DD</a><br><br>",
                );

                await type(
                  "Once you have joined the server, fill out the application form and wait for a response from one of our recruiters. We look forward to having you on board.",
                  10,
                );

                print("<br>");
              },
            },
          };

          // change terminal to red
          document.documentElement.style.setProperty(
            "--terminal-bg-color",
            "#2c0000",
          );

          document.documentElement.style.setProperty(
            "--terminal-fg-color",
            "#ff4c4c",
          );
        }

        initTerminal({
          host: document.querySelector("body"),
          prompt: `${userId}@${hostId}# `,
          welcomeMessage: [
            `Starting network daemons:.`,
            `<br>`,
            `Starting local daemons:.`,
            `<br>`,
            `${new Date().toUTCString()} - Network connection established.`,
            `<br><br>`,
            `UEEOS v5.4 (c) 2792 United Earth Empire. All rights reserved.`,
            `<br><br>`,
            `login: ${userId}`,
            `<br>`,
            `password: ********`,
            `<br><br>`,
            `Welcome to UEEOS: The United Earth Empire's Terminal Operating System.`,
            `<br><br>`,
            `Type 'help' to see a list of available commands.`,
            `<br><br>`,
          ].join(""),
          commands,
        });

        // focus the terminal
        setInterval(() => {
          const terminalInput = document.querySelector(".terminal-type input");
          if (terminalInput !== document.activeElement) terminalInput.focus();
        }, 100);

        // set document title
        document.title = `${userId}@${hostId}`;
      });

      // play a sound on key press
      document.addEventListener("keydown", (e) => {
        // only play sound for character keys
        if (e.key.length !== 1) return;

        // create audio context
        const audioContext = new AudioContext();

        // create oscillator
        const oscillator = audioContext.createOscillator();
        oscillator.type = "square";
        oscillator.frequency.setValueAtTime(
          // 100 - 150
          100 + Math.random() * 50,
          audioContext.currentTime,
        );

        // create gain node
        const gainNode = audioContext.createGain();
        gainNode.gain.setValueAtTime(0.1, audioContext.currentTime);

        // connect nodes
        oscillator.connect(gainNode);
        gainNode.connect(audioContext.destination);

        // start oscillator
        oscillator.start();

        // stop oscillator after 50ms
        setTimeout(() => {
          oscillator.stop();
        }, 50);
      });
    </script>
  </body>
</html>