Ubuntu 22.04.03 LTS / Typora 1.7.6 测试可用,故将原文稍作修改记录备份


首先叠个甲,本人已购买Typora激活凭证,该备份仅作学习测试使用,还请各位支持正版

步骤

1.获取 Typora 安装包

安装包可从官方网站或终端直接获取

wget -qO - https://typoraio.cn/linux/public-key.asc | sudo tee /etc/apt/trusted.gpg.d/typora.asc

# add Typora's repository

sudo add-apt-repository 'deb https://typoraio.cn/linux ./'

sudo apt-get update

# install typora

sudo apt-get install typora

2.克隆 Yporaject 项目

sudo apt install git

# 选自https://github.com/hazukieq/Yporaject,其对两个项目进行了合并,方便快捷
git clone https://github.com/hazukieq/Yporaject.git --depth=1

3.配置 Rust 环境

由于编译项目需要 Rust 的支持,所以需要配置相关环境

sudo apt install curl

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# 检查 cargo,若看到如下版本信息,则说明配置成功
cargo -v
cargo 1.74.0 (ecb9851af 2023-10-18)

4.编译 Yporaject 项目

# 进入 Yporaject 项目
cd Yporaject
# 运行编译命令
cargo build
# 查看二进制是否生成,程序名称为 node_inject
ls target/debug
# 尝试运行该二进制程序
cargo run
output: 
no node_modules.asar found
move me to the root of your typora installation(the same directory as executable of electron)

请务必确认 Yporaject 目录 target/debug 下 是否生成了 node_inject 二进制程序

5.复制 node_inject 到安装目录下

# 记录当前目录路径,待会返回需要用到
cur=`pwd`

# 复制二进制程序到相关目录下
sudo cp target/debug/node_inject /usr/share/typora
# 进入相关目录
cd /usr/share/typora
# 给予二进制程序执行权限
sudo chmod +x node_inject

# 运行二进制程序
# (请注意程序运行输出信息,观察是否运行成功!!)
# 若无读写权限,建议使用 sudo ./node_inject
sudo ./node_inject

6.获取许可证激活码

# 返回项目
cd $cur
# 进入 license-gen 文件夹
cd license-gen
# 编译代码
cargo build
# 运行二进制程序
cargo run
# 你将会得到以下输出
output:
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `target/debug/license-gen`
License for you: xxxxxx-xxxxxx-xxxxxx-xxxxxx

将激活码复制到Typora激活即可,邮箱可随意填写

参考资料

发表评论