Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么安装utools的插件? #105

Closed
Hiddensu opened this issue Apr 27, 2022 · 5 comments
Closed

怎么安装utools的插件? #105

Hiddensu opened this issue Apr 27, 2022 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@Hiddensu
Copy link

怎么安装utools的插件?

@Hiddensu Hiddensu added the help wanted Extra attention is needed label Apr 27, 2022
@muwoo
Copy link
Contributor

muwoo commented Apr 29, 2022

@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
Copy link
Contributor

muwoo commented Apr 29, 2022

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

@coding-javion
Copy link

upx文件怎么处理呢?

@ciaranchen
Copy link

@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

@muwoo muwoo closed this as completed Sep 20, 2023
@muwoo muwoo pinned this issue Oct 11, 2023
@bigtran
Copy link

bigtran commented Mar 5, 2024

这个简直无敌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants