diff --git a/README.md b/README.md index cad93e4..b461d53 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ ### 🎉 What's this? 这是一款`在线工具箱`程序,您可以通过安装扩展增强她的功能 +通过插件模板的功能,您也可以把她当做网页导航来使用~ 觉得该项目不错的可以给个`Star`~ ### 😺 演示地址 @@ -17,7 +18,9 @@ > 严禁用于非法用途 ### 😺 文档 -[插件编写](docs/Plugin.md) +[插件编写](docs/Plugin.md) +[Github Oauth 配置](docs/Github_Oauth.md) +[Plugin Template 使用](docs/Plugin_Template.md) ### 🎊 环境要求 diff --git a/app/controller/master/Plugin.php b/app/controller/master/Plugin.php index b8ab789..634a2db 100644 --- a/app/controller/master/Plugin.php +++ b/app/controller/master/Plugin.php @@ -80,6 +80,7 @@ class Plugin extends BaseController 'title', 'enable', 'weight', + 'template', ])->data($params)->save(); return msg('ok', 'success', $plugin); } @@ -117,6 +118,7 @@ class Plugin extends BaseController 'title', 'enable', 'weight', + 'template', ])->data($params)->save(); return msg('ok', 'success', $plugin); } diff --git a/app/controller/master/System.php b/app/controller/master/System.php index 08994fa..4bea505 100644 --- a/app/controller/master/System.php +++ b/app/controller/master/System.php @@ -72,8 +72,18 @@ class System extends BaseController array_push($arr, basename($v)); } } + return msg('ok', 'success', $arr); - + } + public function plugin_templates() + { + $glob = glob(template_path_get() . '/template/*'); + $arr = []; + foreach ($glob as $v) { + if (is_file($v)) { + array_push($arr, basename($v,'.html')); + } + } return msg('ok', 'success', $arr); } diff --git a/app/lib/Plugin.php b/app/lib/Plugin.php index ec71fdb..e31a236 100644 --- a/app/lib/Plugin.php +++ b/app/lib/Plugin.php @@ -119,6 +119,7 @@ class Plugin $model->config = []; $model->category_id = 0; $model->request_count = 0; + $model->template = 'default'; } if (is_file($this->pluginPath . '/logo.png')) { $logoFilename = plugin_logo_path_get($this->pluginClass); diff --git a/app/model/Category.php b/app/model/Category.php index 98288cd..8ed7697 100644 --- a/app/model/Category.php +++ b/app/model/Category.php @@ -6,6 +6,7 @@ namespace app\model; /** * @property int $id + * @property int $weight 权重 * @property string $create_time 安装时间 * @property string $title 标题 * @property string $update_time 更新时间 diff --git a/app/model/Plugin.php b/app/model/Plugin.php index d52347a..d04cabd 100644 --- a/app/model/Plugin.php +++ b/app/model/Plugin.php @@ -10,14 +10,17 @@ use think\Model; * Class app\model\Plugin * * @property int $category_id 分类 + * @property int $enable 是否启用 * @property int $id * @property int $request_count 接口请求次数 + * @property int $weight 权重 * @property string $alias 插件名 * @property string $class 插件类 * @property string $config 配置信息 * @property string $create_time 安装时间 * @property string $desc 插件描述 * @property string $logo 插件logo + * @property string $template * @property string $title 插件标题 * @property string $update_time 更新时间 * @property string $version 版本 diff --git a/app/model/Request.php b/app/model/Request.php index 6caa0d7..2779b9b 100644 --- a/app/model/Request.php +++ b/app/model/Request.php @@ -12,6 +12,7 @@ namespace app\model; * @property int $request_count 接口请求次数 * @property string $create_time 安装时间 * @property string $update_time 更新时间 + * @property-read \app\model\Plugin $plugin */ class Request extends Base { diff --git a/config/version.php b/config/version.php index 5be8940..a3af413 100644 --- a/config/version.php +++ b/config/version.php @@ -3,4 +3,4 @@ // | 版本号 // +---------------------------------------------------------------------- -define('VERSION', 'v1.2'); \ No newline at end of file +define('VERSION', 'v1.3'); \ No newline at end of file diff --git a/docs/Github_Oauth.md b/docs/Github_Oauth.md new file mode 100644 index 0000000..31f8efe --- /dev/null +++ b/docs/Github_Oauth.md @@ -0,0 +1,12 @@ +## Github Oauth 配置 +* 打开Github,并且登录你的github账号 +* 打开:https://github.com/settings/developers + +### 创建一个Oauth APP + + +#### 填写APP信息 + +#### 获取`Client ID`和`Client secrets` + +#### 最后在安装界面填入刚刚得到的的`Client ID`和`Client secrets`即可完成`Oauth`配置 \ No newline at end of file diff --git a/docs/Plugin_Template.md b/docs/Plugin_Template.md new file mode 100644 index 0000000..2540723 --- /dev/null +++ b/docs/Plugin_Template.md @@ -0,0 +1,20 @@ +## Plugin Template 使用 +### 添加插件 + + +### 插件配置信息填入下方`JSON`数据 +```json +{ + "url":"https://www.aoaostar.com" +} +``` +### 成功演示 + +#### `redirect`亦是如此 + +## 添加新模板 +### 在`view/index/default/template`添加`pluto.html` + + +### 添加成功之后,即可在后台看到新增的模板 + diff --git a/docs/images/github_oauth_1.png b/docs/images/github_oauth_1.png new file mode 100644 index 0000000..92bce8d Binary files /dev/null and b/docs/images/github_oauth_1.png differ diff --git a/docs/images/github_oauth_2.png b/docs/images/github_oauth_2.png new file mode 100644 index 0000000..6403a16 Binary files /dev/null and b/docs/images/github_oauth_2.png differ diff --git a/docs/images/github_oauth_3.png b/docs/images/github_oauth_3.png new file mode 100644 index 0000000..ed90626 Binary files /dev/null and b/docs/images/github_oauth_3.png differ diff --git a/docs/images/plugin_template_1.png b/docs/images/plugin_template_1.png new file mode 100644 index 0000000..0e9244b Binary files /dev/null and b/docs/images/plugin_template_1.png differ diff --git a/docs/images/plugin_template_2.png b/docs/images/plugin_template_2.png new file mode 100644 index 0000000..3b1084f Binary files /dev/null and b/docs/images/plugin_template_2.png differ diff --git a/docs/images/plugin_template_3.png b/docs/images/plugin_template_3.png new file mode 100644 index 0000000..5f369d4 Binary files /dev/null and b/docs/images/plugin_template_3.png differ diff --git a/docs/images/plugin_template_4.png b/docs/images/plugin_template_4.png new file mode 100644 index 0000000..0f2efb6 Binary files /dev/null and b/docs/images/plugin_template_4.png differ diff --git a/docs/images/view_1.png b/docs/images/view_1.png index ea8331b..29663a3 100644 Binary files a/docs/images/view_1.png and b/docs/images/view_1.png differ diff --git a/install.sql b/install.sql index 2cd0a23..6f7f5c1 100644 --- a/install.sql +++ b/install.sql @@ -80,6 +80,7 @@ CREATE TABLE `toolbox_plugin` ( `enable` int(11) NOT NULL DEFAULT 1 COMMENT '是否启用', `request_count` int(11) NOT NULL DEFAULT 0 COMMENT '接口请求次数', `category_id` int(11) NOT NULL DEFAULT 0 COMMENT '分类', + `template` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'default', `create_time` datetime NOT NULL COMMENT '安装时间', `update_time` datetime NOT NULL COMMENT '更新时间', PRIMARY KEY (`id`) USING BTREE, @@ -90,7 +91,7 @@ CREATE TABLE `toolbox_plugin` ( -- ---------------------------- -- Records of toolbox_plugin -- ---------------------------- -INSERT INTO `toolbox_plugin` VALUES (1, 'Hello,Pluto', '/static/icons/aoaostar_com_example.png', 'If you see this message, it means that your program is running properly', 'example', 'aoaostar_com\\example', '{}', 'v1.0', 0, 1, 0, 1, '2021-12-22 18:38:35', '2021-12-25 13:50:14'); +INSERT INTO `toolbox_plugin` VALUES (1, 'Hello,Pluto', '/static/icons/aoaostar_com_example.png', 'If you see this message, it means that your program is running properly', 'example', 'aoaostar_com\\example', '{}', 'v1.0', 0, 1, 0, 1, 'default', '2021-12-22 18:38:35', '2021-12-25 13:50:14'); -- ---------------------------- -- Table structure for toolbox_request diff --git a/public/admin/index.html b/public/admin/index.html index 25c99ab..29c7a0c 100644 --- a/public/admin/index.html +++ b/public/admin/index.html @@ -2,7 +2,7 @@
-