forked from Rawrington/SkillDisplay
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
12 changed files
with
418 additions
and
411 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
ignore: | ||
- dependency-name: react-scripts | ||
versions: | ||
- 4.0.2 | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
ignore: | ||
- dependency-name: react-scripts | ||
versions: | ||
- 4.0.2 |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{ | ||
"useTabs": true, | ||
"semi": false, | ||
"trailingComma": "all" | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
|
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 |
---|---|---|
@@ -1,43 +1,44 @@ | ||
const getHost = () => /[?&]HOST_PORT=(wss?:\/\/[^&/]+)/.exec(window.location.search) | ||
const getHost = () => | ||
/[?&]HOST_PORT=(wss?:\/\/[^&/]+)/.exec(window.location.search) | ||
|
||
export default function listenToACT(callback) { | ||
if (!getHost()) return listenOverlayPlugin(callback) | ||
return listenActWebSocket(callback) | ||
if (!getHost()) return listenOverlayPlugin(callback) | ||
return listenActWebSocket(callback) | ||
} | ||
|
||
// https://github.com/OverlayPlugin/cactbot/blob/main/docs/LogGuide.md | ||
function listenActWebSocket(callback) { | ||
const wsUri = `${getHost()[1]}/BeforeLogLineRead` || undefined | ||
const ws = new WebSocket(wsUri) | ||
ws.onerror = () => ws.close() | ||
ws.onclose = () => | ||
setTimeout(() => { | ||
listenActWebSocket(callback) | ||
}, 1000) | ||
ws.onmessage = function(e, m) { | ||
if (e.data === ".") return ws.send(".") | ||
const wsUri = `${getHost()[1]}/BeforeLogLineRead` || undefined | ||
const ws = new WebSocket(wsUri) | ||
ws.onerror = () => ws.close() | ||
ws.onclose = () => | ||
setTimeout(() => { | ||
listenActWebSocket(callback) | ||
}, 1000) | ||
ws.onmessage = function (e, m) { | ||
if (e.data === ".") return ws.send(".") | ||
|
||
const obj = JSON.parse(e.data) | ||
if (obj.msgtype === "SendCharName") { | ||
return callback(obj.msg) | ||
} else if (obj.msgtype === "Chat") { | ||
return callback(...obj.msg.split("|")) | ||
} | ||
} | ||
const obj = JSON.parse(e.data) | ||
if (obj.msgtype === "SendCharName") { | ||
return callback(obj.msg) | ||
} else if (obj.msgtype === "Chat") { | ||
return callback(...obj.msg.split("|")) | ||
} | ||
} | ||
|
||
return () => { | ||
ws.close() | ||
} | ||
return () => { | ||
ws.close() | ||
} | ||
} | ||
|
||
function listenOverlayPlugin(callback) { | ||
const listener = e => { | ||
callback(...e.detail) | ||
} | ||
const listener = (e) => { | ||
callback(...e.detail) | ||
} | ||
|
||
document.addEventListener("onLogLine", listener) | ||
document.addEventListener("onLogLine", listener) | ||
|
||
return () => { | ||
document.removeEventListener("onLogLine", listener) | ||
} | ||
return () => { | ||
document.removeEventListener("onLogLine", listener) | ||
} | ||
} |
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
Oops, something went wrong.