diff --git a/electron-builder.yml b/electron-builder.yml index 70fff9ca..976f61e3 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -17,8 +17,6 @@ mac: extraFiles: - from: ./extra/darwin/Core/Library/ to: ./Core/Library/ - - from: ./extra/darwin/Core/config/ - to: ./Core/config/ - from: ./extra/darwin/Core/initFiles/ to: ./Core/initFiles/ - from: ./extra/darwin/Core/script/ @@ -39,8 +37,6 @@ win: - x64 requestedExecutionLevel: requireAdministrator extraFiles: - - from: ./extra/win32/core/config/ - to: ./core/config/ - from: ./extra/win32/core/initFiles/ to: ./core/initFiles/ - from: ./extra/win32/core/script/ diff --git a/extra/darwin/Core/config/software/icon/Composer.png b/extra/darwin/Core/initFiles/config/software/icon/Composer.png similarity index 100% rename from extra/darwin/Core/config/software/icon/Composer.png rename to extra/darwin/Core/initFiles/config/software/icon/Composer.png diff --git a/extra/darwin/Core/config/software/icon/Notepad--.png b/extra/darwin/Core/initFiles/config/software/icon/Notepad--.png similarity index 100% rename from extra/darwin/Core/config/software/icon/Notepad--.png rename to extra/darwin/Core/initFiles/config/software/icon/Notepad--.png diff --git a/extra/darwin/Core/config/software/icon/NotepadNext.svg b/extra/darwin/Core/initFiles/config/software/icon/NotepadNext.svg similarity index 98% rename from extra/darwin/Core/config/software/icon/NotepadNext.svg rename to extra/darwin/Core/initFiles/config/software/icon/NotepadNext.svg index 2714847e..e340b922 100644 --- a/extra/darwin/Core/config/software/icon/NotepadNext.svg +++ b/extra/darwin/Core/initFiles/config/software/icon/NotepadNext.svg @@ -1,332 +1,332 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/extra/darwin/Core/config/software/icon/apache.png b/extra/darwin/Core/initFiles/config/software/icon/apache.png similarity index 100% rename from extra/darwin/Core/config/software/icon/apache.png rename to extra/darwin/Core/initFiles/config/software/icon/apache.png diff --git a/extra/darwin/Core/config/software/icon/mariadb.png b/extra/darwin/Core/initFiles/config/software/icon/mariadb.png similarity index 100% rename from extra/darwin/Core/config/software/icon/mariadb.png rename to extra/darwin/Core/initFiles/config/software/icon/mariadb.png diff --git a/extra/darwin/Core/config/software/icon/memcached.png b/extra/darwin/Core/initFiles/config/software/icon/memcached.png similarity index 100% rename from extra/darwin/Core/config/software/icon/memcached.png rename to extra/darwin/Core/initFiles/config/software/icon/memcached.png diff --git a/extra/darwin/Core/config/software/icon/mysql.png b/extra/darwin/Core/initFiles/config/software/icon/mysql.png similarity index 100% rename from extra/darwin/Core/config/software/icon/mysql.png rename to extra/darwin/Core/initFiles/config/software/icon/mysql.png diff --git a/extra/darwin/Core/config/software/icon/nginx.png b/extra/darwin/Core/initFiles/config/software/icon/nginx.png similarity index 100% rename from extra/darwin/Core/config/software/icon/nginx.png rename to extra/darwin/Core/initFiles/config/software/icon/nginx.png diff --git a/extra/darwin/Core/config/software/icon/php.png b/extra/darwin/Core/initFiles/config/software/icon/php.png similarity index 100% rename from extra/darwin/Core/config/software/icon/php.png rename to extra/darwin/Core/initFiles/config/software/icon/php.png diff --git a/extra/darwin/Core/config/software/icon/phpmyadmin.png b/extra/darwin/Core/initFiles/config/software/icon/phpmyadmin.png similarity index 100% rename from extra/darwin/Core/config/software/icon/phpmyadmin.png rename to extra/darwin/Core/initFiles/config/software/icon/phpmyadmin.png diff --git a/extra/darwin/Core/config/software/icon/redis.png b/extra/darwin/Core/initFiles/config/software/icon/redis.png similarity index 100% rename from extra/darwin/Core/config/software/icon/redis.png rename to extra/darwin/Core/initFiles/config/software/icon/redis.png diff --git a/extra/darwin/Core/config/software/icon/wwwstop.png b/extra/darwin/Core/initFiles/config/software/icon/wwwstop.png similarity index 100% rename from extra/darwin/Core/config/software/icon/wwwstop.png rename to extra/darwin/Core/initFiles/config/software/icon/wwwstop.png diff --git a/extra/darwin/Core/config/software/software.json b/extra/darwin/Core/initFiles/config/software/software.json similarity index 97% rename from extra/darwin/Core/config/software/software.json rename to extra/darwin/Core/initFiles/config/software/software.json index 2da15e3c..1df1cad4 100644 --- a/extra/darwin/Core/config/software/software.json +++ b/extra/darwin/Core/initFiles/config/software/software.json @@ -1,233 +1,233 @@ -[ - { - "Name": "Nginx", - "DirName": "nginx", - "ServerProcessPath": "sbin/nginx", - "ServerConfPath": "conf/nginx.conf", - "StartServerArgs": ["-p","${WorkPath}","-g","daemon off;"], - "ServerPort": 80, - "ExtraFiles": [ - {"Name": "access.log", "Path": "logs/access.log"}, - {"Name": "error.log", "Path": "logs/error.log"} - ], - "Type": "Server", - "RemoteArchiveExt": ".tar.xz", - "CanDelete": false, - "Icon": "nginx.png", - "Desc": "Web服务器" - }, - { - "Name": "PHP-5.6", - "ServerName": "PHP-FPM-5.6", - "DirName": "php-5.6", - "ConfPath": "etc/php.ini", - "ServerProcessPath": "sbin/php-fpm", - "ServerConfPath": "etc/php-fpm.conf", - "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], - "Type": "PHP", - "RemoteArchiveExt": ".tar.xz", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-7.0", - "ServerName": "PHP-FPM-7.0", - "DirName": "php-7.0", - "ConfPath": "etc/php.ini", - "ServerProcessPath": "sbin/php-fpm", - "ServerConfPath": "etc/php-fpm.conf", - "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], - "Type": "PHP", - "RemoteArchiveExt": ".tar.xz", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-7.1", - "ServerName": "PHP-FPM-7.1", - "DirName": "php-7.1", - "ConfPath": "etc/php.ini", - "ServerProcessPath": "sbin/php-fpm", - "ServerConfPath": "etc/php-fpm.conf", - "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], - "Type": "PHP", - "RemoteArchiveExt": ".tar.xz", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-7.2", - "ServerName": "PHP-FPM-7.2", - "DirName": "php-7.2", - "ConfPath": "etc/php.ini", - "ServerProcessPath": "sbin/php-fpm", - "ServerConfPath": "etc/php-fpm.conf", - "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], - "Type": "PHP", - "RemoteArchiveExt": ".tar.xz", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-7.3", - "ServerName": "PHP-FPM-7.3", - "DirName": "php-7.3", - "ConfPath": "etc/php.ini", - "ServerProcessPath": "sbin/php-fpm", - "ServerConfPath": "etc/php-fpm.conf", - "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], - "Type": "PHP", - "RemoteArchiveExt": ".tar.xz", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-7.4", - "ServerName": "PHP-FPM-7.4", - "DirName": "php-7.4", - "ConfPath": "etc/php.ini", - "ServerProcessPath": "sbin/php-fpm", - "ServerConfPath": "etc/php-fpm.conf", - "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], - "Type": "PHP", - "RemoteArchiveExt": ".tar.xz", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-8.0", - "ServerName": "PHP-FPM-8.0", - "DirName": "php-8.0", - "ConfPath": "etc/php.ini", - "ServerProcessPath": "sbin/php-fpm", - "ServerConfPath": "etc/php-fpm.conf", - "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], - "Type": "PHP", - "RemoteArchiveExt": ".tar.xz", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-8.1", - "ServerName": "PHP-FPM-8.1", - "DirName": "php-8.1", - "ConfPath": "etc/php.ini", - "ServerProcessPath": "sbin/php-fpm", - "ServerConfPath": "etc/php-fpm.conf", - "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], - "Type": "PHP", - "RemoteArchiveExt": ".tar.xz", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-8.2", - "ServerName": "PHP-FPM-8.2", - "DirName": "php-8.2", - "ConfPath": "etc/php.ini", - "ServerProcessPath": "sbin/php-fpm", - "ServerConfPath": "etc/php-fpm.conf", - "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], - "Type": "PHP", - "RemoteArchiveExt": ".tar.xz", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-8.3", - "ServerName": "PHP-FPM-8.3", - "DirName": "php-8.3", - "ConfPath": "etc/php.ini", - "ServerProcessPath": "sbin/php-fpm", - "ServerConfPath": "etc/php-fpm.conf", - "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], - "Type": "PHP", - "RemoteArchiveExt": ".tar.xz", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "MySQL-5.7", - "DirName": "mysql-5.7", - "Type": "Server", - "ServerProcessPath": "bin/mysqld", - "ServerConfPath": "my.cnf", - "StartServerArgs": ["--defaults-file=${ServerConfPath}"], - "ServerPort": 3306, - "ExtraFiles": [ - {"Name": "mysql.log", "Path": "logs/mysql.log"} - ], - "RemoteArchiveExt": ".tar.xz", - "CanDelete": true, - "Icon": "mysql.png", - "Desc": "MySQL是一种关系数据库" - }, - { - "Name": "MySQL-8.0", - "DirName": "mysql-8.0", - "Type": "Server", - "ServerProcessPath": "bin/mysqld", - "ServerConfPath": "my.cnf", - "StartServerArgs": ["--defaults-file=${ServerConfPath}"], - "ServerPort": 3306, - "ExtraFiles": [ - {"Name": "mysql.log", "Path": "logs/mysql.log"} - ], - "RemoteArchiveExt": ".tar.xz", - "CanDelete": true, - "Icon": "mysql.png", - "Desc": "MySQL是一种关系数据库" - }, - { - "Name": "Redis-7.2", - "DirName": "redis-7.2", - "ServerProcessPath": "bin/redis-server", - "ServerConfPath": "redis.conf", - "StartServerArgs": ["${ServerConfPath}"], - "ServerPort": 6379, - "Type": "Server", - "RemoteArchiveExt": ".tar.xz", - "CanDelete": true, - "Icon": "redis.png", - "Desc": "一款高性能的Key-Value数据库" - }, - { - "Name": "Composer", - "DirName": "Composer", - "Type": "Tool", - "RemoteIsCommonPlatform": true, - "CanDelete": true, - "Icon": "Composer.png", - "Desc": "PHP依赖管理工具(需要在设置里启用)" - }, - { - "Name": "Notepad--", - "DirName": "Notepad--.app", - "Type": "Tool", - "IsMacApp": true, - "RemoteArchiveExt": ".tar.xz", - "CanDelete": true, - "Icon": "Notepad--.png", - "Desc": "国产跨平台文本、代码编辑器" - }, - { - "Name": "phpMyAdmin", - "DirName": "phpMyAdmin", - "Type": "Tool", - "RemoteIsCommonPlatform": true, - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "phpmyadmin.png", - "Desc": "Web端的MySQL管理工具" - } -] +[ + { + "Name": "Nginx", + "DirName": "nginx", + "ServerProcessPath": "sbin/nginx", + "ServerConfPath": "conf/nginx.conf", + "StartServerArgs": ["-p","${WorkPath}","-g","daemon off;"], + "ServerPort": 80, + "ExtraFiles": [ + {"Name": "access.log", "Path": "logs/access.log"}, + {"Name": "error.log", "Path": "logs/error.log"} + ], + "Type": "Server", + "RemoteArchiveExt": ".tar.xz", + "CanDelete": false, + "Icon": "nginx.png", + "Desc": "Web服务器" + }, + { + "Name": "PHP-5.6", + "ServerName": "PHP-FPM-5.6", + "DirName": "php-5.6", + "ConfPath": "etc/php.ini", + "ServerProcessPath": "sbin/php-fpm", + "ServerConfPath": "etc/php-fpm.conf", + "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], + "Type": "PHP", + "RemoteArchiveExt": ".tar.xz", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-7.0", + "ServerName": "PHP-FPM-7.0", + "DirName": "php-7.0", + "ConfPath": "etc/php.ini", + "ServerProcessPath": "sbin/php-fpm", + "ServerConfPath": "etc/php-fpm.conf", + "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], + "Type": "PHP", + "RemoteArchiveExt": ".tar.xz", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-7.1", + "ServerName": "PHP-FPM-7.1", + "DirName": "php-7.1", + "ConfPath": "etc/php.ini", + "ServerProcessPath": "sbin/php-fpm", + "ServerConfPath": "etc/php-fpm.conf", + "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], + "Type": "PHP", + "RemoteArchiveExt": ".tar.xz", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-7.2", + "ServerName": "PHP-FPM-7.2", + "DirName": "php-7.2", + "ConfPath": "etc/php.ini", + "ServerProcessPath": "sbin/php-fpm", + "ServerConfPath": "etc/php-fpm.conf", + "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], + "Type": "PHP", + "RemoteArchiveExt": ".tar.xz", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-7.3", + "ServerName": "PHP-FPM-7.3", + "DirName": "php-7.3", + "ConfPath": "etc/php.ini", + "ServerProcessPath": "sbin/php-fpm", + "ServerConfPath": "etc/php-fpm.conf", + "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], + "Type": "PHP", + "RemoteArchiveExt": ".tar.xz", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-7.4", + "ServerName": "PHP-FPM-7.4", + "DirName": "php-7.4", + "ConfPath": "etc/php.ini", + "ServerProcessPath": "sbin/php-fpm", + "ServerConfPath": "etc/php-fpm.conf", + "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], + "Type": "PHP", + "RemoteArchiveExt": ".tar.xz", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-8.0", + "ServerName": "PHP-FPM-8.0", + "DirName": "php-8.0", + "ConfPath": "etc/php.ini", + "ServerProcessPath": "sbin/php-fpm", + "ServerConfPath": "etc/php-fpm.conf", + "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], + "Type": "PHP", + "RemoteArchiveExt": ".tar.xz", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-8.1", + "ServerName": "PHP-FPM-8.1", + "DirName": "php-8.1", + "ConfPath": "etc/php.ini", + "ServerProcessPath": "sbin/php-fpm", + "ServerConfPath": "etc/php-fpm.conf", + "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], + "Type": "PHP", + "RemoteArchiveExt": ".tar.xz", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-8.2", + "ServerName": "PHP-FPM-8.2", + "DirName": "php-8.2", + "ConfPath": "etc/php.ini", + "ServerProcessPath": "sbin/php-fpm", + "ServerConfPath": "etc/php-fpm.conf", + "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], + "Type": "PHP", + "RemoteArchiveExt": ".tar.xz", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-8.3", + "ServerName": "PHP-FPM-8.3", + "DirName": "php-8.3", + "ConfPath": "etc/php.ini", + "ServerProcessPath": "sbin/php-fpm", + "ServerConfPath": "etc/php-fpm.conf", + "StartServerArgs": ["-c","${ConfPath}","-y","${ServerConfPath}","-F"], + "Type": "PHP", + "RemoteArchiveExt": ".tar.xz", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "MySQL-5.7", + "DirName": "mysql-5.7", + "Type": "Server", + "ServerProcessPath": "bin/mysqld", + "ServerConfPath": "my.cnf", + "StartServerArgs": ["--defaults-file=${ServerConfPath}"], + "ServerPort": 3306, + "ExtraFiles": [ + {"Name": "mysql.log", "Path": "logs/mysql.log"} + ], + "RemoteArchiveExt": ".tar.xz", + "CanDelete": true, + "Icon": "mysql.png", + "Desc": "MySQL是一种关系数据库" + }, + { + "Name": "MySQL-8.0", + "DirName": "mysql-8.0", + "Type": "Server", + "ServerProcessPath": "bin/mysqld", + "ServerConfPath": "my.cnf", + "StartServerArgs": ["--defaults-file=${ServerConfPath}"], + "ServerPort": 3306, + "ExtraFiles": [ + {"Name": "mysql.log", "Path": "logs/mysql.log"} + ], + "RemoteArchiveExt": ".tar.xz", + "CanDelete": true, + "Icon": "mysql.png", + "Desc": "MySQL是一种关系数据库" + }, + { + "Name": "Redis-7.2", + "DirName": "redis-7.2", + "ServerProcessPath": "bin/redis-server", + "ServerConfPath": "redis.conf", + "StartServerArgs": ["${ServerConfPath}"], + "ServerPort": 6379, + "Type": "Server", + "RemoteArchiveExt": ".tar.xz", + "CanDelete": true, + "Icon": "redis.png", + "Desc": "一款高性能的Key-Value数据库" + }, + { + "Name": "Composer", + "DirName": "Composer", + "Type": "Tool", + "RemoteIsCommonPlatform": true, + "CanDelete": true, + "Icon": "Composer.png", + "Desc": "PHP依赖管理工具(需要在设置里启用)" + }, + { + "Name": "Notepad--", + "DirName": "Notepad--.app", + "Type": "Tool", + "IsMacApp": true, + "RemoteArchiveExt": ".tar.xz", + "CanDelete": true, + "Icon": "Notepad--.png", + "Desc": "国产跨平台文本、代码编辑器" + }, + { + "Name": "phpMyAdmin", + "DirName": "phpMyAdmin", + "Type": "Tool", + "RemoteIsCommonPlatform": true, + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "phpmyadmin.png", + "Desc": "Web端的MySQL管理工具" + } +] diff --git a/extra/win32/core/config/software/icon/Composer.png b/extra/win32/core/initFiles/config/software/icon/Composer.png similarity index 100% rename from extra/win32/core/config/software/icon/Composer.png rename to extra/win32/core/initFiles/config/software/icon/Composer.png diff --git a/extra/win32/core/config/software/icon/Notepad3.ico b/extra/win32/core/initFiles/config/software/icon/Notepad3.ico similarity index 100% rename from extra/win32/core/config/software/icon/Notepad3.ico rename to extra/win32/core/initFiles/config/software/icon/Notepad3.ico diff --git a/extra/win32/core/config/software/icon/NotepadNext.svg b/extra/win32/core/initFiles/config/software/icon/NotepadNext.svg similarity index 98% rename from extra/win32/core/config/software/icon/NotepadNext.svg rename to extra/win32/core/initFiles/config/software/icon/NotepadNext.svg index 2714847e..e340b922 100644 --- a/extra/win32/core/config/software/icon/NotepadNext.svg +++ b/extra/win32/core/initFiles/config/software/icon/NotepadNext.svg @@ -1,332 +1,332 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/extra/win32/core/config/software/icon/apache.png b/extra/win32/core/initFiles/config/software/icon/apache.png similarity index 100% rename from extra/win32/core/config/software/icon/apache.png rename to extra/win32/core/initFiles/config/software/icon/apache.png diff --git a/extra/win32/core/config/software/icon/mariadb.png b/extra/win32/core/initFiles/config/software/icon/mariadb.png similarity index 100% rename from extra/win32/core/config/software/icon/mariadb.png rename to extra/win32/core/initFiles/config/software/icon/mariadb.png diff --git a/extra/win32/core/config/software/icon/memcached.png b/extra/win32/core/initFiles/config/software/icon/memcached.png similarity index 100% rename from extra/win32/core/config/software/icon/memcached.png rename to extra/win32/core/initFiles/config/software/icon/memcached.png diff --git a/extra/win32/core/config/software/icon/mysql.png b/extra/win32/core/initFiles/config/software/icon/mysql.png similarity index 100% rename from extra/win32/core/config/software/icon/mysql.png rename to extra/win32/core/initFiles/config/software/icon/mysql.png diff --git a/extra/win32/core/config/software/icon/nginx.png b/extra/win32/core/initFiles/config/software/icon/nginx.png similarity index 100% rename from extra/win32/core/config/software/icon/nginx.png rename to extra/win32/core/initFiles/config/software/icon/nginx.png diff --git a/extra/win32/core/config/software/icon/php.png b/extra/win32/core/initFiles/config/software/icon/php.png similarity index 100% rename from extra/win32/core/config/software/icon/php.png rename to extra/win32/core/initFiles/config/software/icon/php.png diff --git a/extra/win32/core/config/software/icon/phpmyadmin.png b/extra/win32/core/initFiles/config/software/icon/phpmyadmin.png similarity index 100% rename from extra/win32/core/config/software/icon/phpmyadmin.png rename to extra/win32/core/initFiles/config/software/icon/phpmyadmin.png diff --git a/extra/win32/core/config/software/icon/redis.png b/extra/win32/core/initFiles/config/software/icon/redis.png similarity index 100% rename from extra/win32/core/config/software/icon/redis.png rename to extra/win32/core/initFiles/config/software/icon/redis.png diff --git a/extra/win32/core/config/software/icon/wwwstop.png b/extra/win32/core/initFiles/config/software/icon/wwwstop.png similarity index 100% rename from extra/win32/core/config/software/icon/wwwstop.png rename to extra/win32/core/initFiles/config/software/icon/wwwstop.png diff --git a/extra/win32/core/config/software/software.json b/extra/win32/core/initFiles/config/software/software.json similarity index 97% rename from extra/win32/core/config/software/software.json rename to extra/win32/core/initFiles/config/software/software.json index 58b12a35..69266c7d 100644 --- a/extra/win32/core/config/software/software.json +++ b/extra/win32/core/initFiles/config/software/software.json @@ -1,259 +1,259 @@ -[ - { - "Name": "Nginx", - "DirName": "nginx", - "ServerProcessPath": "nginx.exe", - "ServerConfPath": "conf/nginx.conf", - "StartServerArgs": ["-p","${WorkPath}"], - "ServerPort": 80, - "ExtraFiles": [ - {"Name": "access.log", "Path": "logs/access.log"}, - {"Name": "error.log", "Path": "logs/error.log"} - ], - "Type": "Server", - "RemoteArchiveExt": ".7z", - "CanDelete": false, - "Icon": "nginx.png", - "Desc": "Web服务器" - }, - { - "Name": "PHP-5.6", - "ServerName": "PHP-FPM-5.6", - "DirName": "php-5.6", - "ConfPath": "php.ini", - "ServerProcessPath": "php-cgi-spawner.exe", - "ExtraProcessPath": "php-cgi.exe", - "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9005","4"], - "ServerPort": 9005, - "Type": "PHP", - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-7.0", - "ServerName": "PHP-FPM-7.0", - "DirName": "php-7.0", - "ConfPath": "php.ini", - "ServerProcessPath": "php-cgi-spawner.exe", - "ExtraProcessPath": "php-cgi.exe", - "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9006","4"], - "ServerPort": 9006, - "Type": "PHP", - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-7.1", - "ServerName": "PHP-FPM-7.1", - "DirName": "php-7.1", - "ConfPath": "php.ini", - "ServerProcessPath": "php-cgi-spawner.exe", - "ExtraProcessPath": "php-cgi.exe", - "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9007","4"], - "ServerPort": 9007, - "Type": "PHP", - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-7.2", - "ServerName": "PHP-FPM-7.2", - "DirName": "php-7.2", - "ConfPath": "php.ini", - "ServerProcessPath": "php-cgi-spawner.exe", - "ExtraProcessPath": "php-cgi.exe", - "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9008","4"], - "ServerPort": 9008, - "Type": "PHP", - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-7.3", - "ServerName": "PHP-FPM-7.3", - "DirName": "php-7.3", - "ConfPath": "php.ini", - "ServerProcessPath": "php-cgi-spawner.exe", - "ExtraProcessPath": "php-cgi.exe", - "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9009","4"], - "ServerPort": 9009, - "Type": "PHP", - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-7.4", - "ServerName": "PHP-FPM-7.4", - "DirName": "php-7.4", - "ConfPath": "php.ini", - "ServerProcessPath": "php-cgi-spawner.exe", - "ExtraProcessPath": "php-cgi.exe", - "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9010","4"], - "ServerPort": 9010, - "Type": "PHP", - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-8.0", - "ServerName": "PHP-FPM-8.0", - "DirName": "php-8.0", - "ConfPath": "php.ini", - "ServerProcessPath": "php-cgi-spawner.exe", - "ExtraProcessPath": "php-cgi.exe", - "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9011","4"], - "ServerPort": 9011, - "Type": "PHP", - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-8.1", - "ServerName": "PHP-FPM-8.1", - "DirName": "php-8.1", - "ConfPath": "php.ini", - "ServerProcessPath": "php-cgi-spawner.exe", - "ExtraProcessPath": "php-cgi.exe", - "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9012","4"], - "ServerPort": 9012, - "Type": "PHP", - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-8.2", - "ServerName": "PHP-FPM-8.2", - "DirName": "php-8.2", - "ConfPath": "php.ini", - "ServerProcessPath": "php-cgi-spawner.exe", - "ExtraProcessPath": "php-cgi.exe", - "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9013","4"], - "ServerPort": 9013, - "Type": "PHP", - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "PHP-8.3", - "ServerName": "PHP-FPM-8.3", - "DirName": "php-8.3", - "ConfPath": "php.ini", - "ServerProcessPath": "php-cgi-spawner.exe", - "ExtraProcessPath": "php-cgi.exe", - "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9014","4"], - "ServerPort": 9014, - "Type": "PHP", - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "php.png", - "Desc": "PHP是世界上最好的编程语言" - }, - { - "Name": "MySQL-5.7", - "DirName": "mysql-5.7", - "Type": "Server", - "ServerProcessPath": "bin/mysqld.exe", - "ServerConfPath": "my.ini", - "StartServerArgs": ["--defaults-file=${ServerConfPath}"], - "ServerPort": 3306, - "ExtraFiles": [ - {"Name": "mysql.log", "Path": "logs/mysql.log"} - ], - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "mysql.png", - "Desc": "MySQL是一种关系数据库" - }, - { - "Name": "MySQL-8.0", - "DirName": "mysql-8.0", - "Type": "Server", - "ServerProcessPath": "bin/mysqld.exe", - "ServerConfPath": "my.ini", - "StartServerArgs": ["--defaults-file=${ServerConfPath}"], - "ServerPort": 3306, - "ExtraFiles": [ - {"Name": "mysql.log", "Path": "logs/mysql.log"} - ], - "ShellServerProcess": true, - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "mysql.png", - "Desc": "MySQL是一种关系数据库" - }, - { - "Name": "Redis-3.2", - "DirName": "redis-3.2", - "ServerProcessPath": "redis-server.exe", - "ServerConfPath": "redis.windows.conf", - "StartServerArgs": ["${ServerConfPath}"], - "ServerPort": 6379, - "Type": "Server", - "ShellServerProcess": true, - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "redis.png", - "Desc": "一款高性能的Key-Value数据库" - }, - { - "Name": "Redis-5.0", - "DirName": "redis-5.0", - "ServerProcessPath": "redis-server.exe", - "ServerConfPath": "redis.windows.conf", - "StartServerArgs": ["${ServerConfPath}"], - "ServerPort": 6379, - "Type": "Server", - "ShellServerProcess": true, - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "redis.png", - "Desc": "一款高性能的Key-Value数据库" - }, - { - "Name": "Composer", - "DirName": "Composer", - "Type": "Tool", - "RemoteIsCommonPlatform": true, - "CanDelete": true, - "Icon": "Composer.png", - "Desc": "PHP依赖管理工具(需要在设置里启用)" - }, - { - "Name": "Notepad3", - "DirName": "Notepad3", - "Type": "Tool", - "WinExePath": "Notepad3.exe", - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "Notepad3.ico", - "Desc": "文本、代码编辑器" - }, - { - "Name": "phpMyAdmin", - "DirName": "phpMyAdmin", - "Type": "Tool", - "RemoteIsCommonPlatform": true, - "RemoteArchiveExt": ".7z", - "CanDelete": true, - "Icon": "phpmyadmin.png", - "Desc": "Web端的MySQL管理工具" - } -] +[ + { + "Name": "Nginx", + "DirName": "nginx", + "ServerProcessPath": "nginx.exe", + "ServerConfPath": "conf/nginx.conf", + "StartServerArgs": ["-p","${WorkPath}"], + "ServerPort": 80, + "ExtraFiles": [ + {"Name": "access.log", "Path": "logs/access.log"}, + {"Name": "error.log", "Path": "logs/error.log"} + ], + "Type": "Server", + "RemoteArchiveExt": ".7z", + "CanDelete": false, + "Icon": "nginx.png", + "Desc": "Web服务器" + }, + { + "Name": "PHP-5.6", + "ServerName": "PHP-FPM-5.6", + "DirName": "php-5.6", + "ConfPath": "php.ini", + "ServerProcessPath": "php-cgi-spawner.exe", + "ExtraProcessPath": "php-cgi.exe", + "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9005","4"], + "ServerPort": 9005, + "Type": "PHP", + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-7.0", + "ServerName": "PHP-FPM-7.0", + "DirName": "php-7.0", + "ConfPath": "php.ini", + "ServerProcessPath": "php-cgi-spawner.exe", + "ExtraProcessPath": "php-cgi.exe", + "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9006","4"], + "ServerPort": 9006, + "Type": "PHP", + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-7.1", + "ServerName": "PHP-FPM-7.1", + "DirName": "php-7.1", + "ConfPath": "php.ini", + "ServerProcessPath": "php-cgi-spawner.exe", + "ExtraProcessPath": "php-cgi.exe", + "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9007","4"], + "ServerPort": 9007, + "Type": "PHP", + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-7.2", + "ServerName": "PHP-FPM-7.2", + "DirName": "php-7.2", + "ConfPath": "php.ini", + "ServerProcessPath": "php-cgi-spawner.exe", + "ExtraProcessPath": "php-cgi.exe", + "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9008","4"], + "ServerPort": 9008, + "Type": "PHP", + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-7.3", + "ServerName": "PHP-FPM-7.3", + "DirName": "php-7.3", + "ConfPath": "php.ini", + "ServerProcessPath": "php-cgi-spawner.exe", + "ExtraProcessPath": "php-cgi.exe", + "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9009","4"], + "ServerPort": 9009, + "Type": "PHP", + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-7.4", + "ServerName": "PHP-FPM-7.4", + "DirName": "php-7.4", + "ConfPath": "php.ini", + "ServerProcessPath": "php-cgi-spawner.exe", + "ExtraProcessPath": "php-cgi.exe", + "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9010","4"], + "ServerPort": 9010, + "Type": "PHP", + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-8.0", + "ServerName": "PHP-FPM-8.0", + "DirName": "php-8.0", + "ConfPath": "php.ini", + "ServerProcessPath": "php-cgi-spawner.exe", + "ExtraProcessPath": "php-cgi.exe", + "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9011","4"], + "ServerPort": 9011, + "Type": "PHP", + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-8.1", + "ServerName": "PHP-FPM-8.1", + "DirName": "php-8.1", + "ConfPath": "php.ini", + "ServerProcessPath": "php-cgi-spawner.exe", + "ExtraProcessPath": "php-cgi.exe", + "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9012","4"], + "ServerPort": 9012, + "Type": "PHP", + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-8.2", + "ServerName": "PHP-FPM-8.2", + "DirName": "php-8.2", + "ConfPath": "php.ini", + "ServerProcessPath": "php-cgi-spawner.exe", + "ExtraProcessPath": "php-cgi.exe", + "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9013","4"], + "ServerPort": 9013, + "Type": "PHP", + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "PHP-8.3", + "ServerName": "PHP-FPM-8.3", + "DirName": "php-8.3", + "ConfPath": "php.ini", + "ServerProcessPath": "php-cgi-spawner.exe", + "ExtraProcessPath": "php-cgi.exe", + "StartServerArgs": ["${ExtraProcessPath} -c ${ConfPath}","9014","4"], + "ServerPort": 9014, + "Type": "PHP", + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "php.png", + "Desc": "PHP是世界上最好的编程语言" + }, + { + "Name": "MySQL-5.7", + "DirName": "mysql-5.7", + "Type": "Server", + "ServerProcessPath": "bin/mysqld.exe", + "ServerConfPath": "my.ini", + "StartServerArgs": ["--defaults-file=${ServerConfPath}"], + "ServerPort": 3306, + "ExtraFiles": [ + {"Name": "mysql.log", "Path": "logs/mysql.log"} + ], + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "mysql.png", + "Desc": "MySQL是一种关系数据库" + }, + { + "Name": "MySQL-8.0", + "DirName": "mysql-8.0", + "Type": "Server", + "ServerProcessPath": "bin/mysqld.exe", + "ServerConfPath": "my.ini", + "StartServerArgs": ["--defaults-file=${ServerConfPath}"], + "ServerPort": 3306, + "ExtraFiles": [ + {"Name": "mysql.log", "Path": "logs/mysql.log"} + ], + "ShellServerProcess": true, + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "mysql.png", + "Desc": "MySQL是一种关系数据库" + }, + { + "Name": "Redis-3.2", + "DirName": "redis-3.2", + "ServerProcessPath": "redis-server.exe", + "ServerConfPath": "redis.windows.conf", + "StartServerArgs": ["${ServerConfPath}"], + "ServerPort": 6379, + "Type": "Server", + "ShellServerProcess": true, + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "redis.png", + "Desc": "一款高性能的Key-Value数据库" + }, + { + "Name": "Redis-5.0", + "DirName": "redis-5.0", + "ServerProcessPath": "redis-server.exe", + "ServerConfPath": "redis.windows.conf", + "StartServerArgs": ["${ServerConfPath}"], + "ServerPort": 6379, + "Type": "Server", + "ShellServerProcess": true, + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "redis.png", + "Desc": "一款高性能的Key-Value数据库" + }, + { + "Name": "Composer", + "DirName": "Composer", + "Type": "Tool", + "RemoteIsCommonPlatform": true, + "CanDelete": true, + "Icon": "Composer.png", + "Desc": "PHP依赖管理工具(需要在设置里启用)" + }, + { + "Name": "Notepad3", + "DirName": "Notepad3", + "Type": "Tool", + "WinExePath": "Notepad3.exe", + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "Notepad3.ico", + "Desc": "文本、代码编辑器" + }, + { + "Name": "phpMyAdmin", + "DirName": "phpMyAdmin", + "Type": "Tool", + "RemoteIsCommonPlatform": true, + "RemoteArchiveExt": ".7z", + "CanDelete": true, + "Icon": "phpmyadmin.png", + "Desc": "Web端的MySQL管理工具" + } +] diff --git a/package.json b/package.json index 1ca046b0..a4cccf18 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "eserver", "productName": "EServer", - "version": "3.6.0", + "version": "3.7.0", "description": "EServer", "main": "./out/main/index.js", "author": "xianyunleo", diff --git a/src/main/App.js b/src/main/App.js index 98e5ae87..3f0c4f68 100644 --- a/src/main/App.js +++ b/src/main/App.js @@ -10,7 +10,7 @@ import GetPath from '@/shared/utils/GetPath' import LocalInstall from '@/main/core/software/LocalInstall' import FsUtil from '@/main/utils/FsUtil' import GetAppPath from '@/main/utils/GetAppPath' -import Command from '@/main/utils/Command' +import Shell from '@/main/utils/Shell' import { extractZip } from '@/main/utils/extract' const app = electronRequire('app') @@ -40,7 +40,7 @@ export default class App { await this.updateMacCoreSubDir(['Library']) } - await this.moveInitFiles(['downloads', 'www']) + await this.moveInitFiles(['downloads', 'www', 'config']) await this.createCoreSubDir(['software', 'database', 'bin', `${TEMP_DIR_NAME}/php`]) if (!softwareDirExists) { //目录不存在说明是第一次安装,不是覆盖安装 @@ -116,7 +116,7 @@ export default class App { if (!await DirUtil.Exists(target)) { await DirUtil.Create(target) } - await Command.exec(`rsync -a ${source}/* ${target}`) + await Shell.exec(`rsync -a ${source}/* ${target}`) await DirUtil.Delete(source) } } diff --git a/src/main/core/Database.js b/src/main/core/Database.js index a5a9421d..36a78851 100644 --- a/src/main/core/Database.js +++ b/src/main/core/Database.js @@ -1,6 +1,6 @@ import path from "path"; import GetPath from "@/shared/utils/GetPath"; -import Command from "@/main/utils/Command"; +import Shell from "@/main/utils/Shell"; import ProcessExtend from "@/main/utils/ProcessExtend"; import {sleep} from "@/shared/utils/utils"; import child_process from "child_process"; @@ -17,7 +17,7 @@ export default class Database { static async initMySQLData(version) { let mysqlPath = GetPath.getMysqlDir(version); let command = `${this.getMySQLDFilePath(version)} --defaults-file=${this.getMySQLConfFilePath(version)} --initialize`; - await Command.exec(command, {cwd: mysqlPath}); + await Shell.exec(command, {cwd: mysqlPath}); } /** diff --git a/src/main/core/Env/EnvMacOS.js b/src/main/core/Env/EnvMacOS.js index 06642c11..1273ad0b 100644 --- a/src/main/core/Env/EnvMacOS.js +++ b/src/main/core/Env/EnvMacOS.js @@ -2,7 +2,7 @@ import {electronRequire} from '@/main/utils/electron'; import FileUtil from "@/main/utils/FileUtil"; import Path from "@/main/utils/Path"; import OS from "@/main/utils/OS"; -import Command from "@/main/utils/Command"; +import Shell from "@/main/utils/Shell"; import {APP_NAME} from "@/shared/utils/constant"; import GetPath from "@/shared/utils/GetPath"; import FsUtil from '@/main/utils/FsUtil' @@ -27,7 +27,7 @@ export default class EnvMacOS { if (!await FsUtil.CanReadWrite(envFilePath)) { //envFile正常是可以编辑的,考虑到own变成root的情况 - await Command.sudoExec(`chown ${userName}:staff ${envFilePath}`) + await Shell.sudoExec(`chown ${userName}:staff ${envFilePath}`) } text = await FileUtil.ReadAll(envFilePath); diff --git a/src/main/core/Env/EnvWindows.js b/src/main/core/Env/EnvWindows.js index bfdad9bd..d6c344f8 100644 --- a/src/main/core/Env/EnvWindows.js +++ b/src/main/core/Env/EnvWindows.js @@ -1,4 +1,4 @@ -import Command from "@/main/utils/Command"; +import Shell from "@/main/utils/Shell"; import GetPath from "@/shared/utils/GetPath"; import { PowerShell } from '@/main/utils/constant' @@ -28,7 +28,7 @@ export default class EnvWindows { */ static async getVarStr(varName) { const commandStr = `[Environment]::GetEnvironmentVariable('${varName}','User')` - return (await Command.exec(commandStr, { shell: PowerShell })).trim() + return (await Shell.exec(commandStr, { shell: PowerShell })).trim() } /** @@ -39,6 +39,6 @@ export default class EnvWindows { */ static async setVarStr(varName, varVal) { const commandStr = `[Environment]::SetEnvironmentVariable('${varName}','${varVal}','User')` - await Command.exec(commandStr, { shell: PowerShell }) + await Shell.exec(commandStr, { shell: PowerShell }) } } diff --git a/src/main/core/ServerControl.js b/src/main/core/ServerControl.js index 2a085059..406649a1 100644 --- a/src/main/core/ServerControl.js +++ b/src/main/core/ServerControl.js @@ -1,4 +1,4 @@ -import { isDev, isWindows } from '@/main/utils/utils' +import { devConsoleLog } from '@/main/utils/utils' import ProcessExtend from "@/main/utils/ProcessExtend"; import Software from "@/main/core/software/Software"; import { parseTemplateStrings} from "@/shared/utils/utils"; @@ -14,7 +14,7 @@ export default class ServerControl { */ static async start(item) { const workPath = Software.getPath(item) //服务目录 - const serverProcessPath = this.getControlProcessPath(item) + const ctrlProcessPath = this.getControlProcessPath(item) const options = { cwd: workPath, detached: true } if (item.ShellServerProcess) { @@ -22,8 +22,8 @@ export default class ServerControl { options.shell = true //使用shell,childProcess返回的pid是shell的pid } - if (!await FileUtil.Exists(serverProcessPath)) { - throw new Error(`${serverProcessPath} 文件不存在!`); + if (!await FileUtil.Exists(ctrlProcessPath)) { + throw new Error(`${ctrlProcessPath} 文件不存在!`); } let args = [] @@ -34,20 +34,20 @@ export default class ServerControl { item.isRunning = true item.errMsg = '' - const childProcess = child_process.spawn(serverProcessPath, args, options); + const childProcess = child_process.spawn(ctrlProcessPath, args, options); childProcess.stderr.on('data', (data) => { - console.log('stderr data',data?.toString()) - item.errMsg = data?.toString(); - }); + devConsoleLog('stderr data', data?.toString()) + item.errMsg = data?.toString() + }) childProcess.on('close', (code) => { - if (isDev) console.log(`${Path.GetBaseName(serverProcessPath)},exit code ${code}`); - item.isRunning = false; - }); + devConsoleLog(`${Path.GetBaseName(ctrlProcessPath)},exit code ${code}`) + item.isRunning = false + }) - if (isDev) console.log('ServerControl start command:', `${serverProcessPath} ${args.join(' ')}`); - if (isDev) console.log(`${Path.GetBaseName(serverProcessPath)},pid ${childProcess.pid}`); + devConsoleLog('ServerControl start command:', `${ctrlProcessPath} ${args.join(' ')}`) + devConsoleLog(`${Path.GetBaseName(ctrlProcessPath)},pid ${childProcess.pid}`) item.pid = childProcess.pid; } @@ -75,8 +75,8 @@ export default class ServerControl { options.detached = false options.shell = true //使用shell,childProcess返回的pid是shell的pid } - const serverProcessPath = this.getControlProcessPath(item) - child_process.spawn(serverProcessPath, args, options) + const ctrlProcessPath = this.getControlProcessPath(item) + child_process.spawn(ctrlProcessPath, args, options) } else { await ProcessExtend.kill(item.pid) } diff --git a/src/main/core/software/Software.js b/src/main/core/software/Software.js index 22b3ee1f..5ae89053 100644 --- a/src/main/core/software/Software.js +++ b/src/main/core/software/Software.js @@ -26,7 +26,7 @@ export default class Software { } static async initList() { - let corePath = GetAppPath.getCoreDir(); + let corePath = GetAppPath.getUserCoreDir(); let softPath = path.join(corePath, '/config/software'); let softConfigPath = path.join(softPath, 'software.json'); let softIconPath = 'file://' + path.join(softPath, '/icon'); diff --git a/src/main/utils/FsUtil.js b/src/main/utils/FsUtil.js index b5454433..3456395d 100644 --- a/src/main/utils/FsUtil.js +++ b/src/main/utils/FsUtil.js @@ -1,6 +1,6 @@ import fsPromises, { constants } from 'fs/promises' import { isWindows } from '@/main/utils/utils' -import Command from '@/main/utils/Command' +import Shell from '@/main/utils/Shell' export default class FsUtil { /** @@ -57,7 +57,7 @@ export default class FsUtil { if (isWindows) { await fsPromises.chmod(path, 0o666) } else { - await Command.sudoExec(`chmod 666 ${path}`) + await Shell.sudoExec(`chmod 666 ${path}`) } } } diff --git a/src/main/utils/Native.js b/src/main/utils/Native.js index 4d18d760..efc9f68c 100644 --- a/src/main/utils/Native.js +++ b/src/main/utils/Native.js @@ -1,5 +1,5 @@ import { electronRequire } from '@/main/utils/electron' -import Command from "@/main/utils/Command"; +import Shell from "@/main/utils/Shell"; import MessageBox from "@/renderer/utils/MessageBox"; import fixPath from "fix-path"; import GetPath from "@/shared/utils/GetPath"; @@ -20,7 +20,7 @@ export default class Native { if(isWindows){ Native.openExternal(path) }else if(isMacOS){ - await Command.exec(`open -a "${path}"`) + await Shell.exec(`open -a "${path}"`) }else { throw new Error(`todo`) } @@ -50,7 +50,7 @@ export default class Native { } else if (isWindows) { command = `"${editorPath}" "${filePath}"` } - await Command.exec(command) + await Shell.exec(command) } catch (error) { //todo渲染进程捕捉错误 diff --git a/src/main/utils/ProcessExtend.js b/src/main/utils/ProcessExtend.js index 9c4c0066..b9e16d6f 100644 --- a/src/main/utils/ProcessExtend.js +++ b/src/main/utils/ProcessExtend.js @@ -1,4 +1,4 @@ -import Command from '@/main/utils/Command' +import Shell from '@/main/utils/Shell' import { isMacOS, isWindows } from '@/main/utils/utils' export default class ProcessExtend { @@ -11,10 +11,10 @@ export default class ProcessExtend { try { if (isWindows) { //taskkill杀不存在的进程会有标准错误,从而引发异常 - await Command.exec(`taskkill /f /t /pid ${pid}`); + await Shell.exec(`taskkill /f /t /pid ${pid}`); } else { //pkill杀不存在的进程会有标准错误,从而引发异常 - await Command.sudoExec(`kill ${pid}`); + await Shell.sudoExec(`kill ${pid}`); } // eslint-disable-next-line no-empty } catch { @@ -31,10 +31,10 @@ export default class ProcessExtend { try { if (isWindows) { //taskkill杀不存在的进程会有标准错误,从而引发异常 - await Command.exec(`taskkill /f /t /im ${name}.exe`); + await Shell.exec(`taskkill /f /t /im ${name}.exe`); } else { //pkill杀不存在的进程会有标准错误,从而引发异常 - await Command.sudoExec(`pkill ${name}`); + await Shell.sudoExec(`pkill ${name}`); } // eslint-disable-next-line no-empty } catch { @@ -57,10 +57,10 @@ export default class ProcessExtend { if (isWindows) { commandStr = `(Get-Process -Id ${pid}).Path`; - resStr = await Command.exec(commandStr, {shell: 'powershell'}); + resStr = await Shell.exec(commandStr, {shell: 'powershell'}); } else { commandStr = `lsof -p ${pid} -a -w -d txt -Fn|awk 'NR==3{print}'|sed "s/n//"`; - resStr = await Command.exec(commandStr); + resStr = await Shell.exec(commandStr); } path = resStr.trim().split("\n")[0]; return path.trim(); @@ -103,7 +103,7 @@ export default class ProcessExtend { } command += "|grep -v .dylib|awk '{print $1,$2,$3,$10}'"; try { - let str = await Command.sudoExec(command); + let str = await Shell.sudoExec(command); str = str.trim(); if(!str){ return []; @@ -136,7 +136,7 @@ export default class ProcessExtend { command += " |Select-Object Name,ProcessId,ParentProcessId,ExecutablePath | Format-List | Out-String -Width 999"; try { - let str = await Command.exec(command,{shell: 'powershell'}); + let str = await Shell.exec(command,{shell: 'powershell'}); str = str.trim(); if(!str){ return []; diff --git a/src/main/utils/Service.js b/src/main/utils/Service.js index c47d76ec..87dd3e4f 100644 --- a/src/main/utils/Service.js +++ b/src/main/utils/Service.js @@ -1,4 +1,4 @@ -import Command from "@/main/utils/Command"; +import Shell from "@/main/utils/Shell"; import { isWindows } from '@/main/utils/utils' export default class Service { @@ -8,7 +8,7 @@ export default class Service { if (isWindows) { commandStr = `Get-Service ${name} |Where-Object {$_.Status -eq "Running"}`; - res = await Command.exec(commandStr, {shell: 'powershell'}); + res = await Shell.exec(commandStr, {shell: 'powershell'}); return !!res; // eslint-disable-next-line no-empty } else { @@ -25,7 +25,7 @@ export default class Service { if (isWindows) { commandStr = `Stop-Service ${name}`; - await Command.exec(commandStr, {shell: 'powershell'}); + await Shell.exec(commandStr, {shell: 'powershell'}); // eslint-disable-next-line no-empty } else { diff --git a/src/main/utils/Command.js b/src/main/utils/Shell.js similarity index 95% rename from src/main/utils/Command.js rename to src/main/utils/Shell.js index 7fae9b74..fff1a62a 100644 --- a/src/main/utils/Command.js +++ b/src/main/utils/Shell.js @@ -1,66 +1,66 @@ -import { isDev, isWindows } from '@/main/utils/utils' -import child_process from "child_process"; -import SettingsExtend from "@/main/core/SettingsExtend"; -import util from "util"; - -export default class Command { - /** - * 执行命令,等待进程退出返回结果(标准输出) - * @param command - * @param options - * @returns {Promise} - */ - static async exec(command, options = {}) { - if (isDev) console.log('Command.exec command', command); - - let formatCommand; - if (options.chcp && isWindows) { - formatCommand = '@chcp 65001 >nul & cmd /d/s/c '; - command = formatCommand + command; - } - - if (!options.encoding) { - options.encoding = "utf8"; - } - - const exec = util.promisify(child_process.exec); - - try { - const {stdout} = await exec(command, options); - return stdout; - } catch (error) { - if (isWindows && !options.shell) { - // eslint-disable-next-line no-ex-assign - error = new Error(error.message.replace(formatCommand, '')) - } - throw error; - } - } - - /** - * 执行命令,等待进程退出返回结果(标准输出) - * @param command - * @param options - * @returns {Promise} - */ - static async sudoExec(command, options = {}) { - if (isWindows) { - throw new Error(`Cannot be executed on Windows!`); - } - if (isDev) console.log('Command.sudoExec command', command); - - command = `echo '${SettingsExtend.getUserPwd()}' | sudo -S ${command}`; - - if (!options.encoding) { - options.encoding = "utf8"; - } - - const exec = util.promisify(child_process.exec); - - const {stdout} = await exec(command, options); - return stdout; - } -} - - - +import { isDev, isWindows } from '@/main/utils/utils' +import child_process from "child_process"; +import SettingsExtend from "@/main/core/SettingsExtend"; +import util from "util"; + +export default class Shell { + /** + * 执行命令,等待进程退出返回结果(标准输出) + * @param command + * @param options + * @returns {Promise} + */ + static async exec(command, options = {}) { + if (isDev) console.log('Command.exec command', command); + + let formatCommand; + if (options.chcp && isWindows) { + formatCommand = '@chcp 65001 >nul & cmd /d/s/c '; + command = formatCommand + command; + } + + if (!options.encoding) { + options.encoding = "utf8"; + } + + const exec = util.promisify(child_process.exec); + + try { + const {stdout} = await exec(command, options); + return stdout; + } catch (error) { + if (isWindows && !options.shell) { + // eslint-disable-next-line no-ex-assign + error = new Error(error.message.replace(formatCommand, '')) + } + throw error; + } + } + + /** + * 执行命令,等待进程退出返回结果(标准输出) + * @param command + * @param options + * @returns {Promise} + */ + static async sudoExec(command, options = {}) { + if (isWindows) { + throw new Error(`Cannot be executed on Windows!`); + } + if (isDev) console.log('Command.sudoExec command', command); + + command = `echo '${SettingsExtend.getUserPwd()}' | sudo -S ${command}`; + + if (!options.encoding) { + options.encoding = "utf8"; + } + + const exec = util.promisify(child_process.exec); + + const {stdout} = await exec(command, options); + return stdout; + } +} + + + diff --git a/src/main/utils/SystemExtend.js b/src/main/utils/SystemExtend.js index efe83ceb..2380434e 100644 --- a/src/main/utils/SystemExtend.js +++ b/src/main/utils/SystemExtend.js @@ -1,4 +1,4 @@ -import Command from '@/main/utils/Command' +import Shell from '@/main/utils/Shell' import FsUtil from '@/main/utils/FsUtil' export default class SystemExtend { @@ -9,7 +9,7 @@ export default class SystemExtend { */ static async checkUserPwd(userPwd) { try { - await Command.exec(`echo '${userPwd}' | sudo -S -k -l`) + await Shell.exec(`echo '${userPwd}' | sudo -S -k -l`) return true } catch { return false diff --git a/src/main/utils/TcpProcess.js b/src/main/utils/TcpProcess.js index 722c3c20..39858599 100644 --- a/src/main/utils/TcpProcess.js +++ b/src/main/utils/TcpProcess.js @@ -1,5 +1,5 @@ import { electronRequire } from '@/main/utils/electron' -import Command from '@/main/utils/Command' +import Shell from '@/main/utils/Shell' import ProcessExtend from '@/main/utils/ProcessExtend' import { isMacOS, isWindows } from '@/main/utils/utils' @@ -19,7 +19,7 @@ export default class TcpProcess { static async getListForMacOS() { let commandStr = `lsof -iTCP -sTCP:LISTEN -P -n|awk 'NR!=1{print $1,$2,$3,$5,$9}'`; try { - let resStr = await Command.sudoExec(commandStr); + let resStr = await Shell.sudoExec(commandStr); resStr = resStr.trim(); if (!resStr) { return []; @@ -50,7 +50,7 @@ export default class TcpProcess { commandStr += ' | fl | Out-String -Width 999'; try { - let resStr = await Command.exec(commandStr, {shell: 'powershell'}); + let resStr = await Shell.exec(commandStr, {shell: 'powershell'}); resStr = resStr.trim(); if (!resStr) { return []; @@ -88,10 +88,10 @@ export default class TcpProcess { if (isWindows) { commandStr = `(Get-NetTCPConnection -LocalPort ${port} -State Listen).OwningProcess`; - resStr = await Command.exec(commandStr, {shell: 'powershell'}); + resStr = await Shell.exec(commandStr, {shell: 'powershell'}); } else { commandStr = `lsof -t -sTCP:LISTEN -i:${port}`; - resStr = await Command.exec(commandStr); + resStr = await Shell.exec(commandStr); } if (!resStr) { @@ -114,10 +114,10 @@ export default class TcpProcess { if (isWindows) { commandStr = `(Get-Process -Id (Get-NetTCPConnection -LocalPort ${port} -State Listen).OwningProcess).Path"`; - resStr = await Command.exec(commandStr, {shell: 'powershell'}); + resStr = await Shell.exec(commandStr, {shell: 'powershell'}); } else { commandStr = `lsof -t -sTCP:LISTEN -i:${port}|head -n 1|xargs lsof -a -w -d txt -Fn -p|awk 'NR==3{print}'|sed "s/n//"`; - resStr = await Command.exec(commandStr); + resStr = await Shell.exec(commandStr); } if (!resStr) { diff --git a/src/main/utils/extract.js b/src/main/utils/extract.js index 69ae0229..88bc42e5 100644 --- a/src/main/utils/extract.js +++ b/src/main/utils/extract.js @@ -1,4 +1,4 @@ -import Command from "@/main/utils/Command"; +import Shell from "@/main/utils/Shell"; import extract from 'extract-zip' export async function extractZip(path, dest) { @@ -20,5 +20,5 @@ export async function extractTar(path, dest) { if (path.endsWith('.tar.xz')) { commandStr = `tar -xf ${path} -C ${dest}`; } - await Command.exec(commandStr); + await Shell.exec(commandStr); }