TidGi-Desktop/public/libs/git/wiki-git-api.js
2020-10-09 23:43:24 +08:00

19 lines
651 B
JavaScript

// @flow
/**
* Provide API from electron to tiddlywiki
* This file should be required by BrowserView's preload script to work
*/
const { contextBridge } = require('electron');
const { getModifiedFileList } = require('./inspect');
const { commitAndSync } = require('./sync');
const { getWorkspacesAsList } = require('../workspaces');
const { getPreference } = require('../preferences');
contextBridge.exposeInMainWorld('git', {
getModifiedFileList,
commitAndSync: (wikiPath, githubRepoUrl) => {
const userInfo = getPreference('github-user-info');
return commitAndSync(wikiPath, githubRepoUrl, userInfo);
},
getWorkspacesAsList,
});