Skip to content

MarkSamle/GhostWriter

Repository files navigation

GhostWriter


一、说明

         欢迎使用 Ghost Writer !
         Ghost Writer 是一款参照 觅道(MrDoc) 开发的个人笔记、文档离线管理应用。
         是一个纯前端项目,使用了sqlite本地数据库,除自行编辑使用到的外部图片、外部视频、外部链接等资源、以及OCR识别接口外,注册、登录、编辑等功能均不使用网络,数据存储在该应用本地的资源夹内,完全的保证了数据的隐私、私有。默认管理员账号 admin 密码 admin123..

二、其他

2.1 Sql.js

在 node.js 中使用sql.js 已经托管在 npm ,你只需运行 npm install sql.js 就能安装。另外,你也可以选择下载 sql-wasm.jssql-wasm.wasm 来实现功能

2.2 从磁盘读取数据库

var fs = require('fs');
var initSqlJs = require('sql-wasm.js');
var filebuffer = fs.readFileSync('test.sqlite');
initSqlJs().then(function(SQL){
// Load the db
var db = new SQL.Database(filebuffer);
});

2.3 将数据库写入磁盘

你需要将 db.export 的结果转换为 buffer

var fs = require("fs");
// [...] (create the database)
var data = db.export();
var buffer = new Buffer(data);
fs.writeFileSync("filename.sqlite", buffer);

三、本地搭建

3.1 安装依赖

npm install
cnpm install

3.2 install-app-deps报错处理(可忽略)

electron-builder进行打包的时候,会建议你在此之前使用electron-builder install-app-deps的命令。该命令的作用就是针对即将打包的electron程序对应的node版本进行原生模块的编译工作,以达到模块运行时匹配。实际上,install-app-deps内部依然使用了node-gyp相关知识。 如果install环节出现报错,可以先把"postinstall": "electron-builder install-app-deps","postuninstall": "electron-builder install-app-deps"删除再执行。

3.3 node-gyp报错处理(可忽略)

cnpm install/npm install时,报错:RunScriptError: Run "C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild" 管理员权限运行powershell,安装cnpm install --global --production windows-build-tools,配置环境变量path增加C:\Users\username\.windows-build-tools\python27

3.4 运行

npm run dev

3.5 打包

npm run electron:build

3.5.1 打包异常处理

提示cannot find module fs/promises时,按报错位置找到依赖文件,把require("fs/promises")全部替换为require("fs").promises再打包

3.5.2 或者升级node

# 第一步清理npm缓存:
npm cache clean -f
# 第二步运行npm安装工具
npm -g install n
# 第三步运行n stable(安装最新稳定版本)
n stable

3.5.3 或者降低cnpm

# 第一步删除已安装的cnpm版本
npm uninstall -g cnpm
# 第二步安装低版本cnpm
npm install cnpm@7.1.0 -g --registry=https://registry.npm.taobao.org

四、使用

4.1 F12

Ctrl + F12 打开控制台

4.2 展示

五、感谢

Vue
Electron
electron-vue
sql.js
TrWebOCR

About

Ghost Writer is a personal notes and documents offline management application for Windows developed by Vue-Electron.

Resources

License

Stars

Watchers

Forks

Packages

No packages published