Skip to content

Commit

Permalink
Initial push
Browse files Browse the repository at this point in the history
  • Loading branch information
chocoearly44 committed Jan 9, 2022
1 parent 47ff4f9 commit d6b4067
Show file tree
Hide file tree
Showing 13 changed files with 349 additions and 2 deletions.
24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
]
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
out
dist
node_modules
.vscode-test/
*.vsix
package-lock.json
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint"
]
}
34 changes: 34 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
20 changes: 20 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
10 changes: 10 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.vscode/**
.vscode-test/**
src/**
.gitignore
.yarnrc
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Change Log

* ## v1.0.0
- BSOverlay released
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# BSOverlay-vscode
VSCode extension that creates overlay for your Broadcasting Software of choice.
<p align="center">
<img align="center" src="images/bsoverlay-icon.png" height="150px">
</p>

<h1 align="center">BSOverlay</h1>
<h3 align="center">VSCode extension that creates overlay for your Broadcasting Software of choice.</h3>
<br>

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/chocoearly44/bsoverlay-vscode)

## Documentation
Please refer to the [Wiki Section](https://github.com/chocoearly44/bsoverlay-vscode/issues).

## Installing
VSCode extension store

## Bug reporting
If you encounter any bugs while using the tools please report them in the [Issues Section](https://github.com/chocoearly44/bsoverlay-vscode/issues) on GitHub Repository.

## Support
You can receive additional support in an official Discord Server.

[![Widget for the TSL Support guild](https://discord.com/api/guilds/807666401300316160/widget.png?style=banner1)](https://discord.gg/Wa24skGscR)
Binary file added images/bsoverlay-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"name": "bsoverlay",
"displayName": "BSOverlay",
"description": "Creates overlay for your Broadcasting Software of choice.",
"version": "1.0.0",
"publisher": "chocoearly44",
"author": {
"name": "chocoearly44",
"email": "[email protected]",
"url": "http://thesuperlab.tk"
},
"engines": {
"vscode": "^1.63.0"
},
"categories": [
"Other"
],
"keywords": [
"bsoverlay",
"bs overlay",
"open broadcasting software",
"xplit",
"obs",
"streamlabs",
"streamlabs obs"
],
"preview": false,
"license": "MIT",
"icon": "images/bsoverlay-icon.png",
"bugs": {
"url": "https://github.com/chocoearly44/bsoverlay-vscode/issues",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "https://github.com/chocoearly44/bsoverlay-vscode.git"
},
"homepage": "https://github.com/chocoearly44/bsoverlay-vscode",
"activationEvents": [
"onCommand:bsoverlay.start"
],
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "bsoverlay.start",
"title": "Start BSOverlay"
}
]
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js"
},
"devDependencies": {
"@types/glob": "^7.1.4",
"@types/mocha": "^9.0.0",
"@types/node": "14.x",
"@types/vscode": "^1.63.0",
"@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^5.1.0",
"@vscode/test-electron": "^1.6.2",
"eslint": "^8.1.0",
"glob": "^7.1.7",
"mocha": "^9.1.3",
"typescript": "^4.4.4"
},
"dependencies": {
"@types/express": "^4.17.13",
"@types/ws": "^8.2.2",
"express": "^4.17.2",
"ws": "^8.4.0"
}
}
111 changes: 111 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import * as vscode from 'vscode';

import * as express from 'express';
import * as http from 'http';
import * as WebSocket from 'ws';

export function activate(context: vscode.ExtensionContext) {
let disposable = vscode.commands.registerCommand('bsoverlay.start', () => {
vscode.window.showInformationMessage('Overlay started on http://localhost:31561');

let errorCount = 0;
let warningCount = 0;

const someFunction = function () {
var uri = vscode?.window?.activeTextEditor?.document.uri;
if (uri !== undefined) {
let diagnostics = vscode.languages.getDiagnostics(uri);
errorCount = 0;
warningCount = 0;

diagnostics.forEach((error) => {
if (error.severity > 0) {
warningCount++;
} else {
errorCount++;
}
});
}
};
setInterval(someFunction, 1000);

const app = express();
const server = http.createServer(app);
const wss = new WebSocket.Server({ server });

app.get('/', function (req, res) {
res.send(`
<!DOCTYPE html>
<html>
<head>
<title>BSOverlay</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
integrity="sha512-Fo3rlrZj/k7ujTnHg4CGR2D7kSs0v4LLanw2qksYuRlEzO+tcaEPQogQ0KaoGN26/zrn20ImR1DfuLWnOo7aBA=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Varela+Round&display=swap" rel="stylesheet">
<style>
* {
font-family: 'Varela Round', sans-serif;
font-size: 25px;
}
.display {
color: #000000;
}
.alert-red {
color: #9E2927;
}
.alert-yellow {
color: #BE9117;
}
</style>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<i class="fas fa-exclamation-circle alert-red"></i><span class="dislay" id="error_out">0</span>
<i class="fas fa-exclamation-triangle alert-yellow"></i><span class="dislay" id="warning_out">0</span>
<script>
var ws = new WebSocket("ws://localhost:31561");
ws.onmessage = function(event) {
var message = JSON.parse(event.data);
$("#error_out").text(message.errors);
$("#warning_out").text(message.warnings);
};
setInterval (function () {
ws.send("test");
}, 1000);
</script>
</body>
</html>
`);
});

wss.on('connection', (ws: WebSocket) => {
ws.on('message', (message: string) => {
let stats = JSON.stringify({ "errors": errorCount, "warnings": warningCount });
ws.send(stats);
});
});

server.listen(process.env.PORT || 31561);
});

context.subscriptions.push(disposable);
}

export function deactivate() { }
21 changes: 21 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2020",
"outDir": "out",
"lib": [
"ES2020"
],
"sourceMap": true,
"rootDir": "src",
"strict": true, /* enable all strict type-checking options */
/* Additional Checks */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
},
"exclude": [
"node_modules",
".vscode-test"
]
}

0 comments on commit d6b4067

Please sign in to comment.