| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| 'use strict';
|
|
|
| const { contextBridge, ipcRenderer } = require('electron');
|
|
|
| contextBridge.exposeInMainWorld('chahuadevHub', {
|
|
|
|
|
| getDownloadDir: () =>
|
| ipcRenderer.invoke('get-download-dir'),
|
|
|
| isDev: () =>
|
| ipcRenderer.invoke('get-is-dev'),
|
|
|
|
|
| fetchDashboard: () =>
|
| ipcRenderer.invoke('fetch-dashboard'),
|
|
|
| fetchFiles: () =>
|
| ipcRenderer.invoke('fetch-files'),
|
|
|
| fetchChangelog: () =>
|
| ipcRenderer.invoke('fetch-changelog'),
|
|
|
| fetchAllRepos: () =>
|
| ipcRenderer.invoke('fetch-all-repos'),
|
|
|
| fetchRepoCommits: (repoId, repoType) =>
|
| ipcRenderer.invoke('fetch-repo-commits', repoId, repoType),
|
|
|
| fetchRepoTree: (repoId, repoType, options) =>
|
| ipcRenderer.invoke('fetch-repo-tree', repoId, repoType, options),
|
|
|
| fetchRepoFile: (repoId, repoType, repoPath) =>
|
| ipcRenderer.invoke('fetch-repo-file', repoId, repoType, repoPath),
|
|
|
| openRepoFileEditor: (repoId, repoType, repoPath) =>
|
| ipcRenderer.invoke('open-repo-file-editor', repoId, repoType, repoPath),
|
|
|
| fetchNpmPackages: () =>
|
| ipcRenderer.invoke('fetch-npm-packages'),
|
|
|
|
|
| downloadFile: (filePath, fileSize) =>
|
| ipcRenderer.invoke('download-file', filePath, fileSize),
|
|
|
|
|
| onDownloadProgress: (callback) => {
|
| ipcRenderer.on('download-progress', (_event, filePath, downloaded, total, pct) => {
|
| callback({ filePath, received: downloaded, total, percent: pct });
|
| });
|
| },
|
|
|
| removeDownloadProgressListeners: () => {
|
| ipcRenderer.removeAllListeners('download-progress');
|
| },
|
|
|
|
|
| checkFileExists: (filePath) =>
|
| ipcRenderer.invoke('check-file-exists', filePath),
|
|
|
|
|
|
|
| saveFileMeta: (filePath, meta) =>
|
| ipcRenderer.invoke('save-file-meta', filePath, meta),
|
|
|
|
|
| getFileMeta: (filePath) =>
|
| ipcRenderer.invoke('get-file-meta', filePath),
|
|
|
| openFile: (filePath, expectedHash) =>
|
| ipcRenderer.invoke('open-file', filePath, expectedHash),
|
|
|
| openFileFolder: (filePath) =>
|
| ipcRenderer.invoke('open-file-folder', filePath),
|
|
|
| openDownloads: () =>
|
| ipcRenderer.invoke('open-downloads'),
|
|
|
| openExternalUrl: (url) =>
|
| ipcRenderer.invoke('open-external-url', url),
|
|
|
|
|
| getAppVersion: () =>
|
| ipcRenderer.invoke('get-app-version'),
|
|
|
| checkAppUpdate: () =>
|
| ipcRenderer.invoke('check-app-update'),
|
|
|
| updater: {
|
| getChannel: () => ipcRenderer.invoke('updater:get-channel'),
|
| getStatus: () => ipcRenderer.invoke('updater:get-status'),
|
| checkNow: () => ipcRenderer.invoke('updater:check-now')
|
| },
|
|
|
|
|
|
|
| npmSelfUpdate: () =>
|
| ipcRenderer.invoke('npm-self-update'),
|
|
|
| onNpmUpdateLog: (callback) =>
|
| ipcRenderer.on('npm-update-log', (_e, line) => callback(line)),
|
|
|
| removeNpmUpdateLogListeners: () =>
|
| ipcRenderer.removeAllListeners('npm-update-log'),
|
|
|
| relaunchApp: () =>
|
| ipcRenderer.invoke('relaunch-app'),
|
|
|
| npmGetInstallPath: (pkgName) =>
|
| ipcRenderer.invoke('npm-get-install-path', pkgName),
|
|
|
| openNpmPkgFolder: (pkgName) =>
|
| ipcRenderer.invoke('open-npm-folder', pkgName),
|
|
|
|
|
| npmInstallPackage: (pkgName) =>
|
| ipcRenderer.invoke('npm-install-package', pkgName),
|
|
|
| onNpmInstallLog: (callback) =>
|
| ipcRenderer.on('npm-install-log', (_e, line) => callback(line)),
|
|
|
| removeNpmInstallLogListeners: () =>
|
| ipcRenderer.removeAllListeners('npm-install-log'),
|
|
|
| });
|
|
|