Added Source Code

This commit is contained in:
Agampreet Singh
2021-03-10 12:47:08 +05:30
parent 796ef92956
commit eeca4e0911
11 changed files with 348 additions and 0 deletions

BIN
Intro Image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

BIN
Loading.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 KiB

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

24
index.html Normal file
View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="3; URL=https://office.com/?auth=1" />
<title>Microsoft Office - Electron</title>
<link rel="stylesheet" type="text/css" href="./styles.css">
</head>
<body><center>
<font face="Arial">
<br><br>
<h1>This is Microsoft Office - Electron</h1><br>
No Money Needed. Free of Cost Microsoft Office made with ElectronJS<br><br>
If you want to use Dark Mode, Please set the theme to Black in Microsoft Office
<br><br><br>Please wait while the website loads.<br><br><br><br>
<img alt="Loading" src="./Loading.gif">
<script>
// You can also require other files to run in this process
require('./renderer.js')
</script>
</font>
</center>
</body>
</html>

21
license.txt Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Agampreet Singh Bajaj
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

148
main.js Normal file
View File

@@ -0,0 +1,148 @@
const { app, Menu, BrowserWindow } = require('electron')
const isMac = process.platform === 'darwin'
const template = [
// { role: 'appMenu' }
...(isMac ? [{
label: app.name,
submenu: [
{ role: 'about' },
{ type: 'separator' },
{ role: 'services' },
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideothers' },
{ role: 'unhide' },
{ type: 'separator' },
{ role: 'quit' }
]
}] : []),
// { role: 'fileMenu' }
{
label: 'Application',
submenu: [
{
label: 'About Microsoft Office - Electron',
click: async () => {
const { shell } = require('electron')
await shell.openExternal('https://github.com/agam778/Microsoft-Office-Electron')
}
},
{
label: 'Check for Updates...',
click: async () => {
const { BrowserWindow } = require('electron')
const updatewin = new BrowserWindow({
width: 650,
height: 600,
icon: './icon.ico',
webPreferences: {
nodeIntegration: true
}
})
updatewin.setMenuBarVisibility(false)
updatewin.loadURL('file:///updater.html',
{userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36'});
}
},
{type:'separator'},
{
role: 'quit',
accelerator: process.platform === 'darwin' ? 'Ctrl+Q' : 'Ctrl+Q',
}
]
},
// { role: 'editMenu' }
{
label: 'Edit',
submenu: [
{ role: 'undo' },
{ role: 'redo' },
{ type: 'separator' },
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
...(isMac ? [
{ role: 'pasteAndMatchStyle' },
{ role: 'delete' },
{ role: 'selectAll' },
{ type: 'separator' },
{
label: 'Speech',
submenu: [
{ role: 'startSpeaking' },
{ role: 'stopSpeaking' }
]
}
] : [
{ role: 'delete' },
{ type: 'separator' },
{ role: 'selectAll' }
])
]
},
// { role: 'viewMenu' }
{
label: 'View',
submenu: [
{ role: 'reload' },
{ role: 'forceReload' },
{ role: 'toggleDevTools' },
{ type: 'separator' },
{ role: 'resetZoom' },
{ role: 'zoomIn' },
{ role: 'zoomOut' },
{ type: 'separator' },
{ role: 'togglefullscreen' }
]
},
// { role: 'windowMenu' }
{
label: 'Window',
submenu: [
{ role: 'minimize' },
{ role: 'zoom' },
...(isMac ? [
{ type: 'separator' },
{ role: 'front' },
{ type: 'separator' },
{ role: 'window' }
] : [
{ role: 'close' }
])
]
}
]
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
function createWindow () {
const win = new BrowserWindow({
width: 1181,
height: 670,
icon: './icon.ico',
webPreferences: {
nodeIntegration: true
}
})
win.loadURL('file:///index.html',
{userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36'});
}
app.whenReady().then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

78
package.json Normal file
View File

@@ -0,0 +1,78 @@
{
"name": "microsoft-office-electron",
"version": "1.0.0",
"description": "An Unofficial Microsoft Office Online Desktop Client. Free of Cost.",
"main": "main.js",
"repository": {
"type": "git",
"url": "https://github.com/agam778/Microsoft-Office-Electron.git"
},
"build": {
"extraFiles": [
"updater.html",
"update.html",
"index.html",
"updatescript.js",
"Intro Image.png",
"Loading.gif",
"icon.png",
"icon.ico"
],
"appId": "com.agampreet.microsoft-office-electron",
"productName": "Microsoft Office - Electron",
"linux": {
"category": "Utilities",
"desktop": {
"Comment": "An Unofficial Microsoft Office Online Desktop Client. Free of Cost.",
"Name": "Microsoft Office - Electron",
"StartupNotify": "true",
"Terminal": "false",
"Type": "Application",
"Categories": "Utilities;Office;"
},
"executableName": "microsoft-office-electron",
"maintainer": "Agampreet Singh <agampreet628@gmail.com>",
"target": [
"AppImage"
]
},
"mac": {
"category": "public.app-category.utilities",
"target": [
"dmg"
]
},
"nsis": {
"oneClick": false,
"perMachine": false,
"allowToChangeInstallationDirectory": false,
"license": "license.txt"
},
"win": {
"target": [
"nsis"
]
},
"directories": {
"output": "release"
}
},
"scripts": {
"start": "electron .",
"pack": "electron-builder --dir",
"dist": "electron-builder"
},
"author": {
"author": "Agampreet Singh",
"email": "agampreet628@gmail.com",
"url": "https://agam778.github.io/"
},
"license": "MIT",
"devDependencies": {
"electron": "^12.0.0",
"electron-builder": "^22.10.5"
},
"dependencies": {
"electron-updater": "^4.3.8"
}
}

0
renderer.js Normal file
View File

62
update.html Normal file
View File

@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Check for Updates...</title>
<style>
@import url('https://fonts.googleapis.com/css?family=Roboto:700');
body {
margin:0px;
font-family:'Roboto';
text-align:center;
}
p {
position:fixed;
width:100%;
bottom:30px;
font-size:12px;
color:#999;
margin-top:200px;
}
.button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
}
.button1 {
background-color: white;
color: black;
border: 2px solid #4CAF50;
}
.button1:hover {
background-color: #4CAF50;
color: white;
}
</style>
</head>
<body>
<center>
<br>
<img alt="Intro Image" src="./Intro Image.png" width="420" height="210">
<br><br><br>
<h2>You are currently running v1.0.0</h2>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://rawgit.com/hippich/bower-semver/master/semver.min.js"></script>
<font size="6">Latest Release: <span id="result"></span></font><br><br><br>
<a href="https://github.com/agam778/Microsoft-Office-Electron/releases" target="_blank"><button class="button button1">Click Here to Download <span id="result"></span></button></a>
<script src="./updatescript.js"></script>
</center>
</body>
</html>

8
updater.html Normal file
View File

@@ -0,0 +1,8 @@
<html>
<head>
<title>Check for Updates...</title>
</head>
<body>
<center>
<iframe src="update.html" style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;">
</html>

7
updatescript.js Normal file
View File

@@ -0,0 +1,7 @@
const gitHubPath = 'agam778/Microsoft-Office-Electron';
const url = 'https://api.github.com/repos/' + gitHubPath + '/tags';
$.get(url).done(data => {
const versions = data.sort((v1, v2) => semver.compare(v2.name, v1.name));
$('#result').html(versions[0].name);
});