Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Legal button
Browse files Browse the repository at this point in the history
  • Loading branch information
igor725 committed May 19, 2024
1 parent adcd11c commit 6f8ebda
Show file tree
Hide file tree
Showing 15 changed files with 139 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ const commandHandler = (channel, cmd, info) => {
settwin.webContents.once('did-finish-load', () => settwin.send('set-lang', config.getSysLang()));
break;
case 'openfolder':
exec(`explorer "${info}"`);
spawn('explorer', [info]);
break;
case 'applypatch':
updateGameSummary(info.gid, { patch: info.patch });
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
https://github.com/jbrems/color-wheel

GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
47 changes: 47 additions & 0 deletions webroot/3rd_license/list.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[
{
"url": "https://github.com/igor725/adv-launch/",
"display": "psOff advanced launcher",
"file": "../LICENSE"
},
{
"url": "https://7-zip.org/",
"display": "7-Zip",
"file": "./3rd_license/7z-license.txt"
},
{
"url": "https://github.com/jbrems/color-wheel",
"display": "Color picker",
"file": "./3rd_license/colorpick-license.txt"
},
{
"url": "https://github.com/electron/forge",
"display": "Electron Forge",
"file": "./3rd_license/electron-forge-license.txt"
},
{
"url": "https://www.electronjs.org/",
"display": "Electron",
"file": "./3rd_license/electron-license.txt"
},
{
"url": "https://fontawesome.com/",
"display": "FontAwesome",
"file": "./3rd_license/fa-license.txt"
},
{
"url": "https://ffmpeg.org/",
"display": "FFmpeg",
"file": "./3rd_license/ffmpeg-license.txt"
},
{
"url": "https://github.com/eoussama/translator.js",
"display": "translator.js",
"file": "./3rd_license/translator-license.txt"
},
{
"url": "https://design.ubuntu.com/font",
"display": "Ubuntu Font",
"file": "./3rd_license/UFL.txt"
}
]
20 changes: 20 additions & 0 deletions webroot/css/legal.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#wrapper {
display: flex;
flex-direction: column;
}

#wrapper * {
width: 100%;
margin-bottom: 5px;
}

#license {
text-align: center;
height: 25px;
}

#licontents {
width: 100%;
height: 304px;
overflow-y: auto;
}
1 change: 1 addition & 0 deletions webroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<div id="titlebar">
<div class="title">psOff advanced launcher</div>
<div class="draggable"></div>
<div class="button tb-button legal fa-solid fa-scale-balanced"></div>
<div class="button tb-button options fa-solid fa-gear"></div>
<div class="button tb-button minimize fa-solid fa-window-minimize"></div>
<div class="button tb-button close fa-solid fa-xmark"></div>
Expand Down
2 changes: 2 additions & 0 deletions webroot/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ window._onLangReady = (() => {
window.electronAPI.sendCommand('showsettings');
} else if (tgc.contains('minimize')) {
window.electronAPI.sendCommand('minimize');
} else if (tgc.contains('legal')) {
window.open('legal.html', '_blank', 'frame=no,minWidth=630,minHeight=380,maxWidth=630,maxHeight=380,width=630,height=380');
}
});

Expand Down
45 changes: 45 additions & 0 deletions webroot/js/legal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
(() => {
const lics = $('#license');
const licu = $('#licurl');

$('#close').on('click', () => window.close());

const updateContents = () => {
const sel = lics.options[lics.selectedIndex];
const xhr = new XMLHttpRequest();

xhr.onload = () => {
if (xhr.status === 200) {
licontents.innerText = xhr.response;
}
}

xhr.open('get', sel.dataset.path);
xhr.send();
};

{
const xhr = new XMLHttpRequest();
xhr.responseType = 'json';

xhr.onload = () => {
if (xhr.status === 200) {
const htels = [];
const _jlist = xhr.response;

for (let i = 0; i < _jlist.length; ++i) {
const item = _jlist[i];
htels.push(`<option data-path="${item.file}" data-url="${item.url}">${item.display}</option>`);
}

lics.innerHTML = htels.join();
updateContents();
}
};

xhr.open('get', './3rd_license/list.json');
xhr.send();
}

lics.on('change', updateContents);
})();
23 changes: 23 additions & 0 deletions webroot/legal.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>

<head>
<meta http-equiv="Content-Security-Policy"
content="default-src 'none'; style-src 'self'; script-src 'self'; font-src 'self'; connect-src 'self';">
<link rel="stylesheet" href="css/shared.css" />
<link rel="stylesheet" href="css/legal.css" />
<script src="js/vars.js"></script>
</head>

<body>
<div id="wrapper">
<select id="license"></select>
<a href="#" id="licurl">Home page</a>
<div id="licontents"></div>
<button id="close">Close</button>
</div>

<script src="./js/legal.js"></script>
</body>

</html>

0 comments on commit 6f8ebda

Please sign in to comment.