discord remote | express automation routes | client input remote code | Search

The HTML document has a standard structure with a <head> for metadata and external links, and a <body> for content, and is secured by a Content Security Policy (CSP) that specifies allowed sources for content execution. The CSS styles define the layout and appearance of the HTML elements, applying various properties to elements such as .container, .livedev, and specific HTML tags like h1, h2, img, and iframe.

Run example

npm run import -- "remote desktop client"

remote desktop client

<html>
<head>
  <meta http-equiv="Content-Security-Policy" content="default-src *;
   img-src * 'self' data: https:; script-src 'self' 'unsafe-inline' 'unsafe-eval' *;
   style-src  'self' 'unsafe-inline' *" />
  <style type="text/css">
    html, body {
      padding: 0;
      margin: 0;
      background: rgb(51, 51, 68);
      color: white;
      font-family: Verdana, Geneva, Tahoma, sans-serif;
    }
    
    h1,
    h2,
    h3 {
      color: white;
      padding: 10px;
      margin: 0;
    }
    
    div.container {
      /*min-height: 1080px;*/
      min-width: 3840px;
      width: auto;
      padding: 20mm 16mm;
      background: #222;
      box-shadow: rgb(0 0 0 / 50%) 2px 3px 10px;
      margin: 20px;
      border-radius: 2px;
      border: 1px solid #666;
      position: relative;
      z-index: 1;
    }
    
    div.livedev {
      position: relative;
      margin: 0 auto;
      max-width: 100%;
      max-height: 460px;
      display:flex;
      padding-bottom: 18.75%;
      position: relative;
    }
    
    div.livedev img {
      width: 33.3%;
      min-width: 33.3%;
      height: 100%;
      position: absolute;
      background-size: 100% contain;
      border: none;
      border-style: none;
      background-repeat: no-repeat;
      left: 0;
    }

    div.livedev img:nth-of-type(2) {
      left: 33.3%;
    }

    div.livedev img:nth-of-type(3) {
      left: 66.6%;
    }
    
    div.livedev p {
      text-align: center;
      padding-bottom: 60%;
    }
    
    div.livedev iframe {
      height: 100%;
      width: 100%;
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      right: 0;
    }

    div.container p {
      display: flex;
      flex-wrap: wrap;
    }

    div.container p input {
      opacity: 0;
      height: 1px;
      width: 1px;
      position: absolute;
      right: 1px;
      bottom: 1px;
    }

    div.container p label,
    div.container p button {
      border: 5px solid transparent;
      border-radius: 10px;
      background: #226;
      position: relative;
      display: inline-block;
      background-clip: padding-box;
      z-index: unset;
      list-style: none;
      text-align: left;
      text-decoration: none;
      color: white;
      min-width: 200px;
      text-align: center;
      cursor: pointer;
      padding: 10px;
      font-size: unset;
    }

    input[id="special-shift"]:checked ~ label[for="special-shift"]
    input[id="special-control"]:checked ~ label[for="special-control"]
    input[id="special-command"]:checked ~ label[for="special-command"]
    input[id="special-alt"]:checked ~ label[for="special-alt"] {
      background-color: white;
      color: #226;
    }

    #sendkeys {
      width: 100%;
    }
    
    
  </style>
</head>
<body>

<div class="container">
  <h1>Live Development</h2>
  <ol class="windows"></ol>
  <div class="livedev">
    <img src="{BASE_URI}monitors/0" />
    <img src="{BASE_URI}monitors/1" />
    <img src="{BASE_URI}monitors/2" />
    <!--<p>
      <script>
        document.write(`<iframe width="560" height="315" allow="autoplay" modestbranding="true" src="https://www.youtube.com/embed/live_stream?channel=UCPaZDuwY1sJOb5l-QHm9mDw&origin=${window.location.origin}&controls=0&rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe>`)
      </script>
    </p>-->
  </div>

  <p>
    <textarea id="sendkeys"></textarea>
    <span>
      <input type="checkbox" id="special-alt" value="alt" />
      <input type="checkbox" id="special-command" value="command" />
      <input type="checkbox" id="special-control" value="control" />
      <input type="checkbox" id="special-shift" value="shift" />
      <button id="special-esc" value="">send</button>
      <button id="special-esc" value="enter">enter</button>
      <button id="special-esc" value="escape">escape</button>
      <button id="special-esc" value="backspace">backspace</button>
      <button id="special-esc" value="delete">delete</button>
      <label for="special-alt">alt</label>
      <label for="special-command">command</label>
      <label for="special-control">control</label>
      <label for="special-shift">shift</label>
    </span>
    <a class="nowButton" target="_blank" href="https://www.youtube.com/channel/UCPaZDuwY1sJOb5l-QHm9mDw">
      My YouTube Channel</a>
  </p>
</div>
</body>
</html>

What the code could have been:

html
<!-- 
  Live Development Page
  ======================

  This HTML page is designed for live development and provides features like
  a live display of multiple monitors, a textarea for sending keyboard events,
  and buttons for sending specific key presses.

