浏览代码

WebClient: add support for more languages to the editor

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
Nicola Murino 1 年之前
父节点
当前提交
59bdd4bc4e
共有 3 个文件被更改,包括 5 次插入2 次删除
  1. 1 1
      internal/httpd/httpd.go
  2. 0 0
      static/vendor/codemirror/cm6.bundle.min.js
  3. 4 1
      templates/webclient/editfile.html

+ 1 - 1
internal/httpd/httpd.go

@@ -184,7 +184,7 @@ const (
 	MaxRestoreSize       = 20 * 1048576 // 20 MB
 	maxRequestSize       = 1048576      // 1MB
 	maxLoginBodySize     = 262144       // 256 KB
-	httpdMaxEditFileSize = 1048576      // 1 MB
+	httpdMaxEditFileSize = 2 * 1048576  // 2 MB
 	maxMultipartMem      = 10 * 1048576 // 10 MB
 	osWindows            = "windows"
 	otpHeaderCode        = "X-SFTPGO-OTP"

文件差异内容过多而无法显示
+ 0 - 0
static/vendor/codemirror/cm6.bundle.min.js


+ 4 - 1
templates/webclient/editfile.html

@@ -150,8 +150,11 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
     //{{- end}}
 
     KTUtil.onDOMContentLoaded(function () {
+        let filename = "{{.Name}}";
+        let extension = filename.slice((filename.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
         let options = {
-            oneDark: KTThemeMode.getMode() == "dark"
+            oneDark: KTThemeMode.getMode() == "dark",
+            fileExt: extension
         };
         //{{- if .ReadOnly}}
         options.readOnly = true;

部分文件因为文件数量过多而无法显示