2025-07-18 00:58:03 +08:00

24 lines
954 B
HTML

<%+cbi/valueheader%>
<script type="text/javascript">
//<![CDATA[
function import_new_file_name(btn, file_path, file_name) {
var new_file_name = prompt("<%:Paste the new file name (including the extension) here:%>", "");
if (new_file_name == null || new_file_name == "") {
return false;
}
if (file_path == "/etc/openclash/config/" && new_file_name.split('.').pop() != "yaml" && new_file_name.split('.').pop() != "yml") {
alert('<%:Illegal extension!%>')
return false;
}
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "rename_file")%>', {new_file_name: new_file_name, file_path: file_path, file_name: file_name}, function(x, status) {
if (x && x.status == 200)
{
location.reload();
}
});
}
//]]>
</script>
<input type="button" class="btn cbi-button cbi-input-apply" value="<%:Rename%>" onclick="return import_new_file_name(this, '<%=self.option%>', '<%=self.value%>')" />
<%+cbi/valuefooter%>