Merge branch 'master' into #5461-Inadvertently-logged-out-because-of-timeout-integer-overflow
This commit is contained in:
commit
60e3508424
@ -8,6 +8,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
fbErrors "github.com/filebrowser/filebrowser/v2/errors"
|
fbErrors "github.com/filebrowser/filebrowser/v2/errors"
|
||||||
@ -266,13 +267,7 @@ var validHookFields = []string{
|
|||||||
|
|
||||||
// IsValid checks if the provided field is on the valid fields list
|
// IsValid checks if the provided field is on the valid fields list
|
||||||
func (hf *hookFields) IsValid(field string) bool {
|
func (hf *hookFields) IsValid(field string) bool {
|
||||||
for _, val := range validHookFields {
|
return slices.Contains(validHookFields, field)
|
||||||
if field == val {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetString returns the string value or provided default
|
// GetString returns the string value or provided default
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="button button--flat button--blue"
|
class="button button--flat button--blue"
|
||||||
@click="saveAndClose"
|
@click="currentPrompt.saveAction"
|
||||||
:aria-label="$t('buttons.saveChanges')"
|
:aria-label="$t('buttons.saveChanges')"
|
||||||
:title="$t('buttons.saveChanges')"
|
:title="$t('buttons.saveChanges')"
|
||||||
tabindex="1"
|
tabindex="1"
|
||||||
@ -39,8 +39,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapActions } from "pinia";
|
|
||||||
import { useLayoutStore } from "@/stores/layout";
|
import { useLayoutStore } from "@/stores/layout";
|
||||||
|
import { mapActions, mapState } from "pinia";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "discardEditorChanges",
|
name: "discardEditorChanges",
|
||||||
@ -49,12 +49,6 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useLayoutStore, ["closeHovers"]),
|
...mapActions(useLayoutStore, ["closeHovers"]),
|
||||||
saveAndClose() {
|
|
||||||
if (this.currentPrompt?.saveAction) {
|
|
||||||
this.currentPrompt.saveAction();
|
|
||||||
}
|
|
||||||
this.closeHovers();
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -216,12 +216,24 @@ const decreaseFontSize = () => {
|
|||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
if (!editor.value?.session.getUndoManager().isClean()) {
|
if (!editor.value?.session.getUndoManager().isClean()) {
|
||||||
layoutStore.showHover("discardEditorChanges");
|
layoutStore.showHover({
|
||||||
|
prompt: "discardEditorChanges",
|
||||||
|
confirm: (event: Event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
finishClose();
|
||||||
|
},
|
||||||
|
saveAction: async () => {
|
||||||
|
await save();
|
||||||
|
finishClose();
|
||||||
|
},
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
finishClose();
|
||||||
|
};
|
||||||
|
|
||||||
|
const finishClose = () => {
|
||||||
fileStore.updateRequest(null);
|
fileStore.updateRequest(null);
|
||||||
|
|
||||||
const uri = url.removeLastDir(route.path) + "/";
|
const uri = url.removeLastDir(route.path) + "/";
|
||||||
router.push({ path: uri });
|
router.push({ path: uri });
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user