2020-05-29 22:22:00 +02:00
|
|
|
// Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
|
|
|
|
|
|
|
// AnTOS Web desktop is is licensed under the GNU General Public
|
|
|
|
// License v3.0, see the LICENCE file for more information
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation, either version 3 of
|
|
|
|
// the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
//along with this program. If not, see https://www.gnu.org/licenses/.
|
|
|
|
|
|
|
|
namespace OS {
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* This namespace is dedicated to everything related to the
|
|
|
|
* global system settings
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
export namespace setting {
|
|
|
|
/**
|
2020-06-18 17:09:00 +02:00
|
|
|
* User setting type definition
|
2020-05-29 22:22:00 +02:00
|
|
|
*
|
|
|
|
* @export
|
|
|
|
* @interface UserSettingType
|
|
|
|
*/
|
|
|
|
export interface UserSettingType {
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* User full name
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
* @memberof UserSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
name: string;
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* User name
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
* @memberof UserSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
username: string;
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* User id
|
|
|
|
*
|
|
|
|
* @type {number}
|
|
|
|
* @memberof UserSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
id: number;
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* User groups
|
|
|
|
*
|
|
|
|
* @type {{ [index: number]: string }}
|
|
|
|
* @memberof UserSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
group?: { [index: number]: string };
|
|
|
|
[propName: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-06-18 17:09:00 +02:00
|
|
|
* Virtual desktop setting data type
|
2020-05-29 22:22:00 +02:00
|
|
|
*
|
|
|
|
* @export
|
|
|
|
* @interface DesktopSettingType
|
|
|
|
*/
|
|
|
|
export interface DesktopSettingType {
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* Desktop VFS path
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
* @memberof DesktopSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
path: string;
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Desktop menu, can be added automatically by applications
|
|
|
|
*
|
|
|
|
* @type {GUI.BasicItemType[]}
|
|
|
|
* @memberof DesktopSettingType
|
|
|
|
*/
|
|
|
|
menu: GUI.BasicItemType[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show desktop hidden files
|
|
|
|
*
|
|
|
|
* @type {boolean}
|
|
|
|
* @memberof DesktopSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
showhidden: boolean;
|
|
|
|
[propName: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-06-18 17:09:00 +02:00
|
|
|
* Wallpaper setting data type
|
2020-05-29 22:22:00 +02:00
|
|
|
*
|
|
|
|
* @export
|
|
|
|
* @interface WPSettingType
|
|
|
|
*/
|
|
|
|
export interface WPSettingType {
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* Repeat wallpaper:
|
|
|
|
* - `repeat`
|
|
|
|
* - `repeat-x`
|
|
|
|
* - `repeat-y`
|
|
|
|
* - `no-repeat`
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
* @memberof WPSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
repeat: string;
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Wallpaper size
|
|
|
|
* - `contain`
|
|
|
|
* - `cover`
|
|
|
|
* - `auto`
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
* @memberof WPSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
size: string;
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* VFS path to the wallpaper image
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
* @memberof WPSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
url: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-06-18 17:09:00 +02:00
|
|
|
* Theme setting data type
|
2020-05-29 22:22:00 +02:00
|
|
|
*
|
|
|
|
* @export
|
|
|
|
* @interface ThemeSettingType
|
|
|
|
*/
|
|
|
|
export interface ThemeSettingType {
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* Theme name, this value is used for looking
|
|
|
|
* theme file in system asset
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
* @memberof ThemeSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
name: string;
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Theme user-friendly text
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
* @memberof ThemeSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
text: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-06-18 17:09:00 +02:00
|
|
|
* Appearance setting data type
|
2020-05-29 22:22:00 +02:00
|
|
|
*
|
|
|
|
* @export
|
|
|
|
* @interface AppearanceSettingType
|
|
|
|
*/
|
|
|
|
export interface AppearanceSettingType {
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* Current theme name
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
* @memberof AppearanceSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
theme: string;
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* All themes available in the system
|
|
|
|
*
|
|
|
|
* @type {ThemeSettingType[]}
|
|
|
|
* @memberof AppearanceSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
themes: ThemeSettingType[];
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Current wallpaper setting
|
|
|
|
*
|
|
|
|
* @type {WPSettingType}
|
|
|
|
* @memberof AppearanceSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
wp: WPSettingType;
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* All wallpapers available in the system
|
|
|
|
*
|
|
|
|
* @type {string[]}
|
|
|
|
* @memberof AppearanceSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
wps: string[];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-06-18 17:09:00 +02:00
|
|
|
* VFS Mount points setting data type
|
2020-05-29 22:22:00 +02:00
|
|
|
*
|
|
|
|
* @export
|
|
|
|
* @interface VFSMountPointSettingType
|
|
|
|
*/
|
|
|
|
export interface VFSMountPointSettingType {
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* Path to the mount point
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
* @memberof VFSMountPointSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
path: string;
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* User friendly mount point name
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
* @memberof VFSMountPointSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
text: string;
|
|
|
|
[propName: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-06-18 17:09:00 +02:00
|
|
|
* VFS setting data type
|
2020-05-29 22:22:00 +02:00
|
|
|
*
|
|
|
|
* @export
|
|
|
|
* @interface VFSSettingType
|
|
|
|
*/
|
|
|
|
export interface VFSSettingType {
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* mount points setting
|
|
|
|
*
|
|
|
|
* @type {VFSMountPointSettingType[]}
|
|
|
|
* @memberof VFSSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
mountpoints: VFSMountPointSettingType[];
|
|
|
|
[propName: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-06-18 17:09:00 +02:00
|
|
|
* Global system setting data type
|
2020-05-29 22:22:00 +02:00
|
|
|
*
|
|
|
|
* @export
|
|
|
|
* @interface SystemSettingType
|
|
|
|
*/
|
|
|
|
export interface SystemSettingType {
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* System error report URL
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
* @memberof SystemSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
error_report: string;
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Current system locale e.g. `en_GB`
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
* @memberof SystemSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
locale: string;
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* System menus
|
|
|
|
*
|
|
|
|
* @type {API.PackageMetaType[]}
|
|
|
|
* @memberof API.PackageMetaType
|
|
|
|
*/
|
|
|
|
menu: API.PackageMetaType[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Packages meta-data
|
|
|
|
*
|
|
|
|
* @type {{ [index: string]: API.PackageMetaType }}
|
|
|
|
* @memberof SystemSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
packages: { [index: string]: API.PackageMetaType };
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Path to the installed packages
|
|
|
|
*
|
|
|
|
* @type {{
|
|
|
|
* user: string;
|
|
|
|
* system: string;
|
|
|
|
* }}
|
|
|
|
* @memberof SystemSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
pkgpaths: {
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* User specific packages install location
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
user: string;
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* System packages install location
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
system: string;
|
|
|
|
};
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Package repositories setting.
|
|
|
|
* This configuration is used by [[MarketPlace]]
|
|
|
|
* for package management
|
|
|
|
*
|
|
|
|
* @type {{
|
|
|
|
* text: string;
|
|
|
|
* url: string;
|
|
|
|
* }[]}
|
|
|
|
* @memberof SystemSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
repositories: {
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* Repository name
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
text: string;
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Repository uri
|
|
|
|
*
|
|
|
|
* @type {string}
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
url: string;
|
|
|
|
}[];
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Startup applications and services
|
|
|
|
*
|
|
|
|
* @type {{
|
|
|
|
* apps: string[];
|
|
|
|
* services: string[];
|
|
|
|
* }}
|
|
|
|
* @memberof SystemSettingType
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
startup: {
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* List of application names
|
|
|
|
*
|
|
|
|
* @type {string[]}
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
apps: string[];
|
2020-06-18 17:09:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* List of service names
|
|
|
|
*
|
|
|
|
* @type {string[]}
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
services: string[];
|
2021-03-15 19:20:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* List of pinned applications
|
|
|
|
*
|
|
|
|
* @type {string[]}
|
|
|
|
*/
|
|
|
|
pinned: string[];
|
2020-05-29 22:22:00 +02:00
|
|
|
};
|
|
|
|
}
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* User settings
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
export var user: UserSettingType;
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* Application settings
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
export var applications: GenericObject<any> = {};
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* Desktop settings
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
export var desktop: DesktopSettingType;
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* Appearance settings
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
export var appearance: AppearanceSettingType;
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* VFS settings
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
export var VFS: VFSSettingType;
|
2020-06-18 17:09:00 +02:00
|
|
|
/**
|
|
|
|
* System settings
|
|
|
|
*/
|
2020-05-29 22:22:00 +02:00
|
|
|
export var system: SystemSettingType;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-06-18 17:09:00 +02:00
|
|
|
* Reset the system settings to default values
|
2020-05-29 22:22:00 +02:00
|
|
|
*
|
|
|
|
* @export
|
|
|
|
*/
|
|
|
|
export function resetSetting(): void {
|
|
|
|
setting.desktop = {
|
|
|
|
path: "home://.desktop",
|
|
|
|
menu: [],
|
2020-06-18 17:09:00 +02:00
|
|
|
showhidden: false,
|
2020-05-29 22:22:00 +02:00
|
|
|
};
|
|
|
|
setting.user = {
|
|
|
|
name: undefined,
|
|
|
|
username: undefined,
|
|
|
|
id: 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
setting.appearance = {
|
|
|
|
theme: "antos_dark",
|
|
|
|
themes: [
|
|
|
|
{
|
|
|
|
text: "AntOS light",
|
|
|
|
name: "antos_light",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "AntOS dark",
|
|
|
|
name: "antos_dark",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
wp: {
|
|
|
|
url: "os://resources/themes/system/wp/wp3.jpg",
|
|
|
|
size: "cover",
|
|
|
|
repeat: "repeat",
|
|
|
|
},
|
|
|
|
wps: [],
|
|
|
|
};
|
|
|
|
|
|
|
|
setting.VFS = {
|
|
|
|
mountpoints: [
|
2021-03-14 15:05:21 +01:00
|
|
|
//TODO: multi app try to write to this object, it need to be cloned
|
2020-05-29 22:22:00 +02:00
|
|
|
{
|
|
|
|
text: "__(Applications)",
|
|
|
|
path: "app://",
|
|
|
|
iconclass: "fa fa-adn",
|
|
|
|
type: "app",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "__(Home)",
|
|
|
|
path: "home://",
|
|
|
|
iconclass: "fa fa-home",
|
|
|
|
type: "fs",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "__(Desktop)",
|
|
|
|
path: setting.desktop.path,
|
|
|
|
iconclass: "fa fa-desktop",
|
|
|
|
type: "fs",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "__(OS)",
|
|
|
|
path: "os://",
|
|
|
|
iconclass: "fa fa-inbox",
|
|
|
|
type: "fs",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "__(Google Drive)",
|
|
|
|
path: "gdv://",
|
|
|
|
iconclass: "fa fa-inbox",
|
|
|
|
type: "fs",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "__(Shared)",
|
|
|
|
path: "shared://",
|
|
|
|
iconclass: "fa fa-share-square",
|
|
|
|
type: "fs",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
OS.setting.system = {
|
|
|
|
error_report: "https://os.iohub.dev/report",
|
|
|
|
locale: "en_GB",
|
|
|
|
menu: [],
|
|
|
|
packages: {},
|
|
|
|
pkgpaths: {
|
|
|
|
user: "home://.packages",
|
|
|
|
system: "os://packages",
|
|
|
|
},
|
|
|
|
repositories: [],
|
|
|
|
startup: {
|
|
|
|
apps: [],
|
2020-06-18 17:09:00 +02:00
|
|
|
services: ["Syslog/PushNotification", "Syslog/Calendar"],
|
2021-03-15 19:20:42 +01:00
|
|
|
pinned: [],
|
2020-05-29 22:22:00 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-06-18 17:09:00 +02:00
|
|
|
* Apply the input parameter object to system settings.
|
|
|
|
* This object could be an object loaded from
|
|
|
|
* setting JSON file saved on the server.
|
2020-05-29 22:22:00 +02:00
|
|
|
*
|
|
|
|
* @export
|
|
|
|
* @param {*} conf
|
|
|
|
*/
|
|
|
|
export function systemSetting(conf: any) {
|
|
|
|
resetSetting();
|
|
|
|
if (conf.desktop) {
|
|
|
|
setting.desktop = conf.desktop;
|
|
|
|
}
|
|
|
|
if (conf.applications) {
|
|
|
|
setting.applications = conf.applications;
|
|
|
|
}
|
|
|
|
if (conf.appearance) {
|
|
|
|
setting.appearance = conf.appearance;
|
|
|
|
}
|
|
|
|
if (conf.user) {
|
|
|
|
setting.user = conf.user;
|
|
|
|
}
|
|
|
|
if (conf.VFS) {
|
|
|
|
setting.VFS = conf.VFS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (conf.system) {
|
|
|
|
setting.system = conf.system;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!setting.VFS.gdrive) {
|
|
|
|
setting.VFS.gdrive = {
|
|
|
|
CLIENT_ID: "",
|
|
|
|
API_KEY: "",
|
|
|
|
apilink: "https://apis.google.com/js/api.js",
|
|
|
|
DISCOVERY_DOCS: [
|
|
|
|
"https://www.googleapis.com/discovery/v1/apis/drive/v3/rest",
|
|
|
|
],
|
|
|
|
SCOPES: "https://www.googleapis.com/auth/drive",
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-18 17:09:00 +02:00
|
|
|
// Register handle for application search
|
2020-05-29 22:22:00 +02:00
|
|
|
API.onsearch("__(Applications)", function (t) {
|
|
|
|
const ar = [];
|
|
|
|
const term = new RegExp(t, "i");
|
|
|
|
for (let k in setting.system.packages) {
|
|
|
|
const v = setting.system.packages[k];
|
|
|
|
if (v.app) {
|
2021-03-15 19:20:42 +01:00
|
|
|
var e: any, k1: string, v1: { [x: string]: any; detail?: any; path?: any; complex?: any; };
|
2020-05-29 22:22:00 +02:00
|
|
|
if (
|
|
|
|
v.name.match(term) ||
|
|
|
|
(v.description && v.description.match(term))
|
|
|
|
) {
|
|
|
|
v1 = {};
|
|
|
|
for (k1 in v) {
|
|
|
|
e = v[k1];
|
|
|
|
if (k1 !== "selected") {
|
|
|
|
v1[k1] = e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
v1.detail = [{ text: v1.path }];
|
|
|
|
v1.complex = true;
|
|
|
|
ar.push(v1);
|
|
|
|
} else if (v.mimes) {
|
2020-06-03 23:43:08 +02:00
|
|
|
for (let m of v.mimes) {
|
2020-05-29 22:22:00 +02:00
|
|
|
if (t.match(new RegExp(m, "g"))) {
|
|
|
|
v1 = {};
|
|
|
|
for (k1 in v) {
|
|
|
|
e = v[k1];
|
|
|
|
if (k1 !== "selected") {
|
|
|
|
v1[k1] = v[k1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
v1.detail = [{ text: v1.path }];
|
|
|
|
v1.complex = true;
|
|
|
|
ar.push(v1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ar;
|
|
|
|
});
|
|
|
|
}
|