-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2637 from ever-co/feat/server-web-updater
[Feat] server web updater
- Loading branch information
Showing
15 changed files
with
814 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { autoUpdater, } from 'electron-updater'; | ||
import log from 'electron-log'; | ||
import EventEmitter from 'events'; | ||
import { EventLists } from './helpers/constant'; | ||
|
||
class AppUpdater { | ||
constructor(eventEmitter: EventEmitter) { | ||
log.transports.file.level = 'info'; | ||
autoUpdater.logger = log; | ||
autoUpdater.on('update-available', () => { | ||
eventEmitter.emit(EventLists.UPDATE_AVAILABLE); | ||
}) | ||
|
||
autoUpdater.on('error', (message) => { | ||
eventEmitter.emit(EventLists.UPDATE_ERROR, message); | ||
}) | ||
|
||
autoUpdater.on('update-not-available', (info) => { | ||
eventEmitter.emit(EventLists.UPDATE_NOT_AVAILABLE, info); | ||
}) | ||
|
||
autoUpdater.on('download-progress', (info) => { | ||
eventEmitter.emit(EventLists.UPDATE_PROGRESS, info); | ||
}) | ||
|
||
autoUpdater.on('update-downloaded', (data) => { | ||
eventEmitter.emit(EventLists.UPDATE_DOWNLOADED, data); | ||
}) | ||
|
||
autoUpdater.on('update-cancelled', (info) => { | ||
eventEmitter.emit(EventLists.UPDATE_CANCELLED, info); | ||
}) | ||
// autoUpdater.checkForUpdatesAndNotify(); | ||
} | ||
|
||
checkUpdate() { | ||
autoUpdater.checkForUpdates(); | ||
} | ||
|
||
installUpdate() { | ||
autoUpdater.quitAndInstall(); | ||
} | ||
} | ||
|
||
export default AppUpdater; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { EverTeamsLogo } from './svgs'; | ||
type Props = { | ||
version: string; | ||
}; | ||
export const AboutComponent = (props: Props) => { | ||
return ( | ||
<div className="flex min-h-screen items-center justify-center bg-gray-100"> | ||
<div className="rounded-lg bg-gray-50 px-16 py-14"> | ||
<div className="flex justify-center"> | ||
<EverTeamsLogo /> | ||
</div> | ||
<h2 className="w-[230px] text-center text-gray-600 mt-10"> | ||
V {props.version} | ||
</h2> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
type Props = { | ||
isShowPopup: boolean; | ||
modalAction: () => void; | ||
type: 'success' | 'error' | 'none'; | ||
message: string; | ||
}; | ||
export function Popup(props: Props) { | ||
return ( | ||
<div | ||
className={`fixed z-10 inset-0 overflow-y-auto ${props.isShowPopup ? '' : 'hidden'}`} | ||
id="my-modal" | ||
> | ||
<div className="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"> | ||
<div className="fixed inset-0 transition-opacity" aria-hidden="true"> | ||
<div className="absolute inset-0 bg-gray-500 opacity-75"></div> | ||
</div> | ||
<span | ||
className="hidden sm:inline-block sm:align-middle sm:h-screen" | ||
aria-hidden="true" | ||
> | ||
​ | ||
</span> | ||
<div | ||
className="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-1/3" | ||
role="dialog" | ||
aria-modal="true" | ||
aria-labelledby="modal-headline" | ||
> | ||
<div> | ||
<div className="mx-auto flex items-center justify-center h-32 w-12 rounded-full"> | ||
{props.type === 'success' && ( | ||
<div className="rounded-full bg-green-200 p-6"> | ||
<div className="flex h-16 w-16 items-center justify-center rounded-full bg-green-500 p-4"> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke-width="1.5" | ||
stroke="currentColor" | ||
className="h-8 w-8 text-white" | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
d="M4.5 12.75l6 6 9-13.5" | ||
/> | ||
</svg> | ||
</div> | ||
</div> | ||
)} | ||
{props.type === 'error' && ( | ||
<div className="rounded-full bg-red-200 p-6"> | ||
<div className="flex h-16 w-16 items-center justify-center rounded-full bg-red-500 p-4"> | ||
<svg | ||
className="h-8 w-8 text-white" | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke="currentColor" | ||
aria-hidden="true" | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
stroke-width="2" | ||
d="M6 18L18 6M6 6l12 12" | ||
/> | ||
</svg> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
<div className="mt-3 text-center sm:mt-5"> | ||
<h3 | ||
className="text-lg leading-6 font-medium text-gray-900" | ||
id="modal-headline" | ||
> | ||
{props.type == 'success' ? 'Success' : 'Error'} | ||
</h3> | ||
<div className="mt-2"> | ||
<p className="text-sm text-gray-500 text-pretty break-words"> | ||
{props.message} | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="mt-5 sm:mt-6"> | ||
<button | ||
className="mx-auto mt-10 block rounded-xl border-4 border-transparent bg-blue-400 px-6 py-3 text-center text-base font-medium text-blue-100 outline-8 hover:outline hover:duration-300" | ||
onClick={props.modalAction} | ||
> | ||
OK | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.