-->

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="Content-Security-Policy" content="default-src *;
   img-src *'self' data: https:; script-src'self' 'unsafe-inline' 'unsafe-eval' *;
   style-src 'self' 'unsafe-inline' *" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Live Development</title>
  <style>
    /* Global Styles */
    html, body {
      padding: 0;
      margin: 0;
      background: rgb(51, 51, 68);
      color: white;
      font-family: Verdana, Geneva, Tahoma, sans-serif;
    }

    /* Header Styles */
    h1, h2, h3 {
      color: white;
      padding: 10px;
      margin: 0;
    }

    /* Container Styles */
   .container {
      min-width: 3840px;
      width: auto;
      padding: 20mm 16mm;
      background: #222;
      box-shadow: rgb(0 0 0 / 50%) 2px 3px 10px;
      margin: 20px;
      border-radius: 2px;
      border: 1px solid #666;
      position: relative;
      z-index: 1;
    }

    /* Live Development Styles */
   .livedev {
      position: relative;
      margin: 0 auto;
      max-width: 100%;
      max-height: 460px;
      display: flex;
      padding-bottom: 18.75%;
      position: relative;
    }

   .livedev img {
      width: 33.3%;
      min-width: 33.3%;
      height: 100%;
      position: absolute;
      background-size: 100% contain;
      border: none;
      border-style: none;
      background-repeat: no-repeat;
      left: 0;
    }

   .livedev img:nth-of-type(2) {
      left: 33.3%;
    }

   .livedev img:nth-of-type(3) {
      left: 66.6%;
    }

   .livedev p {
      text-align: center;
      padding-bottom: 60%;
    }

   .livedev iframe {
      height: 100%;
      width: 100%;
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      right: 0;
    }

    /* Form Styles */
   .container p {
      display: flex;
      flex-wrap: wrap;
    }

   .container p input {
      opacity: 0;
      height: 1px;
      width: 1px;
      position: absolute;
      right: 1px;
      bottom: 1px;
    }

   .container p label,.container p button {
      border: 5px solid transparent;
      border-radius: 10px;
      background: #226;
      position: relative;
      display: inline-block;
      background-clip: padding-box;
      z-index: unset;
      list-style: none;
      text-align: left;
      text-decoration: none;
      color: white;
      min-width: 200px;
      text-align: center;
      cursor: pointer;
      padding: 10px;
      font-size: unset;
    }

    /* Key Press Styles */
    /* TODO: Refactor this to use a more efficient method */
    input[type="checkbox"]:checked ~ label {
      background-color: white;
      color: #226;
    }

    #sendkeys {
      width: 100%;
    }

    /* Button Styles */
    button {
      margin: 10px;
    }
  </style>
</head>
<body>

  <div class="container">
    <h1>Live Development</h1>
    <ol class="windows"></ol>
    <div class="livedev">
      <img src="{BASE_URI}monitors/0" />
      <img src="{BASE_URI}monitors/1" />
      <img src="{BASE_URI}monitors/2" />
    </div>

    <p>
      <textarea id="sendkeys"></textarea>
      <span>
        <input type="checkbox" id="special-alt" value="alt" />
        <label for="special-alt">alt</label>
        <input type="checkbox" id="special-command" value="command" />
        <label for="special-command">command</label>
        <input type="checkbox" id="special-control" value="control" />
        <label for="special-control">control</label>
        <input type="checkbox" id="special-shift" value="shift" />
        <label for="special-shift">shift</label>
        <button id="special-esc" value="backspace">backspace</button>
        <button id="special-esc" value="delete">delete</button>
        <button id="special-esc" value="escape">escape</button>
        <button id="special-esc" value="enter">enter</button>
        <button id="special-esc" value="">send</button>
      </span>
      <a class="nowButton" target="_blank" href="https://www.youtube.com/channel/UCPaZDuwY1sJOb5l-QHm9mDw">
        My YouTube Channel</a>
    </p>
  </div>

  <!-- 
    TODO: Include YouTube iframe here or refactor to use a more efficient method
  -->

  <script>
    // Initialize YouTube iframe
    function initYouTubeIframe() {
      const iframe = document.createElement('iframe');
      iframe.src = 'https://www.youtube.com/embed/live_stream?channel=UCPaZDuwY1sJOb5l-QHm9mDw&origin=' + window.location.origin + '&controls=0&rel=0&autoplay=1';
      iframe.frameBorder = '0';
      iframe.allowFullScreen = true;
      iframe.width = '560';
      iframe.height = '315';
      iframe.allow = 'autoplay';
      iframe.modestbranding = true;
      document.querySelector('.livedev').appendChild(iframe);
    }

    // Call the initYouTubeIframe function
    initYouTubeIframe();
  </script>

</body>
</html>

HTML and CSS Code Breakdown

HTML Structure

The HTML document has a standard structure:

Content Security Policy (CSP)

The Content-Security-Policy meta tag is set to:

default-src *; img-src *'self' data: https:; script-src'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *

This policy specifies the sources of content that are allowed to be executed within the browser. It allows:

Styles

The CSS styles define the layout and appearance of the HTML elements. The styles are applied to the following elements:

Note: The styles are applied to specific HTML elements using CSS selectors. The .container and .livedev classes are used to target these elements.