Readded error message if invalid image was given, made way for packaging and making

This commit is contained in:
TheGreyDiamond
2022-01-02 19:53:16 +01:00
parent 59a639a740
commit 7b20b1975f
4 changed files with 56 additions and 5 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
package-lock.json
node_modules
dist/*
dist/*
out

View File

@ -60,7 +60,7 @@ function createStartupInfo() {
win2.setFullScreen(false);
win2.setAlwaysOnTop(false);
win2.loadFile("dist/ui_templates/about.html");
win2.loadFile(path.join(__dirname, "dist/ui_templates/about.html"));
win2.show();
return win2;
}
@ -77,7 +77,7 @@ function createWindow() {
win.loadURL(
url.format({
pathname: "dist/ui_templates/index.html",
pathname: path.join(__dirname, "dist/ui_templates/index.html"),
protocol: "file:",
slashes: true,
})

View File

@ -14,10 +14,39 @@
"startDev": "npm run buildCss && npm run minify && electron .",
"minify": "minify src/main.js > dist/main.js && minify src/ui_templates/index.html > dist/ui_templates/index.html && minify src/ui_templates/about.html > dist/ui_templates/about.html",
"buildCss": "npx tailwindcss -i ./src/main.css -o ./dist/output.css",
"buildCssWatch": "npx tailwindcss -i ./src/main.css -o ./dist/output.css --watch"
"buildCssWatch": "npx tailwindcss -i ./src/main.css -o ./dist/output.css --watch",
"package": "electron-forge package",
"make": "electron-forge make"
},
"author": "TheGreydiamond",
"license": "GPL-3.0",
"config": {
"forge": {
"packagerConfig": {},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "open360viewer"
}
},
{
"name": "@electron-forge/maker-zip",
"platforms": [
"darwin"
]
},
{
"name": "@electron-forge/maker-deb",
"config": {}
},
{
"name": "@electron-forge/maker-rpm",
"config": {}
}
]
}
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.4",
"@themesberg/flowbite": "^1.2.0",
@ -26,6 +55,12 @@
},
"devDependencies": {
"minify": "^8.0.3",
"tailwindcss": "^3.0.8"
"tailwindcss": "^3.0.8",
"@electron-forge/cli": "^6.0.0-beta.61",
"@electron-forge/maker-deb": "^6.0.0-beta.61",
"@electron-forge/maker-rpm": "^6.0.0-beta.61",
"@electron-forge/maker-squirrel": "^6.0.0-beta.61",
"@electron-forge/maker-zip": "^6.0.0-beta.61",
"electron": "^16.0.5"
}
}

View File

@ -12,6 +12,17 @@
</head>
<body class="dark:bg-gray-800">
<div id="alert-1" class="flex p-4 mb-4 bg-red-100 rounded-lg dark:bg-red-200" role="alert" style="display: none;">
<svg class="flex-shrink-0 w-5 h-5 text-red-700 dark:text-red-800" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"></path></svg>
<div class="ml-3 text-sm font-medium text-red-700 dark:text-red-800">
The provided image was invalid and could not be loaded.
</div>
<button type="button" class="ml-auto -mx-1.5 -my-1.5 bg-red-100 text-red-500 rounded-lg focus:ring-2 focus:ring-red-400 p-1.5 hover:bg-red-200 inline-flex h-8 w-8 dark:bg-red-200 dark:text-red-600 dark:hover:bg-red-300" data-collapse-toggle="alert-1" aria-label="Close" onclick="document.getElementById('alert-1').style.display = 'none'">
<span class="sr-only">Close</span>
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</button>
</div>
<center>
<h1 id="state" style="display: none;"></h1>
<div id="fakeDropzone"
@ -77,6 +88,10 @@
}
else {
document.getElementById("state").innerHTML = "Load failed."
document.getElementById('alert-1').style.display = 'block';
document.getElementById("fakeDropzone").style.display = "block";
document.getElementById("loadingBig").style.display = "none";
document.getElementById("pano").style.display = "none";
}
});
}