Skip to content

Commit

Permalink
Fix issues#3
Browse files Browse the repository at this point in the history
  • Loading branch information
ChugunovRoman committed Jul 1, 2018
1 parent cb155b9 commit 6e86645
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 19 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions config/builder.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"appId": "figma-linux",
"productName": "figma-linux",
"extraMetadata": "main/main.js",
"icon": "resources",
"icon": "resources/256x256.png",
"files": [
"**/*"
],
Expand All @@ -18,7 +18,7 @@

"linux": {
"description": "Unofficial desktop application for linux",
"icon": "resources/figma256.png",
"icon": "resources/256x256.png",
"category": "Graphic",
"depends": [
"libgconf2-4"
Expand Down
2 changes: 1 addition & 1 deletion package.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "figma-linux",
"version": "0.0.4",
"version": "0.0.4-2",
"description": "Figma is the first interface design tool based in the browser, making it easier for teams to create software.",
"main": "src/main/index.js",
"repository": "git@github.com:ChugunovRoman/figma-linux.git",
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified src/index.html
100644 → 100755
Empty file.
Empty file modified src/main/Args.ts
100644 → 100755
Empty file.
34 changes: 23 additions & 11 deletions src/main/index.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
shell,
app,
net,
session,
Expand Down Expand Up @@ -27,23 +26,29 @@ const winOptions: Electron.BrowserWindowConstructorOptions = {
}
};

app.on('browser-window-created', (event, window) => {
window.setMenu(null);
});

app.on('ready', () => {
let window = new BrowserWindow(winOptions);

window.loadURL(HOME);
window.loadURL(`${HOME}/login`);
// console.log(`load url: ${HOME}/login`);


window.webContents.on('will-navigate', (event, url) => {
const parts = url.split("/");
if (parts[0] + "//" + parts[2] != HOME) {
event.preventDefault()
shell.openExternal(url)
};
});
// window.webContents.on('will-navigate', (event, url) => {
// const parts = url.split("/");

// if (parts[0] + "//" + parts[2] != HOME) {
// event.preventDefault();
// shell.openExternal(url);
// };
// });

shorcuts(window);
menu(window);


window.webContents.on('will-navigate', (event, newUrl) => {
const currentUrl = event.sender.getURL();

Expand All @@ -62,6 +67,8 @@ app.on('ready', () => {
return;
}

console.log('will-navigate event, to: ', to);

if (to.pathname === '/logout') {
net.request(`${HOME}/logout`).on('response', response => {
response.on('data', chunk => {});
Expand All @@ -81,8 +88,13 @@ app.on('ready', () => {
app.quit();
});
}

if (response.statusCode >= 400) {
session.defaultSession!.clearStorageData();
window.webContents.loadURL(`${HOME}/login`);
}
});
}).end();;
}).end();

event.preventDefault();
return;
Expand Down
3 changes: 2 additions & 1 deletion src/main/menu.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default (window: BrowserWindow) => {
}
}));

Menu.setApplicationMenu(menu);
window.setMenu(menu);
// Menu.setApplicationMenu(menu);
window.setMenuBarVisibility(false);
}
Empty file modified src/main/shortcuts.ts
100644 → 100755
Empty file.
4 changes: 1 addition & 3 deletions src/package.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "figma-linux",
"version": "0.0.4",
"version": "0.0.4-2",
"description": "Figma is the first interface design tool based in the browser, making it easier for teams to create software.",
"main": "main/main.js",
"repository": "git@github.com:ChugunovRoman/figma-linux.git",
Expand All @@ -11,8 +11,6 @@
"start": "electron main/main.js"
},
"dependencies": {
"raven": "^2.4.1",
"raven-js": "^3.22.3",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-redux": "^5.0.6",
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/index.tsx
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { render } from 'react-dom';

render(
<h1>Figma</h1>,
document.getElementById('root')
document.getElementById('app')
);

Empty file modified yarn.lock
100644 → 100755
Empty file.

0 comments on commit 6e86645

Please sign in to comment.