prevent adding to fstab if failure to mount

mount-manager
Moe 2024-11-02 14:36:53 -07:00
parent 533e76020f
commit fab5f05f0b
3 changed files with 12 additions and 7 deletions

View File

@ -24,6 +24,8 @@
"Mount Manager": "Mount Manager",
"mountManagerDescription": "Setup drive mounts here.",
"Mount Added": "Mount Added",
"mountAddedText": "Mount has been added to /etc/fstab. You may now use it as your default Videos directory.",
"mountAddedBadCredentialsText": "Mount has been added to /etc/fstab but it seems credentials are incorrect.",
"Failed to Remove Mount": "Failed to Remove Mount",
"Failed to Add Mount": "Failed to Add Mount",
"Add Mount": "Add Mount",
@ -559,6 +561,7 @@
"Delete Mount": "Delete Mount",
"Mount Path": "Mount Path",
"Mount Type": "Mount Type",
"setVideosDirWarning": "Doing this while Monitors are recording may cause issues. Stop them before making this change.",
"Save Directory": "Save Directory",
"Path Inside": "Path Inside",
"Path Inside Mount": "Path Inside Mount",

View File

@ -65,11 +65,12 @@ module.exports = (s,config,lang,app,io) => {
const updateResponse = await update(sourceTarget, localPath, mountType, options);
response.updateResponse = updateResponse
response.ok = updateResponse.ok
try{
const remountResponse = await remount(localPath)
response.remountResponse = remountResponse
}catch(err){
console.error(err)
const remountResponse = await remount(localPath)
response.remountResponse = remountResponse
if(!remountResponse.ok){
await remove(localPath);
response.ok = false;
response.error = remountResponse.error;
}
response.mount = {
device: sourceTarget,

View File

@ -94,7 +94,7 @@ $(document).ready(function(){
function launchSetVideoDirConfirm(localPath){
$.confirm.create({
title: lang['Set New Videos Directory'],
body: `<b>${lang['Mount Path']} : ${localPath}</b><br>${lang.restartRequired}<br><br><input placeholder="${lang['Path Inside Mount']}" class="form-control" id="newVideosDirInnerPath">`,
body: `<b>${lang['Mount Path']} : ${localPath}</b><br>${lang.setVideosDirWarning} ${lang.restartRequired}<br><br><input placeholder="${lang['Path Inside Mount']}" class="form-control" id="newVideosDirInnerPath">`,
clickOptions: {
class: 'btn-success',
title: lang.Save,
@ -125,6 +125,7 @@ $(document).ready(function(){
const response = await addMount(form);
const notify = {
title: lang['Mount Added'],
text: lang.mountAddedText,
type: 'success'
}
if(!response.ok){
@ -148,7 +149,7 @@ $(document).ready(function(){
const localPath = theMount.mountPoint
$.confirm.create({
title: lang['Delete Mount'],
body: `<div>${theMount.device}</div><small>${localPath} (${theMount.type})</small>`,
body: `<b>${lang['Mount Path']} : ${localPath} (${theMount.type})</b><br><small>${theMount.device}</small><br>${lang.setVideosDirWarning}`,
clickOptions: {
class: 'btn-danger',
title: lang.Delete,