Skip to content

Commit

Permalink
fix limit issue and updater
Browse files Browse the repository at this point in the history
  • Loading branch information
hannydevelop committed Dec 30, 2023
1 parent e97848b commit c0bdb70
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This page holds all information that is needed to setup a desktop application th

Peppubuild doesn't collect or store your personal information. You will notice this if you use Vision AI since you need to add your API keys at the begining of each session. While each project contains a `.peppubuild` file that stores snippet of your project so that they can be loaded successfully with Peppubuild, we don't want you to loose your project if you don't have access to your PC. For this, you can store your project on Github so that it is easily accessible from anywhere. Follow the steps below.

-
!coming soon

We are working on incorporating other Git hosting platflorms.

Expand Down
5 changes: 4 additions & 1 deletion main/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions main/public/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const Home = {
// initialize grapesjs
grapesjs.init({
container: '#gjs',
height: '100vh',
showOffsets: true,
fromElement: true,
noticeOnUnload: false,
Expand Down
79 changes: 79 additions & 0 deletions main/updater.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
const autoUpdater = require('electron-updater');
const { dialog, BrowserWindow, ipcMain } = require('electron');
const log = require('electron-log');

let downloadProgress;
log.transports.file.level = "debug";
autoUpdater.autoUpdater.logger = log;

autoUpdater.autoUpdater.autoDownload = false;

autoUpdater.autoUpdater.setFeedURL({
provider: "github",
owner: "hannydevelop",
repo: "peppubuild-desktop",
});

function check() {
autoUpdater.autoUpdater.checkForUpdates();

autoUpdater.autoUpdater.on('checking-for-update', () => {
const response = dialog.showMessageBox(null);
console.log(response);
dialog.showMessageBox({
type: 'info',
title: 'Update Available',
message: 'A new version of app is available. Do you want to update now?',
buttons: ['Update', 'No']
}, (index) => {
if (index) {
return;
} else {
autoUpdater.autoUpdater.downloadUpdate();

let proWin = new BrowserWindow({
width: 350,
height: 35,
useContentSize: true,
autoHideMenuBar: true,
maximizable: false,
fullscreen: false,
fullscreenable: false,
resizable: false,
title: 'Downloading Update'
});
proWin.loadURL(`file://$(__dirname)/progress`);

proWin.on('closed', () => {
proWin = null;
});

ipcMain.on('download-progress-request', (e) => {
e.returnValue = downloadProgress;
});

autoUpdater.autoUpdater.on('download-progress', (d) => {
downloadProgress = d.percent;
autoUpdater.autoUpdater.logger.info(downloadProgress);
});

autoUpdater.autoUpdater.on('update-downloaded', () => {
if (progressWindow) progressWindow.close();

dialog.showMessageBox({
type: 'info',
title: 'Update Ready',
message: 'A new version of app is ready. Quit and Install now?',
buttons: ['Yes', 'Later']
}, (index) => {
if (!index) {
autoUpdater.autoUpdater.quitAndInstall();
}
});
});
}
});
});
}

module.exports.check = check;
101 changes: 87 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"bootstrap": "^5.3.2",
"compression": "^1.7.4",
"cookie-parser": "^1.4.6",
"electron-log": "^5.0.3",
"electron-updater": "^6.1.7",
"express": "^4.17.2",
"fs": "^0.0.1-security",
"grapesjs": "^0.21.7",
Expand Down

0 comments on commit c0bdb70

Please sign in to comment.