Skip to content

Commit

Permalink
Merge branch 'release/v1.0.0' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Darmody committed Mar 27, 2016
2 parents a72312e + 8bee35f commit 3ca20b2
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 408 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ node_modules
dist
release
build
app
!src/**/app
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ A beautiful mac desktop application for [Douban FM](http://douban.fm)

## Screenshots

<img src="screenshots/screenshot-app.png" alt="screenshot" width="250px" />
<img src="screenshots/screenshot-login.png" alt="screenshot" width="250px" />
<img src="static/screenshots/demo.gif" alt="demo" width="250px" />
<br/>
<img src="static/screenshots/screenshot-app.png" alt="screenshot" width="250px" />
<img src="static/screenshots/screenshot-login.png" alt="screenshot" width="250px" />

## Features

Expand Down
28 changes: 0 additions & 28 deletions app/config.js

This file was deleted.

191 changes: 0 additions & 191 deletions app/main.js

This file was deleted.

43 changes: 0 additions & 43 deletions app/package.json

This file was deleted.

4 changes: 2 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const config = {
height: 728,
resizable: true,
},
url: 'app/app.html'
url: 'src/app.html'
},
production: {
electronStorageKey: 'DOUBAN_PRODUCTION',
Expand All @@ -17,7 +17,7 @@ const config = {
height: 644,
resizable: false,
},
url: 'app.html'
url: 'dist/app.html'
},
test: {
electronStorageKey: 'DOUBAN_TEST',
Expand Down
18 changes: 16 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'production';

const electron = require('electron');
const ipcMain = require('electron').ipcMain;
const storage = require('electron-json-storage');
const app = electron.app;
const globalShortcut = electron.globalShortcut;
Expand Down Expand Up @@ -80,17 +81,30 @@ app.on('ready', () => {
});

storage.set(config.electronStorageKey, { cookies }, (error) => {
if (error) console.log('Douban cookie save to storage error', error);
if (error) console.log('Douban cookie save to storage error:', error);
});
};

const removeDoubanCookies = () => {
storage.remove(config.electronStorageKey, (error) => {
if (error) console.log('storage remove error:', error);
});
webContents.session.cookies.remove('http://douban.fm', 'bid', (error) => {
if (error) console.log('remove electron cookie error:', error);
});
webContents.session.cookies.remove('http://douban.fm', 'dbcl2', (error) => {
if (error) console.log('remove electron cookie error:', error);
});
};

ipcMain.on('logout', removeDoubanCookies);
webContents.on('did-get-response-details', (event, status, newURL, originalURL, code, method, referrer, headers) => {
setDoubanCookies(webContents, originalURL, headers);
});

getDoubanCookies(webContents);

mainWindow.loadURL(`file://${__dirname}/app/app.html`);
mainWindow.loadURL(`file://${__dirname}/${config.url}`);

mainWindow.on('closed', () => {
mainWindow = null;
Expand Down
Loading

0 comments on commit 3ca20b2

Please sign in to comment.