agam778 / MS-365-Electron

Unofficial Microsoft 365 Web Desktop Wrapper made with Electron
https://agam778.github.io/MS-365-Electron
MIT License
267 stars 22 forks source link

Question #8

Closed gabriel-maxx closed 2 years ago

gabriel-maxx commented 2 years ago

hello, I would like to know if there is any trick to make it work offline even if I have to download some additional stuff...

agam778 commented 2 years ago

Actually, it isn't possible as Microsoft Office (their website) cannot work offline 😢

gabriel-maxx commented 2 years ago

Actually, it isn't possible as Microsoft Office (their website) cannot work offline 😢

OK thank you for answering

KaKi87 commented 1 year ago

Hello there,

I'm studying the possibility of making Office Online work offline, here are my notes :

The most important Office Online URL seems to be https://onedrive.live.com/edit.aspx?resid=<ResourceId>, which first body element is a script containing, among other things, the following data :

{
    "WacApplication": "",
    "PageTitle": "",
    "WacBootstrapperUrl": "",
    "HostName": "OneDrive",
    "HostSessionId": "",
    "UserId": "",
    "OwnerId": "",
    "ApplicationUrl": "",
    "ResourceId": "",
    "ETag": "",
    "FileName": "",
    "FileGetUrl": "",
    "FileGetUrlExpiry": 0,
    "FileSize": 0,
    "ReadOnly": 0,
    "ViewOnly": 0,
    "AppEnabled": 1,
    "WopiSrc": "https://wopi.onedrive.com/wopi/files/<ResourceId>",
    "AccessToken": "",
    "AccessTokenExpiry": 0,
    "HostFlights": {}
}

Where :

Using Electron's interceptBufferProtocol method, it is possible to make any request fired from any Electron-wrapped webapp reply whatever we want, including the abovementioned data, e.g. to make Office Online open offline resources.

I've made this work once with a much simpler MS App, that is the Graph Explorer, but I think it could also be done here.

KaKi87 commented 1 year ago

Additionally, the ApplicationUrl value is used to spawn an iframe at onedrive.live.com, which parameters look related to something called the WOPI prototocol, allowing Microsoft & partners to embed Office Online into a parent app (in this case, OneDrive).

Instead of wrapping onedrive.live.com, maybe that value URL itself could be wrapped, leveraging said protocol.