Add authentication support (#185)

This commit is contained in:
Michael Green
2023-11-25 14:50:44 +11:00
committed by GitHub
parent 2ade60c551
commit 3d2f94681a
88 changed files with 6187 additions and 124 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 KiB

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" version="1.1" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5">
<path d="m14.25 8.75c-.5 2.5-2.3849 4.85363-5.03069 5.37991-2.64578.5263-5.33066-.7044-6.65903-3.0523-1.32837-2.34784-1.00043-5.28307.81336-7.27989 1.81379-1.99683 4.87636-2.54771 7.37636-1.54771"/>
<polyline points="5.75 7.75,8.25 10.25,14.25 3.75"/>
</svg>

After

Width:  |  Height:  |  Size: 579 B

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M16 7C16 9.20914 14.2091 11 12 11C9.79086 11 8 9.20914 8 7C8 4.79086 9.79086 3 12 3C14.2091 3 16 4.79086 16 7Z" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M12 14C8.13401 14 5 17.134 5 21H19C19 17.134 15.866 14 12 14Z" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 590 B

View File

@@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8" />
<script src="/api/v1.0/System/VersionFile"></script>
<script src="/api/v1.1/System/VersionFile"></script>
<link type="text/css" rel="stylesheet" dat-href="/styles/style.css" />
<script src="/scripts/jquery-3.6.0.min.js"></script>
<script src="/scripts/moment.js"></script>
@@ -38,6 +38,8 @@
head.appendChild(newLink);
}
}
var userProfile;
</script>
</head>
<body>
@@ -45,24 +47,35 @@
<img src="/images/logo.png" alt="Gaseous" id="banner_icon_image" />
</div>
<div id="banner_header">
<div id="banner_cog" onclick="window.location.href = '/index.html?page=settings';" class="banner_button">
<img src="/images/settings.svg" alt="Settings" title="Settings" id="banner_system_image" class="banner_button_image" />
<span id="banner_system_label">Settings</span>
</div>
<div id="bannerButtons">
<div id="banner_user" onclick="showMenu();" class="banner_button dropdown dropbtn">
<img src="/images/user.svg" alt="Account" title="Account" id="banner_user_image" class="banner_button_image" style="position: relative; top: 10px; right: 0px; pointer-events: none;" onclick="showMenu();" />
<div id="myDropdown" class="dropdown-content">
<div id="banner_user_roles"></div>
<a href="#" onclick="showDialog('userprofile');">Profile</a>
<a href="#" onclick="userLogoff();">Sign Out</a>
</div>
</div>
<div id="banner_cog" onclick="window.location.href = '/index.html?page=settings';" class="banner_button">
<img src="/images/settings.svg" alt="Settings" title="Settings" id="banner_system_image" class="banner_button_image" />
<span id="banner_system_label">Settings</span>
</div>
<div id="banner_upload" onclick="showDialog('upload');" class="banner_button">
<img src="/images/upload.svg" alt="Upload" title="Upload" id="banner_upload_image" class="banner_button_image" />
<span id="banner_upload_label">Upload</span>
</div>
<div id="banner_upload" onclick="showDialog('upload');" class="banner_button">
<img src="/images/upload.svg" alt="Upload" title="Upload" id="banner_upload_image" class="banner_button_image" />
<span id="banner_upload_label">Upload</span>
</div>
<div id="banner_collections" onclick="window.location.href = '/index.html?page=collections';" class="banner_button">
<img src="/images/collections.svg" alt="Collections" title="Collections" id="banner_collections_image" class="banner_button_image" />
<span id="banner_collections_label">Collections</span>
</div>
<div id="banner_collections" onclick="window.location.href = '/index.html?page=collections';" class="banner_button">
<img src="/images/collections.svg" alt="Collections" title="Collections" id="banner_collections_image" class="banner_button_image" />
<span id="banner_collections_label">Collections</span>
</div>
<div id="banner_library" onclick="window.location.href = '/index.html';" class="banner_button">
<img src="/images/library.svg" alt="Library" title="Library" id="banner_library_image" class="banner_button_image" />
<span id="banner_library_label">Library</span>
<div id="banner_library" onclick="window.location.href = '/index.html';" class="banner_button">
<img src="/images/library.svg" alt="Library" title="Library" id="banner_library_image" class="banner_button_image" />
<span id="banner_library_label">Library</span>
</div>
</div>
<div id="banner_header_label" onclick="window.location.href = '/index.html';">Gaseous Games</div>
@@ -96,18 +109,74 @@
</div>
<script type="text/javascript">var modalVariables = null;
<script type="text/javascript">
var modalVariables = null;
$(document).ready(function () {
var myParam = getQueryString('page', 'string');
// redirect if first run status = 0
if (FirstRunStatus == 0) {
window.location.replace("/pages/first.html");
}
if (!myParam) {
myParam = 'home';
// redirect if not logged in
ajaxCall(
'/api/v1.1/Account/Profile/Basic',
'GET',
function(result) {
console.log("User is logged in");
userProfile = result;
// hide the upload button if it's not permitted
var uploadButton = document.getElementById('banner_upload');
if (!userProfile.roles.includes("Admin") && !userProfile.roles.includes("Gamer")) {
uploadButton.style.display = 'none';
}
// populate page
var myParam = getQueryString('page', 'string');
if (!myParam) {
myParam = 'home';
}
$('#content').load('/pages/' + myParam + '.html?v=' + AppVersion);
},
function(error) {
window.location.replace("/pages/login.html");
}
);
$('#content').load('/pages/' + myParam + '.html?v=' + AppVersion);
});
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function showMenu() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown menu if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
function userLogoff() {
ajaxCall(
'/api/v1.1/Account/LogOff',
'POST',
function (result) {
location.replace("/index.html");
},
function (error) {
location.replace("/index.html");
}
);
}
</script>
</body>
</html>

View File

@@ -17,10 +17,17 @@
</div>
<script type="text/javascript">
var newCollectionButton = document.getElementById('collection_new');
if (userProfile.roles.includes("Admin") || userProfile.roles.includes("Gamer")) {
newCollectionButton.style.display = '';
} else {
newCollectionButton.style.display = 'none';
}
GetCollections();
function GetCollections() {
ajaxCall('/api/v1.0/Collections', 'GET', function (result) {
ajaxCall('/api/v1.1/Collections', 'GET', function (result) {
if (result) {
var targetDiv = document.getElementById('collection_table_location');
targetDiv.innerHTML = '';
@@ -47,7 +54,7 @@
break;
case "Completed":
statusText = 'Available';
downloadLink = '<a href="/api/v1.0/Collections/' + result[i].id + '/Roms/Zip" class="romlink"><img src="/images/download.svg" class="banner_button_image" alt="Download" title="Download" /></a>';
downloadLink = '<a href="/api/v1.1/Collections/' + result[i].id + '/Roms/Zip" class="romlink"><img src="/images/download.svg" class="banner_button_image" alt="Download" title="Download" /></a>';
packageSize = formatBytes(result[i].collectionBuiltSizeBytes);
break;
case "Failed":
@@ -58,9 +65,14 @@
break;
}
var editButton = '<a href="#" onclick="showDialog(\'collectionedit\', ' + result[i].id + ');" class="romlink"><img src="/images/edit.svg" class="banner_button_image" alt="Edit" title="Edit" /></a>';
var editButton = '';
var deleteButton = '';
if (userProfile.roles.includes("Admin") || userProfile.roles.includes("Gamer")) {
editButton = '<a href="#" onclick="showDialog(\'collectionedit\', ' + result[i].id + ');" class="romlink"><img src="/images/edit.svg" class="banner_button_image" alt="Edit" title="Edit" /></a>';
var deleteButton = '<a href="#" onclick="showSubDialog(\'collectiondelete\', ' + result[i].id + ');" class="romlink"><img src="/images/delete.svg" class="banner_button_image" alt="Delete" title="Delete" /></a>';
deleteButton = '<a href="#" onclick="showSubDialog(\'collectiondelete\', ' + result[i].id + ');" class="romlink"><img src="/images/delete.svg" class="banner_button_image" alt="Delete" title="Delete" /></a>';
}
var newRow = [
result[i].name,

View File

@@ -24,7 +24,7 @@
$('#collection_addgame').select2({
ajax: {
url: '/api/v1.0/Collections',
url: '/api/v1.1/Collections',
placeholder: 'Select collection',
processResults: function (data) {
var arr = [];
@@ -59,7 +59,7 @@
if (CollectionId != 0) {
ajaxCall(
'/api/v1.0/Collections/' + CollectionId + '/AlwaysInclude' + RebuildCollection,
'/api/v1.1/Collections/' + CollectionId + '/AlwaysInclude' + RebuildCollection,
'PATCH',
function (result) {
closeSubDialog();

View File

@@ -12,7 +12,7 @@
<script type="text/javascript">
function deleteCollection() {
ajaxCall(
'/api/v1.0/Collections/' + subModalVariables,
'/api/v1.1/Collections/' + subModalVariables,
'DELETE',
function (result) {
GetCollections();

View File

@@ -136,7 +136,7 @@
// setup dropdowns
$('#collection_platform').select2({
ajax: {
url: '/api/v1.0/Filter',
url: '/api/v1.1/Filter',
processResults: function (data) {
var filter = data['platforms'];
@@ -159,7 +159,7 @@
$('#collection_genres').select2({
ajax: {
url: '/api/v1.0/Filter',
url: '/api/v1.1/Filter',
processResults: function (data) {
var filter = data['genres'];
@@ -182,7 +182,7 @@
$('#collection_players').select2({
ajax: {
url: '/api/v1.0/Filter',
url: '/api/v1.1/Filter',
processResults: function (data) {
var filter = data['gamemodes'];
@@ -205,7 +205,7 @@
$('#collection_playerperspectives').select2({
ajax: {
url: '/api/v1.0/Filter',
url: '/api/v1.1/Filter',
processResults: function (data) {
var filter = data['playerperspectives'];
@@ -228,7 +228,7 @@
$('#collection_themes').select2({
ajax: {
url: '/api/v1.0/Filter',
url: '/api/v1.1/Filter',
processResults: function (data) {
var filter = data['themes'];
@@ -258,7 +258,7 @@
// edit mode
ajaxCall(
'/api/v1.0/Collections/' + modalVariables,
'/api/v1.1/Collections/' + modalVariables,
'GET',
function(result) {
if (result.name) { document.getElementById('collection_name').value = result.name; }
@@ -278,7 +278,7 @@
// fill select2 controls
$.ajax(
{
url: '/api/v1.0/Filter',
url: '/api/v1.1/Filter',
type: 'GET',
indexValue: result,
dataType: 'json',
@@ -344,7 +344,7 @@
// existing object - save over the top
item.id = modalVariables;
ajaxCall(
'/api/v1.0/Collections/' + modalVariables,
'/api/v1.1/Collections/' + modalVariables,
'PATCH',
function(result) {
location.reload();
@@ -357,7 +357,7 @@
} else {
// new object
ajaxCall(
'/api/v1.0/Collections',
'/api/v1.1/Collections',
'POST',
function(result) {
location.reload();
@@ -426,7 +426,7 @@
var item = GenerateCollectionItem();
ajaxCall(
'/api/v1.0/Collections/Preview',
'/api/v1.1/Collections/Preview',
'POST',
function(result) {
DisplayPreview(result, 'collectionedit_previewbox_content');
@@ -579,7 +579,7 @@
var gameImage = document.createElement('img');
gameImage.className = 'game_tile_image game_tile_image_small';
if (gameItem.cover) {
gameImage.src = '/api/v1.0/Games/' + gameItem.id + '/cover/image';
gameImage.src = '/api/v1.1/Games/' + gameItem.id + '/cover/image';
} else {
gameImage.src = '/images/unknowngame.png';
gameImage.className = 'game_tile_image game_tile_image_small unknown';

View File

@@ -12,7 +12,7 @@
<script type="text/javascript">
function deleteLibrary() {
ajaxCall(
'/api/v1.0/Library/' + subModalVariables,
'/api/v1.1/Library/' + subModalVariables,
'DELETE',
function (result) {
drawLibrary();

View File

@@ -32,7 +32,7 @@
$('#newlibrary_defaultplatform').select2({
minimumInputLength: 3,
ajax: {
url: '/api/v1.0/Search/Platform',
url: '/api/v1.1/Search/Platform',
data: function (params) {
var query = {
SearchString: params.term
@@ -76,7 +76,7 @@
alert("A path must be provided.");
} else {
ajaxCall(
'/api/v1.0/Library?Name=' + encodeURIComponent(libName) + '&DefaultPlatformId=' + libPlatform[0].id + '&Path=' + encodeURIComponent(libPath),
'/api/v1.1/Library?Name=' + encodeURIComponent(libName) + '&DefaultPlatformId=' + libPlatform[0].id + '&Path=' + encodeURIComponent(libPath),
'POST',
function(result) {
drawLibrary();

View File

@@ -12,7 +12,7 @@
<script type="text/javascript">
function deleteCollection() {
ajaxCall(
'/api/v1.0/Games/' + gameData.id + '/romgroup/' + subModalVariables,
'/api/v1.1/Games/' + gameData.id + '/romgroup/' + subModalVariables,
'DELETE',
function (result) {
loadRoms();

View File

@@ -105,7 +105,7 @@
DisplayWebEmulatorContent(false);
ajaxCall(
'/api/v1.0/PlatformMaps/' + modalVariables,
'/api/v1.1/PlatformMaps/' + modalVariables,
'GET',
function (result) {
// set heading
@@ -338,7 +338,7 @@
console.log(JSON.stringify(item));
ajaxCall(
'/api/v1.0/PlatformMaps/' + modalVariables,
'/api/v1.1/PlatformMaps/' + modalVariables,
'PATCH',
function (result) {
loadPlatformMapping();

View File

@@ -11,7 +11,7 @@
<script type="text/javascript">
function deleteRom() {
ajaxCall('/api/v1.0/Games/' + gameId + '/roms/' + modalVariables, 'DELETE', function (result) {
ajaxCall('/api/v1.1/Games/' + gameId + '/roms/' + modalVariables, 'DELETE', function (result) {
window.location.reload();
});
}

View File

@@ -118,7 +118,7 @@
}
}
ajaxCall('/api/v1.0/Games/' + gameId + '/roms/' + modalVariables, 'GET', function (result) {
ajaxCall('/api/v1.1/Games/' + gameId + '/roms/' + modalVariables, 'GET', function (result) {
romData = result;
document.getElementById('modal-heading').innerHTML = result.name;
document.getElementById('rominfo_library').innerHTML = result.library.name;
@@ -169,7 +169,7 @@
$('#properties_fixplatform').select2({
minimumInputLength: 3,
ajax: {
url: '/api/v1.0/Search/Platform',
url: '/api/v1.1/Search/Platform',
data: function (params) {
var query = {
SearchString: params.term
@@ -200,7 +200,7 @@
minimumInputLength: 3,
templateResult: DropDownRenderGameOption,
ajax: {
url: '/api/v1.0/Search/Game',
url: '/api/v1.1/Search/Game',
data: function (params) {
fixplatform = $('#properties_fixplatform').select2('data');
@@ -236,7 +236,7 @@
document.getElementById('properties_fixsave').setAttribute("disabled", "disabled");
ajaxCall('/api/v1.0/Games/' + gameId + '/roms/' + modalVariables + '?NewPlatformId=' + fixplatform[0].id + '&NewGameId=' + fixgame[0].id, 'PATCH', function (result) {
ajaxCall('/api/v1.1/Games/' + gameId + '/roms/' + modalVariables + '?NewPlatformId=' + fixplatform[0].id + '&NewGameId=' + fixgame[0].id, 'PATCH', function (result) {
window.location.reload();
});
}

View File

@@ -0,0 +1,29 @@
<p>Are you sure you want to delete the selected user?</p>
<p><strong>Warning:</strong> This cannot be undone!</p>
<div style="width: 100%; text-align: center;">
<div style="display: inline-block; margin-right: 20px;">
<button class="redbutton" value="Delete" onclick="deleteUserCallback();">Delete</button>
</div>
<div style="display: inline-block; margin-left: 20px;">
<button value="Cancel" onclick="closeSubDialog();">Cancel</button>
</div>
</div>
<script type="text/javascript">
function deleteUserCallback() {
ajaxCall(
'/api/v1.1/Account/Users/' + subModalVariables,
'DELETE',
function(result) {
console.log('Deleted user');
GetUsers();
closeSubDialog();
},
function(error) {
console.log(JSON.stringify(error));
GetUsers();
closeSubDialog();
}
);
}
</script>

View File

@@ -0,0 +1,375 @@
<div id="properties_toc">
<div id="properties_user_toc_password" name="properties_user_toc_item" onclick="UserSelectTab('password');">Password</div>
<div id="properties_user_toc_role" name="properties_user_toc_item" onclick="UserSelectTab('role');">Role</div>
<div id="properties_user_toc_age" name="properties_user_toc_item" onclick="UserSelectTab('age');">Content Restrictions</div>
<!--<div id="properties_toc_manage" name="properties_toc_item" onclick="SelectTab('manage');">Manage</div>-->
</div>
<div id="properties_bodypanel" style="height: 450px; overflow-y: scroll;">
<div id="properties_bodypanel_password" name="properties_user_tab" style="display: none;">
<table style="width: 100%;">
<tr>
<th>
Password
</th>
<td>
<input type="password" id="settings_users_edit_password" style="width: 95%;" onkeyup="checkPasswordsMatch();" />
</td>
</tr>
<tr>
<th>
Confirm password
</th>
<td>
<input type="password" id="settings_users_edit_confirmpassword" style="width: 95%;" onkeyup="checkPasswordsMatch();" />
</td>
</tr>
<tr>
<td colspan="2" id="settings_users_edit_label"></td>
</tr>
</table>
</div>
<div id="properties_bodypanel_role" name="properties_user_tab" style="display: none;">
<table style="width: 100%;" class="romtable">
<tr>
<th>
</th>
<th>
<input type="radio" name="settings_user_role" id="settings_user_role_player" value="Player"> <label for="settings_user_role_player">Player</label>
</th>
<th>
<input type="radio" name="settings_user_role" id="settings_user_role_gamer" value="Gamer"> <label for="settings_user_role_gamer">Gamer</label>
</th>
<th>
<input type="radio" name="settings_user_role" id="settings_user_role_admin" value="Admin"> <label for="settings_user_role_admin">Administrator</label>
</th>
</tr>
<tr>
<th colspan="4"><h3>Games and ROM's</h3></td>
</tr>
<tr class="romrow">
<td class="romcell">Play games</td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr class="romrow">
<td class="romcell">Download ROM images</td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr class="romrow">
<td class="romcell">Upload ROM images</td>
<td class="romcell"></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr class="romrow">
<td class="romcell">Create and delete multidisk packages</td>
<td class="romcell"></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr class="romrow">
<td class="romcell">Delete ROM images</td>
<td class="romcell"></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr class="romrow">
<td class="romcell">Fix ROM image matches</td>
<td class="romcell"></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr>
<th colspan="4"><h3>Collections</h3></td>
</tr>
<tr class="romrow">
<td class="romcell">Download packages</td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr class="romrow">
<td class="romcell">Create packages</td>
<td class="romcell"></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr class="romrow">
<td class="romcell">Edit packages</td>
<td class="romcell"></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr class="romrow">
<td class="romcell">Delete packages</td>
<td class="romcell"></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr>
<th colspan="4"><h3>Settings</h3></td>
</tr>
<tr class="romrow">
<td class="romcell">Download firmware</td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr class="romrow">
<td class="romcell">View background tasks</td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr class="romrow">
<td class="romcell">View platform mapping</td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr class="romrow">
<td class="romcell">Modify platform mapping</td>
<td class="romcell"></td>
<td class="romcell"></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr class="romrow">
<td class="romcell">Manually start background tasks</td>
<td class="romcell"></td>
<td class="romcell"></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr class="romrow">
<td class="romcell">View logs</td>
<td class="romcell"></td>
<td class="romcell"></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
<tr class="romrow">
<td class="romcell">Manage user accounts</td>
<td class="romcell"></td>
<td class="romcell"></td>
<td class="romcell"><img src="/images/tick.svg" class="banner_button_image" /></td>
</tr>
</table>
</div>
<div id="properties_bodypanel_age" name="properties_user_tab" style="display: none;">
<h3>Classification Restrictions</h3>
<div id="properties_bodypanel_age_classification">
</div>
<input type="checkbox" id="properties_bodypanel_age_includeunclassified"> <label for="properties_bodypanel_age_includeunclassified">Include unclassified titles</label>
</div>
</div>
<div style="width: 100%; padding-top: 10px; text-align: right;">
<button id="settings_users_edit_okbutton" value="OK" onclick="saveProperties();">OK</button>
</div>
<script type="text/javascript">
ajaxCall(
'/api/v1.1/Account/users/' + modalVariables,
'GET',
function(result) {
document.getElementById('modal-heading').innerHTML = result.emailAddress;
// role page
document.getElementById('settings_user_role_' + result.highestRole.toLowerCase()).checked = true;
// age restriction page
var ageRatingsContainer = document.getElementById('properties_bodypanel_age_classification');
var ageRatingsTable = document.createElement('table');
ageRatingsTable.style.width = '100%';
ageRatingsTable.cellSpacing = 0;
ageRatingsTable.appendChild(
createTableRow(
true,
[
'Highest Allowed Rating',
'Included Ratings'
],
'',
''
)
);
for (var ageGroup in AgeRatingGroups) {
if (AgeRatingGroups.hasOwnProperty(ageGroup)) {
var ratingsValues = '';
var classBoards = AgeRatingGroups[ageGroup];
for (var classBoard in classBoards) {
for (var rating in classBoards[classBoard]) {
ratingsValues += "<img src='/api/v1.1/Ratings/Images/" + classBoard + "/" + classBoards[classBoard][rating] + "/image.svg' class='rating_image_mini' />";
}
}
var radioCheckedState = '';
if (result.securityProfile.ageRestrictionPolicy.maximumAgeRestriction.toLowerCase() == ageGroup.toLocaleLowerCase()) {
radioCheckedState = "checked='checked'";
}
ageRatingsTable.appendChild(
createTableRow(
false,
[
"<input type='radio' id='properties_bodypanel_age_classification_" + ageGroup + "' name='classification_group' " + radioCheckedState + " value='" + ageGroup + "' /> <label for='properties_bodypanel_age_classification_" + ageGroup + "'>" + ageGroup + "</label>",
ratingsValues
],
'romrow',
'romcell'
)
);
}
}
ageRatingsContainer.appendChild(ageRatingsTable);
document.getElementById('properties_bodypanel_age_includeunclassified').checked = result.securityProfile.ageRestrictionPolicy.includeUnrated;
},
function(error) {
closeDialog();
}
);
function UserSelectTab(TabName) {
var tabs = document.getElementsByName('properties_user_tab');
for (var i = 0; i < tabs.length; i++) {
if ((tabs[i].id) == ("properties_bodypanel_" + TabName)) {
tabs[i].style.display = '';
} else {
tabs[i].style.display = 'none';
}
}
var tocs = document.getElementsByName('properties_user_toc_item');
for (var i = 0; i < tocs.length; i++) {
if ((tocs[i].id) == ("properties_user_toc_" + TabName)) {
tocs[i].className = "properties_toc_item_selected";
} else {
tocs[i].className = '';
}
}
}
function checkPasswordsMatch() {
var newPassword = document.getElementById('settings_users_edit_password').value;
var conPassword = document.getElementById('settings_users_edit_confirmpassword').value;
var errorLabel = document.getElementById('settings_users_edit_label');
var submitButton = document.getElementById('settings_users_edit_okbutton');
if (newPassword.length > 0) {
if (newPassword == conPassword) {
// check if password meets requirements
if (newPassword.length > 10) {
errorLabel.innerHTML = "";
submitButton.removeAttribute('disabled');
return true;
} else {
errorLabel.innerHTML = "Password should be at least 10 characters long";
submitButton.setAttribute('disabled', 'disabled');
return false;
}
} else {
errorLabel.innerHTML = "New and confirmed passwords do not match";
submitButton.setAttribute('disabled', 'disabled');
return false;
}
} else {
errorLabel.innerHTML = "Password will not be changed";
submitButton.removeAttribute('disabled');
return true;
}
}
function saveProperties() {
saveRole();
}
function saveRole() {
if (checkPasswordsMatch() == true) {
// process role
var selectedRole = $("input[type='radio'][name='settings_user_role']:checked").val();
ajaxCall(
'/api/v1.1/Account/users/' + modalVariables + '/Roles?RoleName=' + selectedRole,
'POST',
function(result) {
saveSecurityProfile();
},
function(error) {
saveSecurityProfile();
}
);
}
}
function saveSecurityProfile() {
if (checkPasswordsMatch() == true) {
// process security profile
var securityProfile = {
"ageRestrictionPolicy": {
"maximumAgeRestriction": $("input[type='radio'][name='classification_group']:checked").val(),
"includeUnrated": document.getElementById('properties_bodypanel_age_includeunclassified').checked
}
};
ajaxCall(
'/api/v1.1/Account/users/' + modalVariables + '/SecurityProfile',
'POST',
function(result) {
savePassword();
},
function(error) {
savePassword();
},
JSON.stringify(securityProfile)
);
}
}
function savePassword() {
console.log("Save Password");
if (checkPasswordsMatch() == true) {
console.log("Passwords match");
var newPassword = document.getElementById('settings_users_edit_password').value;
if (newPassword.length > 0) {
var model = {
"newPassword": newPassword,
"confirmPassword": newPassword
}
ajaxCall(
'/api/v1.1/Account/Users/' + modalVariables + '/Password',
'POST',
function(result) {
console.log(JSON.stringify(result));
savePropertiesCallback();
},
function(error) {
console.log(JSON.stringify(error));
savePropertiesCallback();
},
JSON.stringify(model)
);
} else {
console.log("Password not long enough to change");
savePropertiesCallback();
}
} else {
console.log("Passwords don't match");
}
}
function savePropertiesCallback() {
GetUsers();
closeDialog();
}
UserSelectTab('password');
</script>

View File

@@ -0,0 +1,88 @@
<h3>New User</h3>
<table style="width: 100%;">
<tr>
<th>
Email
</th>
<td>
<input type="text" id="settings_users_new_username" style="width: 95%;" onkeyup="checkPasswordsMatch();" />
</td>
</tr>
<tr>
<th>
Password
</th>
<td>
<input type="password" id="settings_users_new_password" style="width: 95%;" onkeyup="checkPasswordsMatch();" />
</td>
</tr>
<tr>
<th>
Confirm password
</th>
<td>
<input type="password" id="settings_users_new_confirmpassword" style="width: 95%;" onkeyup="checkPasswordsMatch();" />
</td>
</tr>
<tr>
<td colspan="2" id="settings_users_new_label"></td>
</tr>
<tr>
<td colspan="2" style="text-align: right; padding-top: 10px;">
<button value="OK" id="settings_users_new_okbutton" disabled="disabled" onclick="createUser();">OK</button><button value="Cancel" onclick="closeSubDialog();">Cancel</button>
</td>
</tr>
</table>
<script type="text/javascript">
function checkPasswordsMatch() {
var userNameVal = document.getElementById('settings_users_new_username').value;
var newPassword = document.getElementById('settings_users_new_password').value;
var conPassword = document.getElementById('settings_users_new_confirmpassword').value;
var errorLabel = document.getElementById('settings_users_new_label');
var submitButton = document.getElementById('settings_users_new_okbutton');
if (userNameVal.includes("@")) {
if (newPassword == conPassword) {
// check if password meets requirements
if (newPassword.length > 10) {
errorLabel.innerHTML = "";
submitButton.removeAttribute('disabled');
} else {
errorLabel.innerHTML = "Password should be at least 10 characters long";
submitButton.setAttribute('disabled', 'disabled');
}
} else {
errorLabel.innerHTML = "New and confirmed passwords do not match";
submitButton.setAttribute('disabled', 'disabled');
}
} else {
errorLabel.innerHTML = "Email address is invalid";
submitButton.setAttribute('disabled', 'disabled');
}
}
function createUser() {
var model = {
"userName": document.getElementById('settings_users_new_username').value,
"email": document.getElementById('settings_users_new_username').value,
"password": document.getElementById('settings_users_new_password').value,
"confirmPassword": document.getElementById('settings_users_new_confirmpassword').value
}
ajaxCall(
'/api/v1.1/Account/Users',
'POST',
function(result) {
GetUsers();
closeSubDialog();
},
function(error) {
GetUsers();
closeSubDialog();
},
JSON.stringify(model)
);
}
</script>

View File

@@ -28,7 +28,7 @@
document.getElementById('upload_platformoverride').innerHTML = "<option value='0' selected='selected'>Automatic Platform</option>";
var myDropzone = new Dropzone("div#upload_target", {
url: "/api/v1.0/Roms",
url: "/api/v1.1/Roms",
autoProcessQueue: true,
uploadMultiple: true,
paramName: myParamName,
@@ -84,7 +84,7 @@
$('#upload_platformoverride').select2({
minimumInputLength: 3,
ajax: {
url: '/api/v1.0/Search/Platform',
url: '/api/v1.1/Search/Platform',
data: function (params) {
var query = {
SearchString: params.term
@@ -125,6 +125,6 @@
}
console.log(queryString);
myDropzone.options.url = "/api/v1.0/Roms" + queryString;
myDropzone.options.url = "/api/v1.1/Roms" + queryString;
});
</script>

View File

@@ -0,0 +1,122 @@
<div id="properties_toc">
<div id="properties_profile_toc_general" name="properties_profile_toc_item" onclick="ProfileSelectTab('general');">Account</div>
</div>
<div id="properties_bodypanel">
<div id="properties_bodypanel_general" name="properties_profile_tab" style="display: none;">
<h3>Reset Password</h3>
<table style="width: 100%;">
<tr>
<th>Old Password</th>
<td><input type="password" id="profile_oldpassword" style="width: 95%;" /></td>
</tr>
<tr>
<th>New Password</th>
<td><input type="password" id="profile_newpassword" style="width: 95%;" onkeyup="checkPasswordsMatch();" /></td>
</tr>
<tr>
<th>Confirm Password</th>
<td><input type="password" id="profile_confirmpassword" style="width: 95%;" onkeyup="checkPasswordsMatch();" /></td>
</tr>
<tr>
<td colspan="2" id="profile_passwordnotice"></td>
</tr>
<tr>
<td colspan="2" style="text-align: right;">
<button id="profile_resetpassword" value="Reset Password" disabled="disabled" onclick="ResetPassword();">Reset Password</button>
</td>
</tr>
</table>
</div>
</div>
<script type="text/javascript">
document.getElementById('modal-heading').innerHTML = userProfile.emailAddress;
function ProfileSelectTab(TabName) {
var tabs = document.getElementsByName('properties_profile_tab');
for (var i = 0; i < tabs.length; i++) {
if ((tabs[i].id) == ("properties_bodypanel_" + TabName)) {
tabs[i].style.display = '';
} else {
tabs[i].style.display = 'none';
}
}
var tocs = document.getElementsByName('properties_profile_toc_item');
for (var i = 0; i < tocs.length; i++) {
if ((tocs[i].id) == ("properties_profile_toc_" + TabName)) {
tocs[i].className = "properties_toc_item_selected";
} else {
tocs[i].className = '';
}
}
}
function checkPasswordsMatch() {
var oldPassword = document.getElementById('profile_oldpassword').value;
var newPassword = document.getElementById('profile_newpassword').value;
var conPassword = document.getElementById('profile_confirmpassword').value;
var errorLabel = document.getElementById('profile_passwordnotice');
var submitButton = document.getElementById('profile_resetpassword');
// make sure the new password is not the same as the old one
if (newPassword == oldPassword) {
errorLabel.innerHTML = "New password should not match the old password";
submitButton.setAttribute('disabled', 'disabled');
} else {
if (newPassword == conPassword) {
// check if password meets requirements
if (newPassword.length > 10) {
errorLabel.innerHTML = "";
submitButton.removeAttribute('disabled');
} else {
errorLabel.innerHTML = "Password should be at least 10 characters long";
submitButton.setAttribute('disabled', 'disabled');
}
} else {
errorLabel.innerHTML = "New and confirmed passwords do not match";
submitButton.setAttribute('disabled', 'disabled');
}
}
}
function ResetPassword() {
var oldPassword = document.getElementById('profile_oldpassword').value;
var newPassword = document.getElementById('profile_newpassword').value;
var conPassword = document.getElementById('profile_confirmpassword').value;
var model = {
"OldPassword": oldPassword,
"NewPassword": newPassword,
"ConfirmPassword": conPassword
}
ajaxCall(
'/api/v1.1/Account/ChangePassword',
'POST',
function(result) {
ResetPasswordCallback(result);
},
function(error) {
ResetPasswordCallback(error);
},
JSON.stringify(model)
);
}
function ResetPasswordCallback(result) {
var errorLabel = document.getElementById('profile_passwordnotice');
if (result.succeeded == false) {
errorLabel.innerHTML = result.errors.description;
} else {
document.getElementById('profile_oldpassword').value = '';
document.getElementById('profile_newpassword').value = '';
document.getElementById('profile_confirmpassword').value = '';
document.getElementById('profile_resetpassword').setAttribute('disabled', 'disabled');
errorLabel.innerHTML = "Password changed.";
}
}
ProfileSelectTab('general');
</script>

View File

@@ -15,7 +15,7 @@
var emuBios = '';
var emuBackground = '';
ajaxCall('/api/v1.0/Games/' + gameId, 'GET', function (result) {
ajaxCall('/api/v1.1/Games/' + gameId, 'GET', function (result) {
gameData = result;
// load artwork
@@ -27,22 +27,22 @@
} else {
if (result.cover) {
var bg = document.getElementById('bgImage');
bg.setAttribute('style', 'background-image: url("/api/v1.0/Games/' + gameId + '/cover/image"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);');
bg.setAttribute('style', 'background-image: url("/api/v1.1/Games/' + gameId + '/cover/image"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);');
}
}
if (result.cover) {
emuBackground = '/api/v1.0/Games/' + gameId + '/cover/image';
emuBackground = '/api/v1.1/Games/' + gameId + '/cover/image';
}
emuGameTitle = gameData.name;
});
ajaxCall('/api/v1.0/Bios/' + platformId, 'GET', function (result) {
ajaxCall('/api/v1.1/Bios/' + platformId, 'GET', function (result) {
if (result.length == 0) {
emuBios = '';
} else {
emuBios = '/api/v1.0/Bios/zip/' + platformId;
emuBios = '/api/v1.1/Bios/zip/' + platformId;
}
switch (getQueryString('engine', 'string')) {
@@ -59,7 +59,7 @@
artworksPosition = 0;
}
var bg = document.getElementById('bgImage');
bg.setAttribute('style', 'background-image: url("/api/v1.0/Games/' + gameId + '/artwork/' + artworks[artworksPosition] + '/image"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);');
bg.setAttribute('style', 'background-image: url("/api/v1.1/Games/' + gameId + '/artwork/' + artworks[artworksPosition] + '/image"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);');
}
}
</script>

View File

@@ -0,0 +1,167 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="/api/v1.1/System/VersionFile"></script>
<link type="text/css" rel="stylesheet" dat-href="/styles/style.css" />
<script src="/scripts/jquery-3.6.0.min.js"></script>
<script src="/scripts/moment.js"></script>
<link href="/styles/select2.min.css" rel="stylesheet" />
<link href="/styles/dropzone.min.css" rel="stylesheet" type="text/css" />
<script src="/scripts/jquery.lazy.min.js"></script>
<script src="/scripts/jquery.lazy.plugins.min.js"></script>
<script src="/scripts/select2.min.js"></script>
<script src="/scripts/dropzone.min.js"></script>
<script src="/scripts/simpleUpload.min.js"></script>
<script src="/scripts/main.js" type="text/javascript"></script>
<script src="/scripts/filterformating.js" type="text/javascript"></script>
<script src="/scripts/gamesformating.js" type="text/javascript"></script>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<title>Gaseous Games</title>
<script type="text/javascript">
var head = document.getElementsByTagName('head')[0];
// update links
var headLinks = document.getElementsByTagName('link');
for (var i = 0; i < headLinks.length; i++) {
if (headLinks[i].getAttribute('dat-href') && headLinks[i].rel == "stylesheet") {
var newLink = document.createElement('link');
newLink.rel = "stylesheet";
newLink.href = headLinks[i].getAttribute('dat-href') + '?v=' + AppVersion;
newLink.type = "text/css";
headLinks[i].parentElement.removeChild(headLinks[i]);
head.appendChild(newLink);
}
}
</script>
</head>
<body>
<div id="bgImage" style="background-image: url('/images/LoginWallpaper.jpg'); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);">
<div id="bgImage_Opacity"></div>
</div>
<div id="content">
<div class="loginwindow" id="first_welcome">
<div id="welcomeform" class="loginwindow-content">
<img src="/images/logo.png" style="display: block; margin: 20px auto;" />
<div id="loginwindow_header_label" style="display: block; text-align: center;">Gaseous Games</div>
<button type="button" value="Get Started" onclick="document.getElementById('first_welcome').style.display = 'none'; document.getElementById('first_newadmin').style.display = '';" style="margin-top: 50px; width: 100%; font-size: 16px; border-radius: 10px; padding-top: 10px; padding-bottom: 10px;">Get Started</button>
</div>
</div>
<div class="loginwindow" id="first_newadmin" style="display: none;">
<div id="loginform" class="loginwindow-content">
<img src="/images/logo.png" style="display: block; margin: 20px auto;" />
<div id="loginwindow_header_label" style="display: block; text-align: center;">Gaseous Games</div>
<table style="width: 100%; margin-top: 20px;" cellpadding="5px">
<tr>
<td colspan="2" style="font-size: 18px;">Create your account.</td>
</tr>
<tr>
<th>Email</th>
<td><input type="email" id="login_email" style="width: 95%;" onkeyup="checkPasswordsMatch();" /></td>
</tr>
<tr>
<th>New Password</th>
<td><input type="password" id="login_password" style="width: 95%;" onkeyup="checkPasswordsMatch();" /></td>
</tr>
<tr>
<th>Confirm Password</th>
<td><input type="password" id="login_confirmpassword" style="width: 95%;" onkeyup="checkPasswordsMatch();" /></td>
</tr>
<tr>
<td colspan="2" id="login_passwordnotice">&nbsp;</td>
</tr>
<tr>
<td colspan="2" style="padding-top: 20px;">
<button id="login_createaccount" type="button" value="Create Account" onclick="registerAccount();" disabled="disabled" style="margin-top: 10px; width: 100%; font-size: 16px; border-radius: 10px; padding-top: 10px; padding-bottom: 10px;">Create Account</button>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="settings_photocredit">
Wallpaper by <a href="https://unsplash.com/@spideyjoey" class="romlink">Joey Kwok</a> / <a href="https://unsplash.com/photos/a-room-filled-with-arcade-machines-and-neon-lights-jbIsTd7rdd8" class="romlink">Unsplash</a>
</div>
<script type="text/javascript">
// redirect if first run status != 0 as 0 indicates that first run needs to be run
if (FirstRunStatus != 0) {
window.location.replace("/");
}
function checkPasswordsMatch() {
var emailAddress = document.getElementById('login_email').value;
var newPassword = document.getElementById('login_password').value;
var conPassword = document.getElementById('login_confirmpassword').value;
var errorLabel = document.getElementById('login_passwordnotice');
var submitButton = document.getElementById('login_createaccount');
// make sure email address is valid
if (!emailAddress.includes("@")) {
errorLabel.innerHTML = "Please enter a valid email address";
submitButton.setAttribute('disabled', 'disabled');
} else {
if (newPassword == conPassword) {
// check if password meets requirements
if (newPassword.length > 10) {
errorLabel.innerHTML = "&nbsp;";
submitButton.removeAttribute('disabled');
} else {
errorLabel.innerHTML = "Password should be at least 10 characters long";
submitButton.setAttribute('disabled', 'disabled');
}
} else {
errorLabel.innerHTML = "New and confirmed passwords do not match";
submitButton.setAttribute('disabled', 'disabled');
}
}
}
function registerAccount() {
var emailAddress = document.getElementById('login_email').value;
var newPassword = document.getElementById('login_password').value;
var conPassword = document.getElementById('login_confirmpassword').value;
var model = {
"userName": emailAddress,
"email": emailAddress,
"password": newPassword,
"confirmPassword": conPassword
};
ajaxCall(
'/api/v1.1/FirstSetup/0',
'POST',
function(result){
loginCallback(result);
},
function(error){
loginCallback(error);
},
JSON.stringify(model)
);
}
function loginCallback(result) {
switch(result.status) {
case 200:
window.location.replace('/index.html');
break;
default:
// login failed
break;
}
}
</script>
</body>

View File

@@ -94,7 +94,7 @@
var artworksTimer = null;
var selectedScreenshot = 0;
ajaxCall('/api/v1.0/Games/' + gameId, 'GET', function (result) {
ajaxCall('/api/v1.1/Games/' + gameId, 'GET', function (result) {
// populate games page
gameData = result;
@@ -116,7 +116,7 @@
// get alt name
var gameTitleAltLabel = document.getElementById('gametitle_alts');
if (result.alternativeNames) {
ajaxCall('/api/v1.0/Games/' + gameId + '/alternativename', 'GET', function (result) {
ajaxCall('/api/v1.1/Games/' + gameId + '/alternativename', 'GET', function (result) {
var altNames = '';
for (var i = 0; i < result.length; i++) {
if (altNames.length > 0) {
@@ -161,7 +161,7 @@
} else {
var bg = document.getElementById('bgImage');
if (result.cover) {
bg.setAttribute('style', 'background-image: url("/api/v1.0/Games/' + gameId + '/cover/image"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);');
bg.setAttribute('style', 'background-image: url("/api/v1.1/Games/' + gameId + '/cover/image"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);');
} else {
var randomInt = randomIntFromInterval(1, 3);
bg.setAttribute('style', 'background-image: url("/images/gamebg' + randomInt + '.jpg"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);');
@@ -175,7 +175,7 @@
var gameDeveloperLoaded = false;
var gamePublisherLoaded = false;
if (result.involvedCompanies) {
ajaxCall('/api/v1.0/games/' + gameId + '/companies', 'GET', function (result) {
ajaxCall('/api/v1.1/games/' + gameId + '/companies', 'GET', function (result) {
var lstDevelopers = [];
var lstPublishers = [];
@@ -227,7 +227,7 @@
var gameImage = document.createElement('img');
gameImage.className = 'game_cover_image';
if (result.cover) {
gameImage.src = '/api/v1.0/Games/' + result.id + '/cover/image';
gameImage.src = '/api/v1.1/Games/' + result.id + '/cover/image';
} else {
gameImage.src = '/images/unknowngame.png';
gameImage.className = 'game_cover_image unknown';
@@ -240,7 +240,7 @@
var gameRatings = document.createElement('div');
for (var i = 0; i < result.ageRatings.ids.length; i++) {
var ratingImage = document.createElement('img');
ratingImage.src = '/api/v1.0/Games/' + result.id + '/agerating/' + result.ageRatings.ids[i] + '/image';
ratingImage.src = '/api/v1.1/Games/' + result.id + '/agerating/' + result.ageRatings.ids[i] + '/image';
ratingImage.className = 'rating_image';
gameRatings.appendChild(ratingImage);
}
@@ -252,7 +252,7 @@
// load genres
var gameSummaryGenres = document.getElementById('gamesumarry_genres');
if (result.genres) {
ajaxCall('/api/v1.0/Games/' + gameId + '/genre', 'GET', function (result) {
ajaxCall('/api/v1.1/Games/' + gameId + '/genre', 'GET', function (result) {
for (var i = 0; i < result.length; i++) {
var genreLabel = document.createElement('span');
genreLabel.className = 'gamegenrelabel';
@@ -281,7 +281,7 @@
var screenshotItem = document.createElement('div');
screenshotItem.id = 'gamescreenshots_gallery_' + imageIndex;
screenshotItem.setAttribute('name', 'gamescreenshots_gallery_item');
screenshotItem.setAttribute('style', 'background-image: url("/api/v1.0/Games/' + gameId + '/screenshots/' + result.screenshots.ids[i] + '/image"); background-position: center; background-repeat: no-repeat; background-size: contain;)');
screenshotItem.setAttribute('style', 'background-image: url("/api/v1.1/Games/' + gameId + '/screenshots/' + result.screenshots.ids[i] + '/image"); background-position: center; background-repeat: no-repeat; background-size: contain;)');
screenshotItem.setAttribute('imageid', imageIndex);
screenshotItem.setAttribute('imagetype', 0);
screenshotItem.className = 'gamescreenshots_gallery_item';
@@ -293,7 +293,7 @@
// load videos
if (result.videos) {
ajaxCall('/api/v1.0/Games/' + gameId + '/videos', 'GET', function (result) {
ajaxCall('/api/v1.1/Games/' + gameId + '/videos', 'GET', function (result) {
var gameScreenshots_vGallery = document.getElementById('gamescreenshots_gallery_panel');
for (var i = 0; i < result.length; i++) {
var vScreenshotItem = document.createElement('div');
@@ -360,7 +360,7 @@
}
var gameRoms = document.getElementById('gamesummaryroms');
ajaxCall('/api/v1.0/Games/' + gameId + '/roms', 'GET', function (result) {
ajaxCall('/api/v1.1/Games/' + gameId + '/roms', 'GET', function (result) {
if (result.gameRomItems) {
var gameRomItems = result.gameRomItems;
var mediaGroups = result.mediaGroups;
@@ -391,14 +391,14 @@
if (result.gameRomItems[i].emulator) {
if (gameRomItems[i].emulator.type) {
if (gameRomItems[i].emulator.type.length > 0) {
launchButton = '<a href="/index.html?page=emulator&engine=' + gameRomItems[i].emulator.type + '&core=' + gameRomItems[i].emulator.core + '&platformid=' + gameRomItems[i].platform.id + '&gameid=' + gameId + '&rompath=' + encodeURIComponent('/api/v1.0/Games/' + gameId + '/roms/' + gameRomItems[i].id + '/' + encodeURIComponent(gameRomItems[i].name)) + '" class="romstart">Launch</a>';
launchButton = '<a href="/index.html?page=emulator&engine=' + gameRomItems[i].emulator.type + '&core=' + gameRomItems[i].emulator.core + '&platformid=' + gameRomItems[i].platform.id + '&gameid=' + gameId + '&rompath=' + encodeURIComponent('/api/v1.1/Games/' + gameId + '/roms/' + gameRomItems[i].id + '/' + encodeURIComponent(gameRomItems[i].name)) + '" class="romstart">Launch</a>';
}
}
}
var newRow = [
['<input type="checkbox" name="rom_checkbox" data-gameid="' + gameData.id + '" data-platformid="' + gameRomItems[i].platformId + '" data-romid="' + gameRomItems[i].id + '" onclick="handleChecks();" />', 'rom_checkbox_box_hidden', 'rom_edit_checkbox'],
'<a href="/api/v1.0/Games/' + gameId + '/roms/' + gameRomItems[i].id + '/' + encodeURIComponent(gameRomItems[i].name) + '" class="romlink">' + gameRomItems[i].name + '</a>',
'<a href="/api/v1.1/Games/' + gameId + '/roms/' + gameRomItems[i].id + '/' + encodeURIComponent(gameRomItems[i].name) + '" class="romlink">' + gameRomItems[i].name + '</a>',
formatBytes(gameRomItems[i].size, 2),
gameRomItems[i].romTypeMedia,
gameRomItems[i].mediaLabel,
@@ -436,7 +436,7 @@
if (gameRomItem.platformId == mediaGroup.platformId) {
if (gameRomItem.emulator) {
if (gameRomItem.emulator.type.length > 0) {
launchButton = '<a href="/index.html?page=emulator&engine=' + gameRomItem.emulator.type + '&core=' + gameRomItem.emulator.core + '&platformid=' + gameRomItem.platform.id + '&gameid=' + gameId + '&rompath=' + encodeURIComponent('/api/v1.0/Games/' + gameId + '/romgroup/' + mediaGroup.id + '/' + gameData.name + '(' + mediaGroup.id + ')' + '.zip') + '" class="romstart">Launch</a>';
launchButton = '<a href="/index.html?page=emulator&engine=' + gameRomItem.emulator.type + '&core=' + gameRomItem.emulator.core + '&platformid=' + gameRomItem.platform.id + '&gameid=' + gameId + '&rompath=' + encodeURIComponent('/api/v1.1/Games/' + gameId + '/romgroup/' + mediaGroup.id + '/' + gameData.name + '(' + mediaGroup.id + ')' + '.zip') + '" class="romstart">Launch</a>';
break;
}
}
@@ -459,7 +459,7 @@
break;
case "Completed":
statusText = 'Available';
downloadLink = '<a href="/api/v1.0/Games/' + gameId + '/romgroup/' + mediaGroup.id + '/' + gameData.name + '.zip" class="romlink"><img src="/images/download.svg" class="banner_button_image" alt="Download" title="Download" /></a>';
downloadLink = '<a href="/api/v1.1/Games/' + gameId + '/romgroup/' + mediaGroup.id + '/' + gameData.name + '.zip" class="romlink"><img src="/images/download.svg" class="banner_button_image" alt="Download" title="Download" /></a>';
packageSize = formatBytes(mediaGroup.size);
launchButtonContent = launchButton;
break;
@@ -525,7 +525,7 @@
artworksPosition = 0;
}
var bg = document.getElementById('bgImage');
bg.setAttribute('style', 'background-image: url("/api/v1.0/Games/' + gameId + '/artwork/' + artworks[artworksPosition] + '/image"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);');
bg.setAttribute('style', 'background-image: url("/api/v1.1/Games/' + gameId + '/artwork/' + artworks[artworksPosition] + '/image"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);');
artworksTimer = setTimeout(rotateBackground, 60000);
}
}
@@ -677,7 +677,7 @@
minimumInputLength: 3,
placeholder: "Platform",
ajax: {
url: '/api/v1.0/Search/Platform',
url: '/api/v1.1/Search/Platform',
data: function (params) {
var query = {
SearchString: params.term
@@ -709,7 +709,7 @@
templateResult: DropDownRenderGameOption,
placeholder: "Game",
ajax: {
url: '/api/v1.0/Search/Game',
url: '/api/v1.1/Search/Game',
data: function (params) {
fixplatform = $('#rom_edit_fixplatform').select2('data');
@@ -762,7 +762,7 @@
if (rom_checks[i].checked == true) {
var romId = rom_checks[i].getAttribute('data-romid');
remapCallCounter += 1;
ajaxCall('/api/v1.0/Games/' + gameId + '/roms/' + romId + '?NewPlatformId=' + fixplatform[0].id + '&NewGameId=' + fixgame[0].id, 'PATCH', function (result) {
ajaxCall('/api/v1.1/Games/' + gameId + '/roms/' + romId + '?NewPlatformId=' + fixplatform[0].id + '&NewGameId=' + fixgame[0].id, 'PATCH', function (result) {
remapTitlesCallback();
}, function (result) {
remapTitlesCallback();
@@ -804,7 +804,7 @@
if (rom_checks[i].checked == true) {
var romId = rom_checks[i].getAttribute('data-romid');
remapCallCounter += 1;
ajaxCall('/api/v1.0/Games/' + gameId + '/roms/' + romId, 'DELETE', function (result) {
ajaxCall('/api/v1.1/Games/' + gameId + '/roms/' + romId, 'DELETE', function (result) {
remapTitlesCallback();
});
}
@@ -846,7 +846,7 @@
}
ajaxCall(
'/api/v1.0/Games/' + gameId + '/romgroup?PlatformId=' + platformId,
'/api/v1.1/Games/' + gameId + '/romgroup?PlatformId=' + platformId,
'POST',
function (result) {
DisplayROMCheckboxes(false);

View File

@@ -8,10 +8,10 @@
</div>
<script type="text/javascript">
ajaxCall('/api/v1.0/Filter', 'GET', function (result) {
ajaxCall('/api/v1.1/Filter', 'GET', function (result) {
var filterElement = document.getElementById('games_filter');
formatFilterPanel(filterElement, result);
executeFilter();
executeFilter1_1();
});
</script>

View File

@@ -0,0 +1,128 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="/api/v1.1/System/VersionFile"></script>
<link type="text/css" rel="stylesheet" dat-href="/styles/style.css" />
<script src="/scripts/jquery-3.6.0.min.js"></script>
<script src="/scripts/moment.js"></script>
<link href="/styles/select2.min.css" rel="stylesheet" />
<link href="/styles/dropzone.min.css" rel="stylesheet" type="text/css" />
<script src="/scripts/jquery.lazy.min.js"></script>
<script src="/scripts/jquery.lazy.plugins.min.js"></script>
<script src="/scripts/select2.min.js"></script>
<script src="/scripts/dropzone.min.js"></script>
<script src="/scripts/simpleUpload.min.js"></script>
<script src="/scripts/main.js" type="text/javascript"></script>
<script src="/scripts/filterformating.js" type="text/javascript"></script>
<script src="/scripts/gamesformating.js" type="text/javascript"></script>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<title>Gaseous Games</title>
<script type="text/javascript">
var head = document.getElementsByTagName('head')[0];
// update links
var headLinks = document.getElementsByTagName('link');
for (var i = 0; i < headLinks.length; i++) {
if (headLinks[i].getAttribute('dat-href') && headLinks[i].rel == "stylesheet") {
var newLink = document.createElement('link');
newLink.rel = "stylesheet";
newLink.href = headLinks[i].getAttribute('dat-href') + '?v=' + AppVersion;
newLink.type = "text/css";
headLinks[i].parentElement.removeChild(headLinks[i]);
head.appendChild(newLink);
}
}
</script>
</head>
<body>
<div id="bgImage" style="background-image: url('/images/LoginWallpaper.jpg'); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);">
<div id="bgImage_Opacity"></div>
</div>
<div id="content">
<div class="loginwindow">
<div id="loginform" class="loginwindow-content">
<img src="/images/logo.png" style="display: block; margin: 20px auto;" />
<div id="loginwindow_header_label" style="display: block; text-align: center;">Gaseous Games</div>
<table style="width: 100%; margin-top: 20px;" cellpadding="5px">
<tr>
<th>Email</th>
<td><input type="email" id="login_email" style="width: 95%;" /></td>
</tr>
<tr>
<th>Password</th>
<td><input type="password" id="login_password" style="width: 95%;" /></td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" id="login_rememberme"> <label for="login_rememberme">Remember Me</label>
</td>
</tr>
<tr>
<td colspan="2" style="padding-top: 20px;">
<button type="button" value="Sign In" onclick="UserLogin();" style="margin-top: 10px; width: 100%; font-size: 16px; border-radius: 10px; padding-top: 10px; padding-bottom: 10px;">Sign In</button>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="settings_photocredit">
Wallpaper by <a href="https://unsplash.com/@spideyjoey" class="romlink">Joey Kwok</a> / <a href="https://unsplash.com/photos/a-room-filled-with-arcade-machines-and-neon-lights-jbIsTd7rdd8" class="romlink">Unsplash</a>
</div>
<script type="text/javascript">
// redirect if logged in
ajaxCall(
'/api/v1.1/Account/Profile/Basic',
'GET',
function(result) {
// user is signed in - redirect to main page
window.location.replace("/");
},
function(error) {
// user is not signed in - do nothing
}
);
function UserLogin() {
var loginObj = {
"email": document.getElementById('login_email').value,
"password": document.getElementById('login_password').value,
"rememberMe": document.getElementById('login_rememberme').checked
}
ajaxCall(
'/api/v1.1/Account/Login',
'POST',
function(result) {
loginCallback(result);
},
function(error) {
loginCallback(error);
},
JSON.stringify(loginObj)
);
function loginCallback(result) {
switch(result.status) {
case 200:
window.location.replace('/index.html');
break;
default:
// login failed
break;
}
}
}
</script>
</body>

View File

@@ -6,10 +6,11 @@
<div id="properties_toc" class="settings_toc">
<div class="filter_header">Settings</div>
<div id="properties_toc_system" name="properties_toc_item" onclick="SelectTab('system');">System</div>
<div id="properties_toc_settings" name="properties_toc_item" onclick="SelectTab('settings');">Settings</div>
<div id="properties_toc_mapping" name="properties_toc_item" onclick="SelectTab('mapping');">Platform Mapping</div>
<div id="properties_toc_settings" name="properties_toc_item" onclick="SelectTab('settings');" style="display: none;">Settings</div>
<div id="properties_toc_users" name="properties_toc_item" onclick="SelectTab('users');" style="display: none;">Users</div>
<div id="properties_toc_mapping" name="properties_toc_item" onclick="SelectTab('mapping');" style="display: none;">Platform Mapping</div>
<div id="properties_toc_bios" name="properties_toc_item" onclick="SelectTab('bios');">Firmware</div>
<div id="properties_toc_logs" name="properties_toc_item" onclick="SelectTab('logs');">Logs</div>
<div id="properties_toc_logs" name="properties_toc_item" onclick="SelectTab('logs');" style="display: none;">Logs</div>
<div id="properties_toc_about" name="properties_toc_item" onclick="SelectTab('about');">About</div>
</div>
<div id="properties_bodypanel">
@@ -23,6 +24,16 @@
</div>
<script type="text/javascript">
if (userProfile.roles.includes("Admin")) {
document.getElementById('properties_toc_settings').style.display = '';
document.getElementById('properties_toc_users').style.display = '';
document.getElementById('properties_toc_mapping').style.display = '';
document.getElementById('properties_toc_logs').style.display = '';
}
if (userProfile.roles.includes("Gamer")) {
document.getElementById('properties_toc_mapping').style.display = '';
}
var myParam = getQueryString('sub', 'string');
var selectedTab = '';

View File

@@ -8,7 +8,7 @@
</table>
<script type="text/javascript">
ajaxCall('/api/v1.0/Bios', 'GET', function (result) {
ajaxCall('/api/v1.1/Bios', 'GET', function (result) {
result.sort((a, b) => a.platformname.charCodeAt(0) - b.platformname.charCodeAt(0));
var lastPlatform = '';
@@ -28,7 +28,7 @@
}
var biosFilename = document.createElement('a');
biosFilename.href = '/api/v1.0/Bios/' + result[i].platformid + '/' + result[i].filename;
biosFilename.href = '/api/v1.1/Bios/' + result[i].platformid + '/' + result[i].filename;
biosFilename.innerHTML = result[i].filename;
biosFilename.className = 'romlink';
@@ -38,7 +38,7 @@
availableText.className = 'greentext';
biosFilename = document.createElement('a');
biosFilename.href = '/api/v1.0/Bios/' + result[i].platformid + '/' + result[i].filename;
biosFilename.href = '/api/v1.1/Bios/' + result[i].platformid + '/' + result[i].filename;
biosFilename.innerHTML = result[i].filename;
biosFilename.className = 'romlink';
} else {

View File

@@ -26,7 +26,7 @@
}
ajaxCall(
'/api/v1.0/Logs' + apiQuery,
'/api/v1.1/Logs' + apiQuery,
'GET',
function (result) {
var newTable = document.getElementById('settings_events_table');

View File

@@ -6,7 +6,7 @@
<p>This list is pre-populated with some of the more common platforms. New platforms will appear in this list as titles are added.</p>
<p><button value="Export to JSON" onclick="DownloadJSON();">Export to JSON</button><button id="importjson" value="Import JSON">Import JSON</button><button value="Reset to Default" onclick="loadPlatformMapping(true);">Reset to Default</button></p>
<p id="settings_mapping_import" style="display: none;"><button value="Export to JSON" onclick="DownloadJSON();">Export to JSON</button><button id="importjson" value="Import JSON">Import JSON</button><button value="Reset to Default" onclick="loadPlatformMapping(true);">Reset to Default</button></p>
<input id='uploadjson' type='file' name='files' hidden/>
@@ -15,6 +15,10 @@
</table>
<script type="text/javascript">
if (userProfile.roles.includes("Admin")) {
document.getElementById('settings_mapping_import').style.display = '';
}
function loadPlatformMapping(Overwrite) {
var queryString = '';
if (Overwrite == true) {
@@ -22,7 +26,7 @@
}
ajaxCall(
'/api/v1.0/PlatformMaps' + queryString,
'/api/v1.1/PlatformMaps' + queryString,
'GET',
function (result) {
var newTable = document.getElementById('settings_mapping_table');
@@ -47,8 +51,15 @@
hasWebEmulator = 'Yes';
}
var platformLink = '';
if (userProfile.roles.includes("Admin")) {
platformLink = '<a href="#/" onclick="ShowPlatformMappingDialog(' + result[i].igdbId + ');" class="romlink">' + result[i].igdbName + '</a>';
} else {
platformLink = result[i].igdbName;
}
var newRow = [
'<a href="#/" onclick="ShowPlatformMappingDialog(' + result[i].igdbId + ');" class="romlink">' + result[i].igdbName + '</a>',
platformLink,
result[i].extensions.supportedFileExtensions.join(', '),
result[i].extensions.uniqueFileExtensions.join(', '),
hasWebEmulator
@@ -61,7 +72,7 @@
}
function DownloadJSON() {
window.open('/api/v1.0/PlatformMaps', '_blank');
window.open('/api/v1.1/PlatformMaps', '_blank');
}
document.getElementById('importjson').addEventListener('click', openDialog);
@@ -71,7 +82,7 @@
}
$('#uploadjson').change(function () {
$(this).simpleUpload("/api/v1.0/PlatformMaps", {
$(this).simpleUpload("/api/v1.1/PlatformMaps", {
start: function (file) {
//upload started
console.log("JSON upload started");

View File

@@ -11,7 +11,7 @@
<script type="text/javascript">
function drawLibrary() {
ajaxCall(
'/api/v1.0/Library',
'/api/v1.1/Library',
'GET',
function (result) {
var newTable = document.getElementById('settings_libraries');

View File

@@ -26,7 +26,7 @@
<div id="system_signatures"></div>
<script type="text/javascript">function SystemLoadStatus() {
ajaxCall('/api/v1.0/BackgroundTasks', 'GET', function (result) {
ajaxCall('/api/v1.1/BackgroundTasks', 'GET', function (result) {
var newTable = document.createElement('table');
newTable.className = 'romtable';
newTable.setAttribute('cellspacing', 0);
@@ -91,8 +91,10 @@
var itemInterval = result[i].interval;
var nextRunTime = moment(result[i].nextRunTime).fromNow();
var startButton = '';
if (result[i].allowManualStart == true && result[i].itemState != "Running") {
startButton = "<span id='startProcess' class='romstart' onclick='StartProcess(\"" + result[i].itemType + "\");'>Start</span>";
if (userProfile.roles.includes("Admin")) {
if (result[i].allowManualStart == true && result[i].itemState != "Running") {
startButton = "<span id='startProcess' class='romstart' onclick='StartProcess(\"" + result[i].itemType + "\");'>Start</span>";
}
}
if (result[i].allowManualStart == false && result[i].removeWhenStopped == true) {
@@ -119,7 +121,7 @@
}
function SystemLoadSystemStatus() {
ajaxCall('/api/v1.0/System', 'GET', function (result) {
ajaxCall('/api/v1.1/System', 'GET', function (result) {
if (result) {
var totalLibrarySpace = 0;
@@ -234,7 +236,7 @@
}
function SystemSignaturesStatus() {
ajaxCall('/api/v1.0/Signatures/Status', 'GET', function (result) {
ajaxCall('/api/v1.1/Signatures/Status', 'GET', function (result) {
var newTable = document.createElement('table');
newTable.className = 'romtable';
newTable.setAttribute('cellspacing', 0);
@@ -257,7 +259,7 @@
}
function StartProcess(itemType) {
ajaxCall('/api/v1.0/BackgroundTasks/' + itemType + '?ForceRun=true', 'GET', function (result) {
ajaxCall('/api/v1.1/BackgroundTasks/' + itemType + '?ForceRun=true', 'GET', function (result) {
SystemLoadStatus();
});
}

View File

@@ -0,0 +1,99 @@
<div id="gametitle">
<h1 id="gametitle_label">Users</h1>
</div>
<button id="settings_users_new" value="New User" style="float: right;" onclick="showSubDialog('settingsusernew');">New User</button>
<div id="settings_users_table_container">
</div>
<script type="text/javascript">
function GetUsers() {
var targetDiv = document.getElementById('settings_users_table_container');
targetDiv.innerHTML = '';
ajaxCall(
'/api/v1.1/Account/Users',
'GET',
function(result) {
var newTable = document.createElement('table');
newTable.className = 'romtable';
newTable.style.width = '100%';
newTable.cellSpacing = 0;
newTable.appendChild(
createTableRow(
true,
[
'Email',
'Role',
'Age Restriction',
''
],
'',
''
)
);
for (var i = 0; i < result.length; i++) {
var roleDiv = document.createElement('div');
// for (var r = 0; r < result[i].roles.length; r++) {
// var roleItem = document.createElement('div');
// roleItem.className = 'dropdownroleitem';
// roleItem.innerHTML = result[i].roles[r].toUpperCase();
// var colorVal = intToRGB(hashCode(result[i].roles[r]));
// roleItem.style.backgroundColor = '#' + colorVal;
// roleItem.style.borderColor = '#' + colorVal;
// roleDiv.appendChild(roleItem);
// }
var roleItem = CreateBadge(result[i].highestRole);
roleDiv.appendChild(roleItem);
var ageRestrictionPolicyDescription = document.createElement('div');
if (result[i].securityProfile != null) {
if (result[i].securityProfile.ageRestrictionPolicy != null) {
var IncludeUnratedText = '';
if (result[i].securityProfile.ageRestrictionPolicy.includeUnrated == true) {
IncludeUnratedText = " &#43; Unclassified titles";
}
var restrictionText = result[i].securityProfile.ageRestrictionPolicy.maximumAgeRestriction + IncludeUnratedText;
ageRestrictionPolicyDescription = CreateBadge(restrictionText);
}
}
var editButton = '';
var deleteButton = '';
if (userProfile.userId != result[i].id) {
editButton = '<a href="#" onclick="showDialog(\'settingsuseredit\', \'' + result[i].id + '\');" class="romlink"><img src="/images/edit.svg" class="banner_button_image" alt="Edit" title="Edit" /></a>';
deleteButton = '<a href="#" onclick="showSubDialog(\'settingsuserdelete\', \'' + result[i].id + '\');" class="romlink"><img src="/images/delete.svg" class="banner_button_image" alt="Delete" title="Delete" /></a>';
}
newTable.appendChild(
createTableRow(
false,
[
result[i].emailAddress,
roleDiv,
ageRestrictionPolicyDescription,
'<div style="text-align: right;">' + editButton + deleteButton + '</div>'
],
'romrow',
'romcell'
)
);
}
targetDiv.appendChild(newTable);
}
);
}
GetUsers();
</script>

View File

@@ -171,7 +171,7 @@ function buildFilterPanelItem(filterType, itemString, friendlyItemString, tags)
filterPanelItemCheckBoxItem.className = 'filter_panel_item_checkbox';
filterPanelItemCheckBoxItem.name = 'filter_' + filterType;
filterPanelItemCheckBoxItem.setAttribute('filter_id', itemString);
filterPanelItemCheckBoxItem.setAttribute('oninput' , 'executeFilter();');
filterPanelItemCheckBoxItem.setAttribute('oninput' , 'executeFilter1_1();');
if (checkState == true) {
filterPanelItemCheckBoxItem.checked = true;
}
@@ -198,7 +198,7 @@ function executeFilterDelayed() {
filterExecutor = null;
}
filterExecutor = setTimeout(executeFilter, 1000);
filterExecutor = setTimeout(executeFilter1_1, 1000);
}
function executeFilter() {
@@ -299,4 +299,82 @@ function buildFilterTag(tags) {
}
return boundingDiv;
}
function executeFilter1_1() {
console.log("Execute filter 1.1");
var minUserRating = -1;
var minUserRatingInput = document.getElementById('filter_panel_userrating_min');
if (minUserRatingInput.value) {
minUserRating = minUserRatingInput.value;
}
setCookie(minUserRatingInput.id, minUserRatingInput.value);
var maxUserRating = -1;
var maxUserRatingInput = document.getElementById('filter_panel_userrating_max');
if (maxUserRatingInput.value) {
maxUserRating = maxUserRatingInput.value;
}
setCookie(maxUserRatingInput.id, maxUserRatingInput.value);
// build filter model
var model = {
"Name": document.getElementById('filter_panel_search').value,
"Platform": GetFilterQuery1_1('platform'),
"Genre": GetFilterQuery1_1('genre'),
"GameMode": GetFilterQuery1_1('gamemmode'),
"PlayerPerspective": GetFilterQuery1_1('playerperspective'),
"Theme": GetFilterQuery1_1('theme'),
"GameRating": {
"MinimumRating": minUserRating,
"MinimumRatingCount": -1,
"MaximumRating": maxUserRating,
"MaximumRatingCount": -1,
"IncludeUnrated": true
},
"GameAgeRating": {
"AgeGroupings": [
"Child",
"Teen",
"Mature",
"Adult"
],
"IncludeUnrated": true
},
"Sorting": {
"SortBy": "NameThe",
"SortAscenting": true
}
};
console.log('Search model = ' + JSON.stringify(model));
ajaxCall(
'/api/v1.1/Games',
'POST',
function (result) {
var gameElement = document.getElementById('games_library');
formatGamesPanel(gameElement, result);
},
function (error) {
console.log('An error occurred: ' + JSON.stringify(error));
},
JSON.stringify(model)
);
}
function GetFilterQuery1_1(filterName) {
var Filters = document.getElementsByName('filter_' + filterName);
var selections = [];
for (var i = 0; i < Filters.length; i++) {
if (Filters[i].checked) {
setCookie(Filters[i].id, true);
selections.push(Filters[i].getAttribute('filter_id'));
} else {
setCookie(Filters[i].id, false);
}
}
return selections;
}

View File

@@ -20,7 +20,7 @@ function renderGameIcon(gameObject, showTitle, showRatings) {
var gameImage = document.createElement('img');
gameImage.className = 'game_tile_image lazy';
if (gameObject.cover) {
gameImage.setAttribute('data-src', '/api/v1.0/Games/' + gameObject.id + '/cover/image');
gameImage.setAttribute('data-src', '/api/v1.1/Games/' + gameObject.id + '/cover/image');
} else {
gameImage.src = '/images/unknowngame.png';
gameImage.className = 'game_tile_image unknown';
@@ -40,7 +40,7 @@ function renderGameIcon(gameObject, showTitle, showRatings) {
ratingsSection.id = 'ratings_section';
for (var i = 0; i < gameObject.ageRatings.ids.length; i++) {
var ratingImage = document.createElement('img');
ratingImage.src = '/api/v1.0/Games/' + gameObject.id + '/agerating/' + gameObject.ageRatings.ids[i] + '/image';
ratingImage.src = '/api/v1.1/Games/' + gameObject.id + '/agerating/' + gameObject.ageRatings.ids[i] + '/image';
ratingImage.className = 'rating_image_mini';
ratingsSection.appendChild(ratingImage);
}

View File

@@ -373,4 +373,19 @@ function LoadEditableTableData(TableName, Headers, Values) {
eTable.appendChild(row);
}
}
function CreateBadge(BadgeText, ColourOverride) {
var badgeItem = document.createElement('div');
badgeItem.className = 'dropdownroleitem';
badgeItem.innerHTML = BadgeText.toUpperCase();
var colorVal = intToRGB(hashCode(BadgeText));
if (!ColourOverride) {
badgeItem.style.backgroundColor = '#' + colorVal;
badgeItem.style.borderColor = '#' + colorVal;
} else {
badgeItem.style.backgroundColor = ColourOverride;
badgeItem.style.borderColor = ColourOverride;
}
return badgeItem;
}

View File

@@ -30,12 +30,12 @@ h3 {
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
z-index: 100; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
overflow: none; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
backdrop-filter: blur(8px);
@@ -47,9 +47,10 @@ h3 {
/* Modal Content/Box */
.modal-content {
background-color: #383838;
margin: 15% auto; /* 15% from the top and centered */
margin: 10% auto; /* 15% from the top and centered */
padding: 10px;
border: 1px solid #888;
border-radius: 10px;
width: 700px; /* Could be more or less, depending on screen size */
min-height: 358px;
}
@@ -58,6 +59,7 @@ h3 {
margin: 20% auto; /* 20% from the top and centered */
padding: 10px;
border: 1px solid #888;
border-radius: 10px;
width: 300px; /* Could be more or less, depending on screen size */
min-height: 110px;
}
@@ -205,7 +207,7 @@ h3 {
z-index: 1;
}
input[type='text'], input[type='number'] {
input[type='text'], input[type='number'], input[type="email"], input[type="password"] {
background-color: #2b2b2b;
color: white;
padding: 5px;
@@ -409,7 +411,7 @@ input[id='filter_panel_userrating_max'] {
display: inline-block;
max-width: 32px;
max-height: 32px;
margin-right: 2px;
margin-right: 10px;
}
#gamescreenshots {
@@ -621,14 +623,14 @@ th {
height: 100%;
}
div[name="properties_toc_item"] {
div[name="properties_toc_item"],div[name="properties_user_toc_item"],div[name="properties_profile_toc_item"] {
padding: 10px;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #2b2b2b;
}
div[name="properties_toc_item"]:hover {
div[name="properties_toc_item"]:hover,div[name="properties_user_toc_item"]:hover,div[name="properties_profile_toc_item"]:hover {
background-color: #2b2b2b;
cursor: pointer;
}
@@ -965,4 +967,98 @@ button:disabled {
.romGroupTitles {
padding-left: 20px;
}
.loginwindow {
position: fixed; /* Stay in place */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
/*background-color: rgb(0,0,0); /* Fallback color */
/*background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
/*backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);*/
filter: drop-shadow(5px 5px 10px #000);
-webkit-filter: drop-shadow(5px 5px 10px #000);
}
/* Modal Content/Box */
.loginwindow-content {
position: relative;
background-color: #383838;
margin: 15% auto; /* 15% from the top and centered */
padding: 10px;
border: 1px solid #888;
border-radius: 10px;
width: 350px; /* Could be more or less, depending on screen size */
min-height: 250px;
}
#loginwindow_header_label {
font-family: Commodore64;
display: inline-block;
padding: 10px;
font-size: 24pt;
vertical-align: top;
/*color: #edeffa;*/
color: #7c70da;
}
/* The container <div> - needed to position the dropdown content */
.dropdown {
position: relative;
display: inline-block;
float: right;
}
/* Dropdown Content (Hidden by Default) */
.dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 160px;
/* box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); */
z-index: 1;
right: 0;
top: 40px;
filter: drop-shadow(5px 5px 10px #000);
-webkit-filter: drop-shadow(5px 5px 10px #000);
}
/* Links inside the dropdown */
.dropdown-content a, .dropdown-content span {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content span {
cursor: auto;
}
/* Change color of dropdown links on hover */
.dropdown-content a:hover {background-color: #ddd;}
/* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) */
.show {display:block;}
.dropdownroleitem {
text-transform: capitalize;
font-size: 12px;
font-weight: bold;
color: white;
background-color: red;
border-color: red;
border-style: solid;
border-width: 1px;
border-radius: 5px;
padding: 3px 6px;
display: inline-block;
margin-top: 5px;
margin-bottom: 5px;
margin-left: 5px;
margin-right: 5px;
}