Browse Source

Removed legacy Trashbin app

Removed legacy trash bin app
Fixed Text Editor small bug on Photo load
Fixed RAID not support console error
Toby Chui 1 week ago
parent
commit
a4a9c73a9a

+ 1 - 0
src/desktop.go

@@ -34,6 +34,7 @@ func DesktopInit() {
 				InternalVersion: internal_version,
 				DeviceVendor:    deviceVendor,
 				DeviceModel:     deviceModel,
+				RAIDSupported:   raidManager != nil,
 			}
 		},
 	}

+ 3 - 13
src/file_system.go

@@ -185,19 +185,9 @@ func FileSystemInit() {
 		SupportEmb:  false,
 	})
 
-	//Register the Trashbin module
-	moduleHandler.RegisterModule(module.ModuleInfo{
-		Name:         "Trash Bin",
-		Group:        "System Tools",
-		IconPath:     "SystemAO/file_system/trashbin_img/small_icon.png",
-		Version:      "1.0",
-		StartDir:     "SystemAO/file_system/trashbin.html",
-		SupportFW:    true,
-		InitFWSize:   []int{400, 200},
-		LaunchFWDir:  "SystemAO/file_system/trashbin.html",
-		SupportEmb:   false,
-		SupportedExt: []string{"*"},
-	})
+	//The trash bin is a view of the File Manager (js/explorer/trash.js) and the
+	//dock's trash; the old "Trash Bin" app is gone. Desktop shortcuts made for
+	//it still open that view (openModule in web/script/desktop/launch.js).
 
 	//Register the Zip Extractor module
 	moduleHandler.RegisterModule(module.ModuleInfo{

+ 1 - 0
src/mod/desktop/service/service.go

@@ -55,6 +55,7 @@ type HostInfo struct {
 	InternalVersion string
 	DeviceVendor    string
 	DeviceModel     string
+	RAIDSupported   bool //The RAID manager runs, so /system/disk/raid/* exists
 }
 
 // Options configures a desktop service. Database, Users and ResolveVirtualPath

+ 2 - 0
src/mod/desktop/service/service_test.go

@@ -401,6 +401,8 @@ func TestHandleHostInfo(t *testing.T) {
 	}{
 		{"no provider", nil, `"Hostname":""`},
 		{"provider", func() HostInfo { return HostInfo{Hostname: "NAS", DeviceModel: "AR100"} }, `"Hostname":"NAS"`},
+		{"no raid", func() HostInfo { return HostInfo{Hostname: "PC"} }, `"RAIDSupported":false`},
+		{"raid", func() HostInfo { return HostInfo{RAIDSupported: true} }, `"RAIDSupported":true`},
 	}
 	for _, tc := range tests {
 		t.Run(tc.name, func(t *testing.T) {

+ 0 - 261
src/system/locale/trashbin.json

@@ -1,261 +0,0 @@
-{
-    "author": "tobychui",
-    "version": "1.0",
-    "keys": {
-        "zh-tw": {
-            "fwtitle": "垃圾箱",
-            "strings": {
-                "title/title": "垃圾箱",
-                "button/deleteAll": "全部刪除",
-                "button/details": "詳情",
-                "button/restore": "恢復",
-                "list/filename": "檔案名稱",
-                "list/deleteTime": "刪除時間",
-                "list/details": "詳細資料",
-                "list/restore": "恢復檔案",
-                "list/scanning": "正在從所有虛擬磁碟區掃描回收檔案",
-                "list/notrash": "垃圾箱內並沒有任何檔案或資料夾",
-                "opr/move": "移動",
-                "opr/file": "檔案",
-                "opr/files": "檔案",
-                "opr/and": " 及 ",
-                "opr/more": " 等檔案",
-                "opr/toTrashBin": "到垃圾箱?",
-                "opr/delete": "刪除: ",
-                "opr/cancel": "取消",
-                "opr/confirm": "確認",
-                "message/nofileselected": "沒有選擇任何檔案",
-                "message/property": "屬性",
-                "message/value": "數值",
-                "message/notrash": "垃圾箱內沒有檔案或資料夾",
-                "message/confirmDelete": "確認要 **永久刪除** 所有檔案?",
-                "detail/storageFilename": "檔案儲存名稱",
-                "detail/storageFilepath": "檔案虛擬儲存路徑",
-                "detail/fileExt": "副檔名",
-                "detail/isDir": "資料夾",
-                "detail/filesize": "檔案大小",
-                "detail/removeTimestamp": "刪除時間戳",
-                "detail/removeDate": "刪除日期",
-                "detail/originalPath": "原始檔案虛擬路徑",
-                "detail/originalFilename": "原始檔案名稱",
-                "detail/ok": "確定",
-                "": ""
-            },
-            "titles": {},
-            "placeholder": {}
-        },
-        "zh-hk": {
-            "fwtitle": "垃圾箱",
-            "strings": {
-                "title/title": "垃圾箱",
-                "button/deleteAll": "全部刪除",
-                "button/details": "詳情",
-                "button/restore": "恢復",
-                "list/filename": "檔案名稱",
-                "list/deleteTime": "刪除時間",
-                "list/details": "詳細資料",
-                "list/restore": "恢復檔案",
-                "list/scanning": "正在從所有虛擬磁碟區掃描回收檔案",
-                "list/notrash": "垃圾箱內並沒有任何檔案或資料夾",
-                "opr/move": "移動",
-                "opr/file": "檔案",
-                "opr/files": "檔案",
-                "opr/and": " 及 ",
-                "opr/more": " 等檔案",
-                "opr/toTrashBin": "到垃圾箱?",
-                "opr/delete": "刪除: ",
-                "opr/cancel": "取消",
-                "opr/confirm": "確認",
-                "message/nofileselected": "沒有選擇任何檔案",
-                "message/property": "屬性",
-                "message/value": "數值",
-                "message/notrash": "垃圾箱內沒有檔案或資料夾",
-                "message/confirmDelete": "確認要 **永久刪除** 所有檔案?",
-                "detail/storageFilename": "檔案儲存名稱",
-                "detail/storageFilepath": "檔案虛擬儲存路徑",
-                "detail/fileExt": "副檔名",
-                "detail/isDir": "資料夾",
-                "detail/filesize": "檔案大小",
-                "detail/removeTimestamp": "刪除時間戳",
-                "detail/removeDate": "刪除日期",
-                "detail/originalPath": "原始檔案虛擬路徑",
-                "detail/originalFilename": "原始檔案名稱",
-                "detail/ok": "確定",
-                "": ""
-            },
-            "titles": {},
-            "placeholder": {}
-        },
-        "zh-cn": {
-            "fwtitle": "垃圾箱",
-            "strings": {
-                "title/title": "垃圾箱",
-                "button/deleteAll": "全部删除",
-                "button/details": "详情",
-                "button/restore": "恢复",
-                "list/filename": "文件名称",
-                "list/deleteTime": "删除时间",
-                "list/details": "详细信息",
-                "list/restore": "恢复文件",
-                "list/scanning": "正在从所有虚拟磁盘区扫描回收文件",
-                "list/notrash": "垃圾箱内并没有任何文件或文件夹",
-                "opr/move": "移动",
-                "opr/file": "文件",
-                "opr/files": "文件",
-                "opr/and": " 及 ",
-                "opr/more": " 等文件",
-                "opr/toTrashBin": "到垃圾箱?",
-                "opr/delete": "删除: ",
-                "opr/cancel": "取消",
-                "opr/confirm": "确定",
-                "message/nofileselected": "没有选择任何文件",
-                "message/property": "属性",
-                "message/value": "数值",
-                "message/notrash": "垃圾箱内没有文件或文件夹",
-                "message/confirmDelete": "确定要 **永久删除** 所有文件? ",
-                "detail/storageFilename": "文件存储名称",
-                "detail/storageFilepath": "文件虚拟存储路径",
-                "detail/fileExt": "扩展名",
-                "detail/isDir": "文件夹",
-                "detail/filesize": "文件大小",
-                "detail/removeTimestamp": "删除时间戳",
-                "detail/removeDate": "删除日期",
-                "detail/originalPath": "原始文件虚拟路径",
-                "detail/originalFilename": "原始文件名称",
-                "detail/ok": "确定",
-                "": ""
-            },
-            "titles": {},
-            "placeholder": {}
-        },
-        "en-us": {
-            "fwtitle": "Recycle Bin",
-            "fontFamily": "Arial, Helvetica, sans-serif",
-            "strings": {
-                "title/title": "Recycle Bin",
-                "button/deleteAll": "Delete All",
-                "button/details": "Details",
-                "button/restore": "Restore",
-                "list/filename": "Filename",
-                "list/deleteTime": "Deleted Time",
-                "list/details": "Details",
-                "list/restore": "Restore File",
-                "list/scanning": "Scanning recycle files from all virtual disk partitions",
-                "list/notrash": "The recycle bin has no files or folders",
-                "opr/move": "Move",
-                "opr/file": "file",
-                "opr/files": "files",
-                "opr/and": " and ",
-                "opr/more": " more files",
-                "opr/toTrashBin": "to Recycle Bin?",
-                "opr/delete": "Delete: ",
-                "opr/cancel": "Cancel",
-                "opr/confirm": "Confirm",
-                "message/nofileselected": "No files selected",
-                "message/property": "Property",
-                "message/value": "Value",
-                "message/notrash": "No files or folders in the recycle bin",
-                "message/confirmDelete": "Confirm **permanently delete** all files?",
-                "detail/storageFilename": "Storage Filename",
-                "detail/storageFilepath": "Virtual Storage Path",
-                "detail/fileExt": "File Extension",
-                "detail/isDir": "Folder",
-                "detail/filesize": "File Size",
-                "detail/removeTimestamp": "Deletion Timestamp",
-                "detail/removeDate": "Deletion Date",
-                "detail/originalPath": "Original Virtual Path",
-                "detail/originalFilename": "Original Filename",
-                "detail/ok": "OK",
-                "": ""
-            },
-            "titles": {},
-            "placeholder": {}
-        },
-        "ja-jp": {
-            "fwtitle": "ごみ箱",
-            "fontFamily": "\"Meiryo UI\", \"Arial Unicode MS\", \"Hiragino Kaku Gothic Pro\"",
-            "strings": {
-                "title/title": "ごみ箱",
-                "button/deleteAll": "すべて削除",
-                "button/details": "詳細",
-                "button/restore": "復元",
-                "list/filename": "ファイル名",
-                "list/deleteTime": "削除日時",
-                "list/details": "詳細情報",
-                "list/restore": "ファイルを復元",
-                "list/scanning": "すべての仮想ディスクパーティションからごみ箱ファイルをスキャン中",
-                "list/notrash": "ごみ箱にファイルまたはフォルダはありません",
-                "opr/move": "移動",
-                "opr/file": "ファイル",
-                "opr/files": "ファイル",
-                "opr/and": " および ",
-                "opr/more": " 個のファイル",
-                "opr/toTrashBin": "をごみ箱へ?",
-                "opr/delete": "削除:",
-                "opr/cancel": "キャンセル",
-                "opr/confirm": "確認",
-                "message/nofileselected": "ファイルが選択されていません",
-                "message/property": "プロパティ",
-                "message/value": "値",
-                "message/notrash": "ごみ箱にファイルまたはフォルダはありません",
-                "message/confirmDelete": "すべてのファイルを **完全に削除** することを確認しますか?",
-                "detail/storageFilename": "ストレージファイル名",
-                "detail/storageFilepath": "仮想ストレージパス",
-                "detail/fileExt": "ファイル拡張子",
-                "detail/isDir": "フォルダ",
-                "detail/filesize": "ファイルサイズ",
-                "detail/removeTimestamp": "削除タイムスタンプ",
-                "detail/removeDate": "削除日",
-                "detail/originalPath": "元の仮想パス",
-                "detail/originalFilename": "元のファイル名",
-                "detail/ok": "OK",
-                "": ""
-            },
-            "titles": {},
-            "placeholder": {}
-        },
-        "ko-kr": {
-            "fwtitle": "휴지통",
-            "fontFamily": "\"Malgun Gothic\", \"Apple SD Gothic Neo\"",
-            "strings": {
-                "title/title": "휴지통",
-                "button/deleteAll": "모두 삭제",
-                "button/details": "상세 정보",
-                "button/restore": "복원",
-                "list/filename": "파일 이름",
-                "list/deleteTime": "삭제 시간",
-                "list/details": "상세 정보",
-                "list/restore": "파일 복원",
-                "list/scanning": "모든 가상 디스크 파티션에서 휴지통 파일 검색 중",
-                "list/notrash": "휴지통에 파일 또는 폴더가 없습니다",
-                "opr/move": "이동",
-                "opr/file": "파일",
-                "opr/files": "파일",
-                "opr/and": " 및 ",
-                "opr/more": " 개의 파일",
-                "opr/toTrashBin": "을(를) 휴지통으로?",
-                "opr/delete": "삭제: ",
-                "opr/cancel": "취소",
-                "opr/confirm": "확인",
-                "message/nofileselected": "선택된 파일이 없습니다",
-                "message/property": "속성",
-                "message/value": "값",
-                "message/notrash": "휴지통에 파일 또는 폴더가 없습니다",
-                "message/confirmDelete": "모든 파일을 **영구적으로 삭제**하시겠습니까?",
-                "detail/storageFilename": "저장 파일명",
-                "detail/storageFilepath": "가상 저장 경로",
-                "detail/fileExt": "파일 확장자",
-                "detail/isDir": "폴더",
-                "detail/filesize": "파일 크기",
-                "detail/removeTimestamp": "삭제 타임스탬프",
-                "detail/removeDate": "삭제 날짜",
-                "detail/originalPath": "원본 가상 경로",
-                "detail/originalFilename": "원본 파일명",
-                "detail/ok": "확인",
-                "": ""
-            },
-            "titles": {},
-            "placeholder": {}
-        }
-    }
-}

+ 4 - 1
src/web/Drive/js/actions.js

@@ -75,7 +75,7 @@
             return [];
         }
         return S().modules.filter(function (m) {
-            if (!m.SupportedExt || m.Group == "Interface Module" || m.Name == "Trash Bin") {
+            if (!m.SupportedExt || m.Group == "Interface Module") {
                 return false;
             }
             if (!launchURL(m)) {
@@ -123,6 +123,9 @@
             var type = lines[0], name = lines[1], target = lines[2], icon = lines[3];
             if (type == "folder") {
                 location.hash = Drive.folderRoute(target);
+            } else if (type == "module" && target == "Trash Bin") {
+                //A shortcut of the old Trash Bin app
+                location.hash = "#/trash";
             } else if (type == "module") {
                 var m = Drive.module(target);
                 if (m) {

+ 4 - 1
src/web/SystemAO/file_system/js/explorer/open.js

@@ -74,7 +74,10 @@ function openthis(object,evt=null, isDoubleClick=false){
                 2: Shortcut target 
                 3: Shortcut icon image
             */
-            if (shortcutInfo[0] == "module"){
+            if (shortcutInfo[0] == "module" && shortcutInfo[2] == "Trash Bin"){
+                //A shortcut of the old Trash Bin app: the trash is a view of this window now
+                listDirectory("%trashbin%");
+            }else if (shortcutInfo[0] == "module"){
                 //This is a module
                 if (ao_module_virtualDesktop){
                     //Open Module with VDI API

+ 0 - 362
src/web/SystemAO/file_system/trashbin.html

@@ -1,362 +0,0 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <title>Trash Bin</title>
-        <meta charset="UTF-8">
-        <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
-        <link rel="stylesheet" href="../../script/semantic/semantic.min.css">
-        <script type="text/javascript" src="../../script/jquery.min.js"></script>
-        <script type="text/javascript" src="../../script/semantic/semantic.min.js"></script>
-        <script type="text/javascript" src="../../script/ao_module.js"></script>
-        <script type="text/javascript" src="../../script/applocale.js"></script>
-        <script type="text/javascript" src="shared/escape.js"></script>
-        <style>
-            body{
-                background-color:white;
-            }
-            .banner{
-                background-color:#4287f5;
-                height:50px;
-                padding:12px;
-                padding-left:20px;
-                padding-top:16px;
-            }
-
-            #opricon{
-                position:absolute;
-                top:0px;
-                right:0px;
-                width:80px;
-                height:80px;
-            }
-            .title{
-                color:white;
-                font-size:130%;
-            }
-            .content{
-                padding:12px;
-            }
-            
-            .info{
-                margin-top:3px;
-                width:80%;
-            }
-            
-        </style>
-    </head>
-    <body>
-        <span class="normalview">
-        <div class="ui menu">
-            <div class="header item">
-               <img class="ui middle aligned mini image" src="trashbin_img/small_icon.png" style="margin-right:8px; height:28px; width:28px;"></img> <span locale="title/title">Trash Bin</span>
-            </div>
-            <div class="right item">
-                <button class="ui negative small button" onclick="clearAll();" locale="button/deleteAll">Delete All</button>
-            </div>
-        </div>
-        <div class="ui container">
-            <div class="ui segment">
-                <table class="ui celled table">
-                    <thead>
-                        <tr>
-                            <th locale="list/filename">Filename</th>
-                            <th locale="list/deleteTime">Delete Time</th>
-                            <th locale="list/details">Details</th>
-                            <th locale="list/restore">Restore</th>
-                        </tr>
-                    </thead>
-                    <tbody id="trashList">
-                    </tbody>
-                </table>
-                <div class="ui message" id="scanning">
-                    <i class="loading spinner icon"></i> <span locale="list/scanning">Scanning for trash in all disks...</span>
-                </div>
-            </div>
-        </div>
-        </span>
-        <div class="confirmRemove" style="display:none;">
-            <div class="banner">
-                <div class="title"><span locale="opr/move">Move</span> <span id="fcount">0 File</span> <span locale="opr/toTrashBin">to Trash Bin?</span></div>
-                <img id="opricon" src="trashbin_img/trashopr.png" class="ui image"></img>
-            </div>
-            <div class="content">
-                <div class="info"><span locale="opr/delete">Deleting:</span> <span class="filename"></span></div>
-                <div style="position:absolute; bottom:8px;right:4px;">
-                    <button class="ui small button" onclick="ao_module_close();" locale="opr/cancel">Cancel</button>
-                    <button class="ui primary small button" onclick="confirmDelete();" locale="opr/confirm">Confirm</button>
-                </div>
-            </div>
-        </div>
-        <div class="ui modal" style="overflow-y:auto; overflow-x:hidden;">
-            <i class="close icon"></i>
-            <div class="header filename" locale="message/nofileselected">
-                No File Selected
-            </div>
-            <div class="ui basic segment">
-                <table class="ui very basic celled table">
-                    <thead>
-                        <tr>
-                            <th locale="message/property">Property</th>
-                            <th locale="message/value">Value</th>
-                        </tr>
-                    </thead>
-                    <tbody id="detailList">
-                       
-                    </tbody>
-                </table>
-            </div>
-            <div class="actions">
-                <div class="ui button" onclick=" $('.ui.modal').modal('hide');" locale="detail/ok">
-                 OK
-                </div>
-            </div>
-        </div>
-
-        <script>
-            var deletePendingFiles = ao_module_loadInputFiles();
-            var previousTrashbinFilelist = [];
-            var legacyMode = !('WebSocket' in window || 'MozWebSocket' in window); 
-
-            if (!applocale){
-                applocale = {
-                    init: function(json, callback){
-                        if (callback){
-                            callback();
-                        }
-                    }
-                }
-            }
-            applocale.init("../../SystemAO/locale/trashbin.json", function(){
-                applocale.translate();
-
-                if (deletePendingFiles != null && deletePendingFiles.length > 0){
-                    //Handle trash treatment
-                    console.log(deletePendingFiles);
-                    ao_module_setFixedWindowSize();
-                    //ao_module_setWindowSize(400,200);
-                    $(".normalview").hide();
-                    $(".confirmRemove").show();
-
-                    //Update graphical information
-                    var displayname = deletePendingFiles[0].filename;
-                    $("#fcount").text("1 " + applocale.getString("opr/file", "File"));
-                    if (deletePendingFiles.length > 1){
-                        displayname = displayname + applocale.getString("opr/and", " and ") + (deletePendingFiles.length - 1) + applocale.getString("opr/more", " more");
-                        $("#fcount").text(deletePendingFiles.length + " " + applocale.getString("opr/files", "Files"));
-                    }
-                    $(".filename").text(displayname);
-
-                }else{
-                    //List all trash mode
-                    ao_module_setWindowSize(1080, 580);
-                    initList();
-                }
-
-            });
-
-           
-
-            //Initialize the trash list
-            function initList(){
-                $("#trashList").html("");
-                $("#scanning").show();
-                if (!legacyMode){
-                    //Use WebSocket for rendering
-                    var ws = new WebSocket(getWSEndpoint() + `/system/file_system/ws/listTrash`);
-                   
-                    ws.onopen = function() {
-                        previousTrashbinFilelist = [];
-                        console.log("TrashBin WebSocket Opened");
-                    };
-                    
-                    ws.onmessage = function (evt) { 
-                        var data = evt.data;
-                        var thisFile = JSON.parse(data);
-                        var filedata = encodeURIComponent(JSON.stringify(thisFile));
-                        //console.log(thisFile);
-
-                        $("#trashList").append(`<tr>
-                            <td>${escapeHTML(thisFile.OriginalFilename)}</td>
-                            <td>${thisFile.RemoveDate}</td>
-                            <td><button filedata="${filedata}" class="ui tiny button" onclick="showDetail(this);">${applocale.getString("button/details","Details")}</button></td>
-                            <td><button filedata="${filedata}" class="ui green tiny button" onclick="restore(this);">${applocale.getString("button/restore", "Restore")}</button></td>
-                        </tr>`);
-                        previousTrashbinFilelist.push(thisFile);
-                    };
-                    
-                    ws.onclose = function() { 
-                        console.log("TrashBin WebSocket transfer completed");
-                        if (previousTrashbinFilelist.length == 0){
-                            $("#trashList").append(`<tr><td colspan="4"><i class="checkmark icon"></i> ${applocale.getString("list/notrash", "There are no files or folders in Trashbin.")}</td></tr>`);
-                        }
-                        $("#scanning").hide();
-                    };
-
-                    ws.onerror = function(){
-                        console.log("Open failed. Fallback to legacy mode");
-                        legacyMode = true;
-                        initList();
-                    }
-                }else{
-                    //Use AJAX (Slower)
-                    $.get("../../system/file_system/listTrash",function(data){
-                        if (data.error !== undefined){
-                            $("#scanning").hide();
-                            alert(data.error);
-                        }else{
-                            previousTrashbinFilelist = [];
-                            for (var i =0; i < data.length; i++){
-                                var thisFile = data[i];
-                                var filedata = encodeURIComponent(JSON.stringify(thisFile));
-                                $("#trashList").append(`<tr>
-                                    <td>${escapeHTML(thisFile.OriginalFilename)}</td>
-                                    <td>${thisFile.RemoveDate}</td>
-                                    <td><button filedata="${filedata}" class="ui tiny button" onclick="showDetail(this);">${applocale.getString("button/details","Details")}</button></td>
-                                    <td><button filedata="${filedata}" class="ui green tiny button" onclick="restore(this);">${applocale.getString("button/restore", "Restore")}</button></td>
-                                </tr>`);
-                                previousTrashbinFilelist.push(thisFile);
-                            }
-
-                            if (data.length == 0){
-                                $("#trashList").append(`<tr><td colspan="4"><i class="checkmark icon"></i> ${applocale.getString("message/notrash","There are no files or folders in Trashbin.")}</td></tr>`);
-                            }
-                            $("#scanning").hide();
-                        }
-                    });
-                }
-            }
-
-            function getWSEndpoint(){
-                //Open opeartion in websocket
-                let protocol = "wss://";
-                if (location.protocol !== 'https:') {
-                    protocol = "ws://";
-                }
-
-                var port = window.location.port;
-                if (window.location.port == ""){
-                    if (location.protocol !== 'https:') {
-                        port = "80";
-                    }else{
-                        port = "443";
-                    }
-                    
-                }
-
-                wsControlEndpoint = (protocol + window.location.hostname + ":" + port);
-                return wsControlEndpoint;
-            }
-            
-
-            //Listen to the change of the trashbin
-            setInterval(function(){
-                $.get("../../system/file_system/listTrash",function(data){
-                    if (data.length != previousTrashbinFilelist.length){
-                        //Change of the trashbin file. Update the list
-                        initList();
-                    }
-                });
-            }, 30000);
-
-            function showDetail(object){
-                var filedata = JSON.parse(decodeURIComponent($(object).attr("filedata")));
-                $(".filename").text(filedata.OriginalFilename);
-                $("#detailList").html("");
-                var keyMapping = {
-                    "Filename": applocale.getString("detail/storageFilename", "Storage Filename"),
-                    "Filepath": applocale.getString("detail/storageFilepath","Storage Filepath"),
-                    "FileExt": applocale.getString("detail/fileExt","File Extension"),
-                    "IsDir": applocale.getString("detail/isDir","Is Directory"),
-                    "Filesize": applocale.getString("detail/filesize","File Size"),
-                    "RemoveTimestamp": applocale.getString("detail/removeTimestamp","Remove Timestamp"),
-                    "RemoveDate": applocale.getString("detail/removeDate","Remove Datetime"),
-                    "OriginalPath": applocale.getString("detail/originalPath","Original Path"),
-                    "OriginalFilename": applocale.getString("detail/originalFilename","Original Filename")
-                }
-                for (var [key, value] of Object.entries(filedata)) {
-                    console.log(key, value);
-                    var displayKey = keyMapping[key];
-                    if (key == "Filesize"){
-                        value = bytesToSize(value);
-                    }
-                    $("#detailList").append(`<tr>
-                            <td>
-                                ${displayKey}
-                            </td>
-                            <td>${escapeHTML(value)}</td>
-                        </tr>`);
-                }
-                
-                $('.ui.modal').modal('show').css({"overflow-y":"auto","overflow-x": "hidden", "max-height":window.innerHeight - 30 + "px"});
-
-            }
-
-            function bytesToSize(bytes) {
-                var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
-                if (bytes == 0) return '0 Byte';
-                var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
-                return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
-            }
-
-            function clearAll(){
-                if (confirm(applocale.getString("message/confirmDelete", "Confirm deleting ALL FILE PERMANENTLY?"))){
-                    $.get("../../system/file_system/clearTrash",function(data){
-                        initList();
-                    });
-                }
-            }
-
-            function restore(obj){
-                var filedata = JSON.parse(decodeURIComponent($(obj).attr("filedata")));
-                var filepath = filedata.Filepath;
-                $.ajax({
-                    url: "../../system/file_system/restoreTrash",
-                    method: "POST",
-                    data: {"src" : filepath},
-                    success: function(data){
-                        if (data.error !== undefined){
-                            alert(data.error);
-                        }else{
-                            initList();
-                            parent.refresh(undefined, true);
-                        }
-                    }
-                })
-            }
-
-            function confirmDelete(){
-                //Confirm delete of the files in the list
-                var deleteFileList = [];
-                for (var i =0; i <deletePendingFiles.length; i++){
-                    deleteFileList.push(deletePendingFiles[i].filepath);
-                }
-                requestCSRFToken(function(token){
-                    $.ajax({
-                        url: "../../system/file_system/fileOpr",
-                        method:"POST",
-                        data: {opr: "recycle", src: JSON.stringify(deleteFileList), csrft: token},
-                        success: function(data){
-                            if (data.error !== undefined){
-                                console.log("Delete failed! " + data.error)
-                            }else{
-                                //Delete completed. Close this window
-                                parent.refresh(undefined, true);
-                                ao_module_close();
-                            }
-                        }
-                    });
-                });
-                
-            }
-
-            function requestCSRFToken(callback){
-                $.ajax({
-                    url: "../../system/csrf/new",
-                    success: function(token){
-                        callback(token);
-                    }
-                })
-            }
-        </script>
-    </body>
-</html>

BIN
src/web/SystemAO/file_system/trashbin_img/trashopr.png


BIN
src/web/SystemAO/file_system/trashbin_img/trashopr.psd


+ 75 - 4
src/web/Text/index.html

@@ -1341,14 +1341,76 @@ function onRichKeydown(e){
     if (e.key === "Backspace" && backspaceAtBlockStart()){ e.preventDefault(); return; }
     if ((e.key === "Backspace" || e.key === "Delete") && deleteInCode(e.key === "Delete")){ e.preventDefault(); return; }
     if (e.key === "ArrowDown" && !e.shiftKey && exitCodeBlockDown()){ e.preventDefault(); return; }
+    if (e.key === "ArrowRight" && !e.shiftKey && escapeInlineMark()){ e.preventDefault(); return; }
     if (e.key === "Enter" && activeCodeBlock()){ e.preventDefault(); insertNewlineInCode(); return; }
     if (e.key === " "){
         if (blockTransformOnSpace()) e.preventDefault();
     } else if (e.key === "Enter"){
-        if (blockTransformOnEnter()) e.preventDefault();
+        if (blockTransformOnEnter()){ e.preventDefault(); return; }
+        // Enter at the very end of a block while still inside `code` / **bold**
+        // / … : step out of the marks first, so the browser's native paragraph
+        // split does not carry the formatting onto the new line
+        var eb = currentBlock() || rich;
+        if (!e.shiftKey && eb.tagName !== "PRE" && textAfterCaret(eb).replace(/​/g, "") === ""){
+            var escaped = false;
+            while (escapeInlineMark()) escaped = true;
+            // the spacer at the line end makes the browser pad the line it
+            // leaves behind with a placeholder <br>, which would save as a
+            // trailing hard break: drop it once the split is done
+            if (escaped && eb !== rich) setTimeout(function(){ dropPlaceholderBr(eb); }, 0);
+        }
     }
 }
 
+function dropPlaceholderBr(block){
+    if (!rich.contains(block)) return;
+    var last = block.lastChild;
+    if (!last || last.nodeName !== "BR") return;
+    if (block.textContent.replace(/​/g, "").trim() === "") return;   // an empty line needs it
+    block.removeChild(last);
+}
+
+// ── Leaving inline marks with the Right arrow ───────────────────────────
+// At the end of an inline mark (`code`, **bold**, *italic*, ~~strike~~, a
+// link, …) the caret is still inside the element, and when nothing follows it
+// in the block the browser has nowhere to move it — so everything typed keeps
+// the formatting. Right then steps out one level instead: the caret moves to a
+// zero-width spacer placed right after the element (the same spacer
+// applyInline() leaves), which serialization strips again.
+var INLINE_MARK_TAGS = /^(STRONG|B|EM|I|DEL|S|STRIKE|CODE|A|U|MARK|SUB|SUP)$/;
+function escapeInlineMark(){
+    var sel = getSel();
+    if (!sel.rangeCount || !sel.isCollapsed) return false;
+    // loose text typed straight into the editor has no block: the editor
+    // itself is then the boundary
+    var block = currentBlock() || rich;
+    if (block.tagName === "PRE" || activeCodeBlock()) return false;
+    if (!rich.contains(sel.anchorNode)) return false;
+    var n = sel.getRangeAt(0).startContainer;
+    if (n.nodeType === 3) n = n.parentNode;
+    var el = null;
+    while (n && n !== block && n !== rich){
+        if (n.nodeType === 1 && INLINE_MARK_TAGS.test(n.tagName)){ el = n; break; }
+        n = n.parentNode;
+    }
+    if (!el) return false;
+    if (textAfterCaret(el).replace(/​/g, "") !== "") return false;   // not at its end yet
+    // a link's editable "](url)" mark sits right after it: step past that too
+    var ref = el;
+    var nx = ref.nextSibling;
+    if (nx && nx.nodeType === 1 && nx.classList && nx.classList.contains("md-linksyn")) ref = nx;
+    var spacer = ref.nextSibling;
+    if (!(spacer && spacer.nodeType === 3 && spacer.data.charAt(0) === "​")){
+        spacer = document.createTextNode("​");
+        ref.parentNode.insertBefore(spacer, ref.nextSibling);
+    }
+    var r = document.createRange();
+    r.setStart(spacer, 1); r.collapse(true);
+    sel.removeAllRanges(); sel.addRange(r);
+    updateToolbarState();
+    return true;
+}
+
 // caret sits at the very start of the block (ignoring the ZWSP spacer)?
 function caretAtBlockStart(block){
     var sel = getSel();
@@ -2260,7 +2322,7 @@ function syncImgFromSyn(syn){
         img.removeAttribute("data-rel");
         img.setAttribute("src", rawSrc);
     } else {
-        var rel = rawSrc.replace(/^\.?\/+/, "");
+        var rel = decodeRel(rawSrc);
         img.setAttribute("data-rel", rel);
         img.setAttribute("src", filepath ? mediaURLFor(rel) : rel);
     }
@@ -2395,6 +2457,15 @@ function docName(){
 function relDir(){
     return settings.imgDir.replace(/\{name\}/g, docName()).replace(/^\.?\/+/, "");
 }
+// a markdown image destination is a URL: the parser hands back a path with
+// spaces as "%20" (and a hand-typed one may carry escapes too), while files
+// are looked up by their real name. Without this a reopened image under
+// "img/Hello World/" was requested as "Hello%2520World" and never loaded.
+function decodeRel(rel){
+    rel = (rel || "").replace(/^\.?\/+/, "");
+    if (rel.indexOf("%") < 0) return rel;
+    try { return decodeURIComponent(rel); } catch(e){ return rel; }   // a literal "%" in a name
+}
 function mediaURLFor(rel){
     rel = rel.replace(/^\.?\/+/, "");
     return ao_root + "media?file=" + encodeURIComponent(docDir() + "/" + rel);
@@ -2404,7 +2475,7 @@ function rewriteImageSrcs(root){
     $(root).find("img").each(function(){
         var src = this.getAttribute("src") || "";
         if (/^(https?:|data:|blob:)/i.test(src) || src.indexOf("media?file=") >= 0) return;
-        var rel = src.replace(/^\.?\/+/, "");
+        var rel = decodeRel(src);
         this.setAttribute("data-rel", rel);
         this.setAttribute("src", mediaURLFor(rel));
     });
@@ -2673,7 +2744,7 @@ function collectDocImages(){
     var seen = {}, out = [];
     function add(p){
         if (!p) return;
-        p = p.replace(/^\.?\/+/, "");
+        p = decodeRel(p);
         if (/^(https?:|data:)/i.test(p) || p.indexOf("media?file=") >= 0) return;
         if (!seen[p]){ seen[p] = 1; out.push(p); }
     }

+ 1 - 1
src/web/script/desktop/dock.js

@@ -780,7 +780,7 @@ function dockPinFromDesktopIcon(icon){
     }
     var target = fd.ShortcutPath;
     if (fd.ShortcutType == "module"){
-        //The trash already has its own place on the dock
+        //A shortcut of the old Trash Bin app: the trash already has its own place on the dock
         return target == "Trash Bin" ? null : target;
     }else if (fd.ShortcutType == "folder"){
         var special = getSpecialPathInfo(target);

+ 14 - 0
src/web/script/desktop/launch.js

@@ -8,7 +8,21 @@
     Part of desktop.html, see README.md in this folder for the load order.
 */
 
+//Module names that are now a place in the File Manager. Desktop shortcuts
+//made for the old Trash Bin app still name it.
+var LEGACY_MODULE_FOLDERS = {
+    "Trash Bin": "%trashbin%"
+};
+
 function openModule(moduleName, callback=undefined) {
+    if (LEGACY_MODULE_FOLDERS[moduleName] !== undefined) {
+        openFolder(LEGACY_MODULE_FOLDERS[moduleName]);
+        if (callback !== undefined){
+            callback();
+        }
+        hideListMenu();
+        return;
+    }
     $.get("system/modules/getLaunchPara?module=" + moduleName, function(data) {
         if (data.error !== undefined) {
             //Something went wrong.

+ 30 - 0
src/web/script/desktop/quickaccess.js

@@ -34,6 +34,8 @@ var qaHealth = {smart: 0, raid: 0};     //0 good, 1 warning, 2 failing
 var qaNics = [];
 var qaDisks = [];
 var qaShowAllDisks = false;
+var qaRaidWaiting = false;              //RAID overview waits for the host info (session.js)
+var qaRaidLogged = false;               //"no RAID on this host" was logged once
 
 /*
     Open and close
@@ -460,7 +462,28 @@ function qaParseLinuxDisks(data){
     return disks;
 }
 
+/*
+    /system/disk/raid/* only exists while the server runs its RAID manager
+    (Linux with mdadm and -enable_hwman), which the host info tells as
+    RAIDSupported. Asking anyway would put a 404 in the console on every
+    refresh, so a host without it is skipped with one debug line.
+*/
 function qaLoadRaid(){
+    if (typeof hostInfo == "undefined" || hostInfo == null || hostInfo.RAIDSupported === undefined){
+        //The host info is not in yet: qaHostInfoLoaded asks again
+        qaRaidWaiting = true;
+        return;
+    }
+    qaRaidWaiting = false;
+    if (hostInfo.RAIDSupported !== true){
+        if (!qaRaidLogged){
+            qaRaidLogged = true;
+            console.debug("[Desktop] RAID is not supported on this host (needs Linux with mdadm and -enable_hwman), skipping the RAID overview");
+        }
+        qaHealth.raid = 0;
+        qaRenderHealth();
+        return;
+    }
     $.ajax({
         url: "system/disk/raid/overview",
         success: function(data){
@@ -498,6 +521,13 @@ function qaLoadRaid(){
     });
 }
 
+//Called by initDesktopHostInfo (session.js) once the host info is in
+function qaHostInfoLoaded(){
+    if (qaRaidWaiting){
+        qaLoadRaid();
+    }
+}
+
 function qaRenderDisks(){
     var card = $("#qaStorage");
     var list = $("#qaDiskList").empty();

+ 1 - 0
src/web/script/desktop/session.js

@@ -121,6 +121,7 @@ function initDesktopHostInfo(){
         document.title = hostInfo.Hostname;
         $("#sysinfo").text(hostInfo.DeviceModel + " firmware:" + hostInfo.BuildVersion + " " + hostInfo.InternalVersion);
         qaRenderFacts();
+        qaHostInfoLoaded();
     });
 
     //Volume and brightness are kept in localStorage (0 to 1), which WebApps