Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.20.2
43 changes: 30 additions & 13 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
<h1>Sploder Launcher</h1>
A project that aims to revive <a href="https://sploder.com">sploder</a>.<br>
Join the <a href="https://discord.gg/cHGz362sdC">Discord server</a>!
<h1>How to use:</h1>
- Download the <a href="https://github.com/Sploder-Saptarshi/Sploder-Launcher/releases/latest">latest release</a> from here.<br>
- Run the installer.<br>
- Done.<br>
<h1>How to build:</h1>
- Use node 14.10.0.<br>
- Install yarn.<br>
- Install all the required packages by running <code>yarn</code>.<br>
- Run <code>build</code> or build.bat.
- The built files will be available in the dist folder.
# Sploder Launcher

A repository that aims to provide a standalone application to be able to access the Sploder-Revival project without needing to install Flash or downgraded applications system wide.

Join the [Discord Server](https://discord.gg/cHGz362sdC) for the active community and development.

## Using without releases

- Download the [latest release](https://github.com/Sploder-Saptarshi/Sploder-Launcher/releases/latest)
- Run the installer

## How to build

### Dependencies

- [node.js](https://nodejs.org/en)
- [node version manager (nvm)](https://github.com/nvm-sh/nvm)

### Steps to Build

- Run `nvm use` to switch to the node version specified in .nvmrc
- Run `npm i` to install all necessary packages
- Run `npm run dist` to build the project
- The built files will be available in the dist folder.

### Steps to Debug

- Run `nvm use` to switch to the node version specified in .nvmrc
- Run `npm i` to install all necessary packages
- Run `npm run dev` to start the electron development server
63 changes: 35 additions & 28 deletions src/local/offline.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,38 @@
<title>Sploder</title>
<style>*{margin:0;padding:0}html,body{width:100%;height:100%}body{margin:0;background-color:#32103C;font-family:"Helvetica Neue",Helvetica,Arial,Sans-serif;color:#fff}img{display:block}img.icon{z-index:-1;margin:-40px 0}img.logo{position:relative;z-index:1000}a{color:#ea0}h1,h2{color:#fff;margin-bottom:.25em}p{color:#ccc}table{height:100%;padding:20px}td.announce{margin-top:25%}div.cloudflare_logo{margin:10px 20px}ul{margin-top:20px;width:75%;background-color:#000;padding:20px;border-radius:10px}ul li{font-size:.8em;text-align:left;list-style-type:none}ul li p{color:#666}p.cferror_msg{padding-left:10%;padding-right:10%}</style>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
function getSearchParams() {
return new URL(window.location.href).searchParams;
}
function getUrl() {
return getSearchParams().get('url');
}
const url = getUrl();
document.getElementById('sploder-url').textContent = url;

// All hail GitHub Copilot!!
function getRetryParameter() {
// Get the current URL
var currentUrl = window.location.href;

// Create a URL object
var url = new URL(currentUrl);

// Get the value of the 'retry' parameter
var retryParameterValue = url.searchParams.get('retry');
// Get the current URL
const searchParams = getSearchParams();
// Get the value of the 'retry' parameter
const retryParameterValue = searchParams.get('retry');

// Provide a default value if the 'retry' parameter is not present
return retryParameterValue !== null ? retryParameterValue : 'https://sploder.xyz/update';
const value = retryParameterValue !== null
? retryParameterValue
: url + '/update';
return value;
}


// Check if we actually retried and not come here for the first time.
var retried;
function retry(){
retried = true;
}
const btn = document.getElementById('retrybtn');
btn.setAttribute('href', getRetryParameter());
});
</script>


Expand All @@ -34,28 +50,19 @@
<img style="margin-top:-40px;" alt="Sploder" class="logo" width="203" height="160" src="images/logo.png"><
<img class="icon" width="200" height="200" src="images/icon.png">
<div class="cf-error-details cf-error-522">
<BR><BR><br><h1>Whoops... Could not connect to the server.</h1>
<br><br><br>
<h1>Whoops... Could not connect to the server.</h1>
<p>Check your internet connection and try again.</p>
<span>Server: <span id="sploder-url"></span></span>
<p>If that does not work, please email <a href="mailto:saptarshi12345yt@gmail.com">saptarshi12345yt@gmail.com</a> with
your exact issue.</p>
<br><a onclick="retry()" id="retrybtn"><button style="outline:none;border:1px solid #7b8eac;background:url('images/button_bkgd_small.jpg') repeat-x top;padding:8px 12px;margin-left:10px;white-space:nowrap;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;color:#ec0;cursor: pointer;">Try again</button></a>
<script>
// Check if we actually retried and not come here for the first time.
var retried;
function retry(){
retried = true;
}
const btn = document.getElementById('retrybtn');
btn.setAttribute('href', getRetryParameter());

</script>

<br>
<a onclick="retry()" id="retrybtn">
<button style="outline:none;border:1px solid #7b8eac;background:url('images/button_bkgd_small.jpg') repeat-x top;padding:8px 12px;margin-left:10px;white-space:nowrap;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;color:#ec0;cursor: pointer;">Try again</button>
</a>
</div>

</td>
</tr>
</tbody></table>



</body></html>
</body>
</html>
64 changes: 26 additions & 38 deletions src/local/start.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
<title>Sploder</title>
</head>
<script>
document.addEventListener('DOMContentLoaded', function() {
function getUrl() {
return new URL(window.location.href).searchParams.get('url');
}
// Check get parameter to get URL
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const url = urlParams.get('url');

let url = getUrl();
document.getElementById('sploder-url').textContent = getUrl();
document.getElementById("content-frame").setAttribute('src', url);
// If the URL is not provided, redirect to the update page
if (url == null) {
window.location.href = "https://sploder.xyz/update";
}
// window.href.location = urlParam + '/update';

var page;
var prevpage;
Expand Down Expand Up @@ -58,29 +59,27 @@
// Custom built code to check if user is online.
// I have no idea how or why this works.
function online() {
if(document.getElementById("content-frame").contentWindow.location.href != "chrome-error://chromewebdata/"){
page = document.getElementById("content-frame").contentWindow.location.href;
} else if(page == undefined) {
if (document.getElementById("content-frame").contentWindow.location.href != "chrome-error://chromewebdata/") {
page = document.getElementById("content-frame").contentWindow.location.href;
} else if (page == undefined) {
page = url;
}
if(page.includes("offline.html")){

if (page.includes("offline.html")){
page = "test";
} else {


const frame = document.getElementById('content-frame');
var url = "https://sploder.xyz/php/ping.php";
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {

if (this.readyState == 4 && this.status != 200 && frame.getAttribute('src') != "offline.html?retry="+page) {
const frame = document.getElementById('content-frame');
const pingUrl = url + '/php/ping.php';
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
const offlineUrl = "offline.html?retry="+page+'&url='+encodeURIComponent(urlParam);
if (this.readyState == 4 && this.status != 200 && frame.getAttribute('src') != offlineUrl) {
if(page != "test") {
prevpage = page;
prevpage = page;
}
pagestat = "offline";
page = "offline.html";
frame.setAttribute('src', 'offline.html?retry='+page);

frame.setAttribute('src', offlineUrl);
} else if(document.getElementById("content-frame").contentWindow.location.href != "chrome-error://chromewebdata/") {
page = document.getElementById("content-frame").contentWindow.location.href;
} else {
Expand All @@ -89,11 +88,9 @@
}
//pagestat = "online";
}

};
xhttp.open("GET", url, true);
xhttp.open("GET", pingUrl, true);
xhttp.send();

}
}
// Prevent scrolling using JavaScript
Expand All @@ -113,10 +110,7 @@
event.preventDefault(); // Disable keyboard scrolling
}
});




});
</script>
<style>
body, html {
Expand Down Expand Up @@ -163,11 +157,10 @@
}
</style>
<body>

<div class="window" style="width: 100%; height: calc(100% - 3px)">
<div class="title-bar">
<img class="title-bar-icon" src="images/icon.png">
<div class="title-bar-text">Sploder</div>
<div class="title-bar-text">Sploder <span id="sploder-url"></span></div>
<div class="titlebar-movable"></div>
<div class="title-bar-controls">
<button id="min-btn" onclick="win.minimize()" aria-label="Minimize"></button>
Expand All @@ -178,13 +171,8 @@
<div class="window-body"
style="width: 100%; height: calc(100% - 50px); margin-left: 3px; margin-top:0px; padding-bottom: -50px;">
<iframe id="content-frame" onload="online();" src="">
</iframe>
<script>
document.getElementById("content-frame").setAttribute('src', url);
</script>

</iframe>
</div>
</div>

</body>
</html>
</html>
37 changes: 29 additions & 8 deletions src/main/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
const { app, BrowserWindow, shell } = require("electron");
const path = require("path");
process.env.NODE_ENV || 'development';

const config = {
SPLODER_URL: "http://127.0.0.1:8010",
DEV: !app.isPackaged,
}
const isDev = config.DEV;
if (isDev) {
console.log(config);
}

// If not on windows, disable RPC
let DiscordRPC;
if (process.platform == "win32") {
DiscordRPC = require('discord-rpc');
}
let win;
let pluginName;
const isDev = false; // Change to false if you want to disable development mode and package the application.
switch (process.platform) {
case "win32":
pluginName = process.arch == 'x64' ? 'x64/pepflashplayer.dll' : 'x32/pepflashplayer32.dll';
Expand Down Expand Up @@ -116,13 +126,25 @@ function createWindow() {
if(isDev){
win.openDevTools();
}

function getSploderUrl(path='') {
return encodeURIComponent(config.SPLODER_URL + path);
}
// Load the custom Windows XP titlebar.
if(isDev){
startpath = "/../../src/local/start.html?url="
if(isDev) {
startpath = '/../../src/local/start.html?url='
console.log('startpath: ', startpath);
} else {
startpath = "/../../resources/src/local/start.html?url="
startpath = '/../../resources/src/local/start.html?url='
}
function loadURLFromStartPath(appendedPath='') {
const path = "file:///" + app.getAppPath().replace(/\\/g, '/') + startpath + getSploderUrl() + appendedPath;
if (isDev) {
console.log(path);
}
win.loadURL(path);
}
win.loadURL("file:///" + app.getAppPath().replace(/\\/g, '/') + startpath + "https://sploder.xyz/update");
loadURLFromStartPath();
win.webContents.on('did-finish-load', () => {
win.show();
});
Expand All @@ -147,7 +169,7 @@ function createWindow() {
},
});
win.newwin.setMenu(null);
win.newwin.loadURL("file:///" + app.getAppPath().replace(/\\/g, '/') + startpath + url);
loadURLFromStartPath(url);
win.newwin.webContents.on('did-finish-load', () => {
win.newwin.show();
});
Expand Down Expand Up @@ -177,8 +199,7 @@ app.on("window-all-closed", function () {
app.quit();
});


if (process.platform == "win32") {
if (process.platform === "win32") {
const clientId = '915116210570539058';
const rpc = new DiscordRPC.Client({ transport: 'ipc' });
const startTimestamp = new Date();
Expand Down
Loading