rubickCenter / rubick

🔧 Electron based open source toolbox, free integration of rich plug-ins. 基于 electron 的开源工具箱,自由集成丰富插件。
https://rubickcenter.github.io/docs
MIT License
7.81k stars 793 forks source link

怎么安装utools的插件? #105

Closed Hiddensu closed 12 months ago

Hiddensu commented 2 years ago

怎么安装utools的插件?

muwoo commented 2 years ago

@Hiddensu utools 下开源插件(github 上搜 utools 能搜到的一些utools插件)使用方法: 第一步需要把 utools 插件修改为自己的插件:

  1. git clone xxxx
  2. 修改 plugin.jsonpackage.json
  3. 检测 package.json 内容,需满足一下要求:
    {
    "name": "rubick-ui-plugin-demo",
    "pluginName": "插件demo",
    "description": "rubick ui 插件demo",
    "author": "muwoo",
    "main": "index.html",
    "logo": "https://www.img/demo.png",
    "version": "0.0.1",
    "preload":"preload.js",
    "homePage": "https://gitee.com/rubick-center/rubick-ui-plugin-demo/raw/master/README.md",
    "pluginType": "ui",
    "features": [
    {
      "code": "index",
      "explain": "测试插件",
      "cmds":[
        "demo",
        "测试"
      ]
    }
    ]
    }

    这样就把这个开源插件改成了你自己的,自己的插件如何安装到rubick,就可以直接根据 rubick 文档来了:https://rubickcenter.github.io/rubick/dev/#%E5%BC%80%E5%8F%91-ui-%E6%8F%92%E4%BB%B6

如果需要发布自己的插件到 rubick 公共插件库,可以参考这个文档:https://rubickcenter.github.io/rubick/dev/#%E5%8F%91%E5%B8%83%E6%8F%92%E4%BB%B6

muwoo commented 2 years ago

@Hiddensu utools闭源插件,先在utools内下载插件,然后找到插件源码,mac下载到了 /Users/{user}/Library/Application Support/uTools/plugins/xxx 后面步骤跟开源一样了

coding-javion commented 2 years ago

upx文件怎么处理呢?

ciaranchen commented 1 year ago

@coding-javion

upx文件本质是对插件目录进行了封包 https://yuanliao.info/d/6534

我让ChatGPT编写了一个nodejs的小脚本,可以从upx恢复至插件目录。

const fs = require('fs');
const path = require('path');
const compressing = require('compressing');
const asar = require('asar');

// 检查命令行参数是否提供了要处理的文件路径
if (process.argv.length !== 3) {
  console.error('请提供要处理的文件路径作为命令行参数!');
  process.exit(1);
}

// 获取要处理的文件路径
const filePath = process.argv[2];

// 检查文件是否存在
if (!fs.existsSync(filePath)) {
  console.error(`文件 '${filePath}' 不存在!`);
  process.exit(1);
}

// 获取文件名和后缀名
const fileName = path.basename(filePath);
const fileExt = path.extname(fileName);

// 检查文件后缀是否为.upx
if (fileExt !== '.upx') {
  console.error('文件必须具有.upx扩展名!');
  process.exit(1);
}

// 解压.upx文件
async function upxExtract(upxPath) {
  try {
    const folderPath = upxPath.replace('.upx', '');
    await compressing.gzip.uncompress(upxPath, folderPath + '.asar');
    console.log('已解压.gz文件');

    // 使用asar库解压.asar文件
    await asar.extractAll(folderPath + '.asar', folderPath);
    console.log('已解压.asar文件');
  } catch (error) {
    console.error('处理文件时出错:', error);
  }
}

upxExtract(filePath);

注意,在用这个脚本获得了原有目录之后,你还需要:

  1. 修改 plugin.json 为 package.json,并使其满足 Rubick 的要求。
  2. 参考Rubick的文档安装插件: https://rubickcenter.github.io/rubick/dev/#%E5%BC%80%E5%8F%91-ui-%E6%8F%92%E4%BB%B6
bigtran commented 6 months ago

这个简直无敌