-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 129205c
Showing
20 changed files
with
4,833 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"files.associations": { | ||
"strings.h": "c", | ||
"string.h": "c" | ||
}, | ||
"workbench.colorCustomizations": { | ||
"activityBar.activeBackground": "#8375d1", | ||
"activityBar.background": "#8375d1", | ||
"activityBar.foreground": "#15202b", | ||
"activityBar.inactiveForeground": "#15202b99", | ||
"activityBarBadge.background": "#e7bfb7", | ||
"activityBarBadge.foreground": "#15202b", | ||
"commandCenter.border": "#e7e7e799", | ||
"sash.hoverBorder": "#8375d1", | ||
"statusBar.background": "#604fc4", | ||
"statusBar.foreground": "#e7e7e7", | ||
"statusBarItem.hoverBackground": "#8375d1", | ||
"statusBarItem.remoteBackground": "#604fc4", | ||
"statusBarItem.remoteForeground": "#e7e7e7", | ||
"titleBar.activeBackground": "#604fc4", | ||
"titleBar.activeForeground": "#e7e7e7", | ||
"titleBar.inactiveBackground": "#604fc499", | ||
"titleBar.inactiveForeground": "#e7e7e799" | ||
}, | ||
"peacock.color": "#604fc4" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
|
||
/////////////////////// Works Fine for Listening Keyboard Inputs /////////////////////// | ||
|
||
// const readline = require('readline'); | ||
|
||
// readline.emitKeypressEvents(process.stdin); | ||
// process.stdin.setRawMode(true); | ||
|
||
// process.stdin.on('keypress', (str, key) => { | ||
// console.log(str) | ||
// console.log(key) | ||
// }) | ||
|
||
//////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
//const sendkeys = require("sendkeys-js"); | ||
|
||
//// for win | ||
//setInterval(() => {sendkeys.send('{right}')}, 1000); | ||
|
||
//////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
const express = require("express"); | ||
const ws = require("ws"); | ||
const screenshot = require('screenshot-desktop') | ||
const imageProcessor = require("sharp"); | ||
const operatingSystem = require("os"); | ||
const { readFileSync } = require("fs"); | ||
const { exec, execFile } = require("child_process"); | ||
const path = require("path"); | ||
const { json, response } = require("express"); | ||
|
||
let networkInterfaceDetails = operatingSystem.networkInterfaces(); | ||
let computerName = operatingSystem.hostname(); | ||
|
||
const httpConfig = | ||
{ | ||
portNumber: null, | ||
ipAddress: null | ||
}; | ||
|
||
const webSocketConfig = | ||
{ | ||
portNumber: null, | ||
ipAddress: null | ||
}; | ||
|
||
let userConfig; | ||
userConfig = JSON.parse(readFileSync(path.join(__dirname, "user_config.json"), "utf8")); | ||
console.log("User Config Loaded!"); | ||
userConfig["computerName"] = computerName; | ||
console.log(userConfig); | ||
|
||
httpConfig.port = userConfig.httpPortNumber; | ||
webSocketConfig.port = userConfig.webSocketPortNumber; | ||
|
||
if (userConfig.WiFi == true) | ||
{ | ||
httpConfig.ipAddress = networkInterfaceDetails["Wi-Fi"][1]["address"]; | ||
webSocketConfig.ipAddress = networkInterfaceDetails["Wi-Fi"][1]["address"]; | ||
} | ||
else | ||
{ | ||
let networkInterfaceDetails = operatingSystem.networkInterfaces(); | ||
httpConfig.ipAddress = networkInterfaceDetails["eth0"][1]["address"]; | ||
webSocketConfig.ipAddress = networkInterfaceDetails["eth0"][1]["address"]; | ||
} | ||
|
||
const server = express(); | ||
server.use(express.json({limit: "500kb"})); | ||
server.use(express.static(path.join(__dirname, "assets/public"))); | ||
|
||
server.listen(httpConfig.port, httpConfig.ipAddress, () => | ||
{ | ||
console.log("Server listening on..."); | ||
console.log("Port: ", httpConfig.port); | ||
console.log("IP: ", httpConfig.ipAddress); | ||
}); | ||
|
||
server.get("/api/get-user-config", (request, response) => | ||
{ | ||
response.json(userConfig); | ||
console.log("Shared User Config!"); | ||
}); | ||
|
||
server.get("/api/get-screenshot", (request, response) => | ||
{ | ||
response.json(screenShotObject); | ||
console.log("Sharing Screenshot!"); | ||
}); | ||
|
||
let isVolumeMeterOpened = false; | ||
|
||
server.get("/api/get-volume", (request, response) => | ||
{ | ||
let currentVolumeObject = | ||
{ | ||
volume: null | ||
} | ||
if (isVolumeMeterOpened == false) | ||
{ | ||
exec("sndvol.exe -f", () => | ||
{ | ||
console.log("Opened Volume Level!"); | ||
isVolumeMeterOpened = true; | ||
}); | ||
} | ||
|
||
execFile(path.join(__dirname, "assets/volume_settings_win/volume_settings_win.exe"), (error, stdout, stderr) => | ||
{ | ||
currentVolumeObject.volume = stdout | ||
response.json(currentVolumeObject); | ||
console.log("Shared Current Volume!"); | ||
}); | ||
|
||
}); | ||
|
||
server.post("/api/emulate-keys", (request, response) => | ||
{ | ||
console.log(request.body); | ||
const keyboardInputCode = request.body.keyboardInputCode; | ||
console.log(keyboardInputCode); | ||
execFile((path.join(__dirname, "assets/emulate_keys_win/emulate_keys_win.exe")), [keyboardInputCode], (error, stdout, stderr) => | ||
{ | ||
console.log(stdout); | ||
response.json("Input Emulated!"); | ||
console.log("Input Emulated!"); | ||
}); | ||
|
||
}); | ||
|
||
const webSocketServer = new ws.Server({port: webSocketConfig.port, host: webSocketConfig.ipAddress}); | ||
|
||
webSocketServer.on('connection', (webSocket) => | ||
{ | ||
webSocket.on('message', (data) => | ||
{ | ||
let keyboardInputCode = JSON.parse(data).keyboardInputCode; | ||
console.log(keyboardInputCode); | ||
execFile((path.join(__dirname, "assets/emulate_keys_win/emulate_keys_win.exe")), [keyboardInputCode]); | ||
webSocket.send("Input Emulated!"); | ||
console.log("Input Emulated!"); | ||
}); | ||
|
||
webSocket.send('Connection Successful!'); | ||
}); | ||
|
||
|
||
screenShotObject = | ||
{ | ||
imgInBase64: "" | ||
}; | ||
|
||
async function screenShotAndResize() | ||
{ | ||
const imgBuffer = await screenshot({format: 'png'}); | ||
const imgBufferResized = await imageProcessor(imgBuffer).resize(265, 150).png().toBuffer(); // 265x150 resolution does | ||
screenShotObject.imgInBase64 = Buffer.from(imgBufferResized).toString("base64"); // have 16x9 ratio. | ||
//console.log("Image Resized!"); | ||
} | ||
|
||
setInterval(() => {screenShotAndResize()}, 300); | ||
|
||
|
||
|
||
|
||
|
||
//const keyboardInputChar = "D"; | ||
//const child = execFile('.\\emulate_keyboard.exe', [keyboardInputChar]); | ||
//console.log("${keyboardInputChar}"); | ||
//const child = execFile('.\\emulate_keyboard.exe', [`${keyboardInputChar}`]); // Using String Literal notation. Just an alternative. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Hizbullah Khan | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Computer Remote Control | ||
|
||
### Docs to be added soon... |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> | ||
<title>Remote-Keyboard</title> | ||
<link href="styles.css" rel="stylesheet"> | ||
<!--<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>--> | ||
<script src="vue.global.prod.js"></script> | ||
</head> | ||
<!--<body class="body-class dark-mode">--> | ||
<body class="body-class" id="body-ID"> | ||
<div class="root" id="root-ID"> | ||
<div class="page-routes" v-if="isOptionsButtonPressed == false"> | ||
<div class="title-window"> | ||
<h2 class="title-text">{{ appConfig.titleText }}</h2> | ||
<h4 class="author-text">@hizbi-github</h4> | ||
<div class="server-status-window"> | ||
<div class="connection-status-div-button-window"> | ||
<div id="connection-status-div-button" class="connection-status-div-button" v-bind:class="(appConfig.darkMode == 'on') ? 'connection-status-button-dark-mode' : 'connection-status-button-light-mode'" @click="connectDisconnectFromServer(), provideHapticFeedback()">Disconnect</div> | ||
</div> | ||
<div class="server-name-text">{{ appConfig.serverName }}</div> | ||
</div> | ||
</div> | ||
|
||
<div class="text-window-and-screenshot"> | ||
<div class="text-window"> | ||
<div class="log-window" v-bind:class="(appConfig.darkMode == 'on') ? 'dark-mode' : 'light-mode'"> | ||
<ul v-html="logList"> | ||
</ul> | ||
</div> | ||
|
||
<div class="status-window" v-bind:class="(appConfig.darkMode == 'on') ? 'dark-mode' : 'light-mode'"> | ||
<div class="status-row"> | ||
<div class="status-title">Latency: </div> | ||
<div>{{ latency }}</div> | ||
</div> | ||
<div class="status-row"> | ||
<div class="status-title">Volume: </div> | ||
<div>{{ currentVolume }}</div> | ||
</div> | ||
<button class="configuration-page-button" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="renderConfigurationScreen(), provideHapticFeedback()">Settings</button> | ||
</div> | ||
</div> | ||
|
||
<div class="screenshot-window-and-screenshot-buttons"> | ||
<div class="screenshot-window" v-bind:class="(appConfig.darkMode == 'on') ? 'dark-mode' : 'light-mode'"> | ||
<img class="screenshot-img" v-bind:src="imgScreenshot"> | ||
</div> | ||
|
||
<div class="screenshot-buttons-window" v-bind:class="(appConfig.darkMode == 'on') ? 'dark-mode' : 'light-mode'"> | ||
<button class="screenshot-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="showHiResScreenShot(), provideHapticFeedback()">Hi-Res Snap</button> | ||
<button class="screenshot-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="showHideScreenShot(), provideHapticFeedback()">{{ showHideScreenShotButtonText }}</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="volume-slider-window"> | ||
<input class="volume-slider" type="range"> | ||
</div> | ||
|
||
<div class="input-buttons-window"> | ||
<div class="left-buttons-window"> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('leftKeyOne'), provideHapticFeedback()">{{ appConfig.leftKeyOne[0] }}</button> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('leftKeyTwo'), provideHapticFeedback()">{{ appConfig.leftKeyTwo[0] }}</button> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('leftKeyThree'), provideHapticFeedback()">{{ appConfig.leftKeyThree[0] }}</button> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('leftKeyFour'), provideHapticFeedback()">{{ appConfig.leftKeyFour[0] }}</button> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('leftKeyFive'), provideHapticFeedback()">{{ appConfig.leftKeyFive[0] }}</button> | ||
</div> | ||
|
||
<div class="middle-buttons-window"> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('leftKeyOne'), provideHapticFeedback()">{{ appConfig.leftKeyOne[0] }}</button> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('leftKeyTwo'), provideHapticFeedback()">{{ appConfig.leftKeyTwo[0] }}</button> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('leftKeyThree'), provideHapticFeedback()">{{ appConfig.leftKeyThree[0] }}</button> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('leftKeyFour'), provideHapticFeedback()">{{ appConfig.leftKeyFour[0] }}</button> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('leftKeyFive'), provideHapticFeedback()">{{ appConfig.leftKeyFive[0] }}</button> | ||
</div> | ||
|
||
<div class="right-buttons-window"> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('rightKeyOne'), provideHapticFeedback()">{{ appConfig.rightKeyOne[0] }}</button> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('rightKeyTwo'), provideHapticFeedback()">{{ appConfig.rightKeyTwo[0] }}</button> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('rightKeyThree'), provideHapticFeedback()">{{ appConfig.rightKeyThree[0] }}</button> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('rightKeyFour'), provideHapticFeedback()">{{ appConfig.rightKeyFour[0] }}</button> | ||
<button class="input-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="emulateKey('rightKeyFive'), provideHapticFeedback()">{{ appConfig.rightKeyFive[0] }}</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div v-if="isOptionsButtonPressed == true"> | ||
<div class="title-window"> | ||
<h2 class="title-text">Settings</h2> | ||
<h4 class="author-text">@hizbi-github</h4> | ||
<div class="server-status-window"> | ||
<div class="connection-status-div-button-window"> | ||
<div id="connection-status-div-button" class="connection-status-div-button" v-bind:class="(appConfig.darkMode == 'on') ? 'connection-status-button-dark-mode' : 'connection-status-button-light-mode'" @click="connectDisconnectFromServer(), provideHapticFeedback()"></div> | ||
</div> | ||
<div class="server-name-text">{{ appConfig.serverName }}</div> | ||
</div> | ||
</div> | ||
|
||
<div class="configuration-options-window"> | ||
<div class="configuration-buttons-window"> | ||
<button class="configuration-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="toggleConnectionType(), provideHapticFeedback()">Connection</button> | ||
<button class="configuration-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="toggleScreenshotStreamType(), provideHapticFeedback()">Screen View</button> | ||
<button class="configuration-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="toggleHapticsVibrations(), provideHapticFeedback()">Haptics</button> | ||
<button class="configuration-buttons" v-bind:class="(appConfig.darkMode == 'on') ? 'button-dark-mode' : 'button-light-mode'" @click="toggleDarkOrLightMode(), provideHapticFeedback()">Dark Mode</button> | ||
</div> | ||
|
||
<div class="configuration-states-window"> | ||
<div class="configuration-states"> | ||
<div class="options-text" v-bind:class="(appConfig.connectionType == 'websocket') ? 'selected-option' : 'un-selected-option'">websocket</div> | ||
<div class="options-text" v-bind:class="(appConfig.connectionType == 'http') ? 'selected-option' : 'un-selected-option'">http</div> | ||
</div> | ||
|
||
<div class="configuration-states"> | ||
<div class="options-text" v-bind:class="(appConfig.screenshotStreamType == 'live') ? 'selected-option' : 'un-selected-option'">live</div> | ||
<div class="options-text" v-bind:class="(appConfig.screenshotStreamType == 'reactive') ? 'selected-option' : 'un-selected-option'">reactive</div> | ||
</div> | ||
|
||
<div class="configuration-states"> | ||
<div class="options-text" v-bind:class="(appConfig.hapticsVibrations == 'on') ? 'selected-option' : 'un-selected-option'">on</div> | ||
<div class="options-text" v-bind:class="(appConfig.hapticsVibrations == 'off') ? 'selected-option' : 'un-selected-option'">off</div> | ||
</div> | ||
|
||
<div class="configuration-states"> | ||
<div class="options-text" v-bind:class="(appConfig.darkMode == 'on') ? 'selected-option' : 'un-selected-option'">on</div> | ||
<div class="options-text" v-bind:class="(appConfig.darkMode == 'off') ? 'selected-option' : 'un-selected-option'">off</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<button class="action-buttons" @click="backToMainScreen(), provideHapticFeedback()">Back</button> | ||
|
||
<!--<input type="checkbox" class="toggle" id="optionToggle">--> | ||
<!--<button class="toggle" id="optionToggle"></button>--> | ||
</div> | ||
</div> | ||
|
||
<script src="index.js"></script> | ||
</body> | ||
</html> | ||
|
Oops, something went wrong.