Skip to content

Commit

Permalink
Added auto-open for desktop link
Browse files Browse the repository at this point in the history
  • Loading branch information
tybayn committed Apr 12, 2024
1 parent 220fdd2 commit 5d7b18e
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 10 deletions.
Binary file not shown.
15 changes: 8 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
</script>
<script src="jquery/jquery-3.6.2.min.js"></script>
<script src="scripts-v5/ghost_template-v1.js"></script>
<link rel="stylesheet" href="styles-v5/style-v1.css"/>
<link rel="stylesheet" href="styles-v5/style-mobile-v1.css"/>
<link rel="stylesheet" href="styles-v5/style-v2.css"/>
<link rel="stylesheet" href="styles-v5/style-mobile-v2.css"/>
<link rel="stylesheet" href="themes-v5/themes-v1.css"/>
<link rel="stylesheet" href="discord-v5/discord-v1.css" >
<link rel="stylesheet" href="wiki-v5/wiki-v1.css" >
Expand Down Expand Up @@ -192,15 +192,16 @@ <h3>Data Privacy</h3>
<hr>
<div class="modifier_volume yfont white">
Desktop Link
<a class="download" href="assets/ZN-Desktop-Link-Installer-v2.11.1.msi" download="ZN-Desktop-Link-Installer-v2.11.1.msi"><img class="download_icon" src="imgs/download.png" alt="Download ZN-Desktop-Link"></a>
<a class="download" href="assets/ZN-Desktop-Link-Installer-v2.12.0.msi" download="ZN-Desktop-Link-Installer-v2.12.0.msi"><img class="download_icon" src="imgs/download.png" alt="Download ZN-Desktop-Link"></a>
</div>
<div class="journal_link">
<input type="text" placeholder="DL-XXXXX" id="link_id" class="text" value="DL-XXXXX" disabled style="color:#444;">
<div id="link_id_cover" class="copy_cover" style="display:none;">Copied!</div>
<img class="clipboard_icon" src="imgs/copy.png" onclick="copy_code()">
<div class="journal_link_buttons">
<button id="link_id_create" class="journal_link_button" style="display: none;" onclick="create_link()">Create</button>
<button id="link_id_disconnect" class="journal_link_button" style="display: none;" onclick="disconnect_link()">Disconnect</button>
<button id="link_id_create" class="desktop_link_button" style="display: none;" onclick="create_link(false)">Create</button>
<button id="link_id_create_launch" class="desktop_link_button" style="display: none;" onclick="create_link(true)">Create & Launch</button>
<button id="link_id_disconnect" class="desktop_link_button" style="display: none;" onclick="disconnect_link()">Disconnect</button>
</div>
</div>
<div id="link_id_note" class="modifier_note">(STATUS: Not linked)</div>
Expand Down Expand Up @@ -666,8 +667,8 @@ <h3>Data Privacy</h3>
<script src="discord-v5/discord-v1.js"></script>
<script src="wiki-v5/wiki-v1.js"></script>
<script src="scripts-v5/filter-v1.js"></script>
<script src="scripts-v5/wslink-v2.js"></script>
<script src="scripts-v5/zn-v1.js"></script>
<script src="scripts-v5/wslink-v3.js"></script>
<script src="scripts-v5/zn-v2.js"></script>
<script src="events-v5/events-v1.js"></script>
<script src="feed-v5/feed-v1.js"></script>
<script src="scripts-v5/voice_en-v1.js"></script>
Expand Down
4 changes: 2 additions & 2 deletions info/updates
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version":"2.11.1",
"path":"https://tybayn.github.io/phasmo-cheat-sheet/assets/ZN-Desktop-Link-Installer-v2.11.1.msi"
"version":"2.12.0",
"path":"https://tybayn.github.io/phasmo-cheat-sheet/assets/ZN-Desktop-Link-Installer-v2.12.0.msi"
}
9 changes: 8 additions & 1 deletion scripts-v5/wslink-v2.js → scripts-v5/wslink-v3.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,17 @@ function create_room(){
});
}

function create_link(){
function create_link(auto_link = false){
fetch(`https://zero-network.net/phasmophobia/create-link/${znid}`,{method:"POST",Accept:"application/json",signal: AbortSignal.timeout(6000)})
.then(response => response.json())
.then(data => {
var link_id = data['link_id']
document.getElementById("link_id").value = link_id
link_link()
if(auto_link){
var url = `zndl:${link_id}`
$('<iframe src="' + url + '" width="1px" height="1px" style="display:none;">').appendTo('body');
}
})
.catch(response => {
console.error(response)
Expand Down Expand Up @@ -308,6 +312,7 @@ function link_link(){
dlws.onopen = function(event){
hasDLLink = true;
$("#link_id_create").hide()
$("#link_id_create_launch").hide()
$("#link_id_disconnect").show()
document.getElementById("link_id_note").innerText = "STATUS: Awaiting Desktop Link"
document.getElementById("dllink_status").className = "pending"
Expand Down Expand Up @@ -364,6 +369,7 @@ function link_link(){
clearInterval(dlws_ping)
dlws.send('{"action":"PINGKILL"}')
$("#link_id_create").show()
$("#link_id_create_launch").show()
$("#link_id_disconnect").hide()
document.getElementById("link_id_note").innerText = "ERROR: Link Lost Connection!"
document.getElementById("dllink_status").className = "error"
Expand Down Expand Up @@ -593,6 +599,7 @@ function disconnect_link(reset=false,has_status=false){
dlws.send('{"action":"KILL"}')
}
$("#link_id_create").show()
$("#link_id_create_launch").show()
$("#link_id_disconnect").hide()
if(!has_status){
document.getElementById("link_id_note").innerText = "STATUS: Not linked"
Expand Down
2 changes: 2 additions & 0 deletions scripts-v5/zn-v1.js → scripts-v5/zn-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ function loadAllAndConnect(){
$('#room_id_create').show()
$('#room_id_link').show()
$('#link_id_create').show()
$('#link_id_create_launch').show()
}
else{
$('#room_id').val("Can't Connect!")
Expand Down Expand Up @@ -113,6 +114,7 @@ function loadAllAndConnect(){
$('#room_id_create').show()
$('#room_id_link').show()
$('#link_id_create').show()
$('#link_id_create_launch').show()
})
.then(x =>{
resolve("New session created")
Expand Down
10 changes: 10 additions & 0 deletions styles-v5/style-mobile-v1.css → styles-v5/style-mobile-v2.css
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,16 @@
font-size: 25px;
}

.desktop_link_button{
flex-grow:1;
cursor: pointer;
border: none;
margin: 0px 2px;
padding: 5px;
background: #ccc;
font-size: 25px;
}

.toggle {
height: 30px;
width: 70px;
Expand Down
13 changes: 13 additions & 0 deletions styles-v5/style-v1.css → styles-v5/style-v2.css
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,19 @@ hr{
background: rgb(128, 128, 128);
}

.desktop_link_button{
flex-grow: 1;
cursor: pointer;
border: none;
margin: 0px 2px;
padding: 5px;
background: #ccc;
}

.desktop_link_button:hover{
background: rgb(128, 128, 128);
}

.toggle {
height: 15px;
width: 40px;
Expand Down

0 comments on commit 5d7b18e

Please sign in to comment.