Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarneo committed May 11, 2016
0 parents commit 373daf8
Show file tree
Hide file tree
Showing 12 changed files with 270 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
9 changes: 9 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "vgno",
"rules": {
"no-console": "off"
},
"env": {
"es6": true
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/node_modules/
npm-debug.log
dist/
todo.txt
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Bjarne Øverli

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.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# instatine
#### Unofficial Instagram electron desktop application

![http://i.imgur.com/umtJjF7.png](http://i.imgur.com/umtJjF7.png)

OS X, Windows and Linux support.

## Keyboard shortcuts
Go back: `ctrl+backspace`, OSX: `cmd+backspace`
Refresh: `ctrl+R`, OSX: `cmd+R`
Get current url: `ctrl+L`, OSX: `cmd+L`

## Download
[Latest release](https://github.com/bjarneo/instatine/releases/latest)

## Icon for linux
If you want an icon for the app, create a file in ~/.local/share/applications named
instatine.desktop with:
```
[Desktop Entry]
Name=HNU
Exec=/full/path/to/folder/instatine
Terminal=false
Type=Application
Icon=/full/path/to/icon/Icon.png
```
Icon you need to download: [Icon.png](https://github.com/bjarneo/instatine/blob/master/media/Icon.png)

## Manually

```bash
# Clone this repository
git clone https://github.com/bjarneo/instatine
# Go into the repository
cd instatine
# Install dependencies and run the app
npm install && npm start
```

Inspiration
------
Heavily inspired by [anatine](https://github.com/sindresorhus/anatine/) and idea based on [this discussion](https://github.com/sindresorhus/anatine/issues/28).

Contribution
------
Contributions are appreciated.

License
------
MIT-licensed. See LICENSE.

<div>Icons made by <a href="http://www.flaticon.com/authors/coucou" title="Coucou">Coucou</a> from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div>
62 changes: 62 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
'use strict';

const path = require('path');
const fs = require('fs');
const { app, BrowserWindow, shell, Menu } = require('electron');
const root = path.join(path.dirname(fs.realpathSync(__filename)));

let mainWindow;

Menu.setApplicationMenu(require('./src/menu'));

function createWindow() {
mainWindow = new BrowserWindow({
width: 1000,
height: 900,
title: 'Unofficial Instagram',
icon: process.platform === 'linux' && path.join(__dirname, 'media', 'Icon.png')
});

mainWindow.loadURL('https://www.instagram.com/');

mainWindow.on('closed', () => {
mainWindow = null;
});

const page = mainWindow.webContents;

page.on('will-navigate', (e, url) => {
if (url.indexOf('instagram.com') === -1) {
e.preventDefault();

shell.openExternal(url);
}
});

page.on('dom-ready', () => {
page.insertCSS(fs.readFileSync(path.join(root, 'styles.css'), 'utf8'));

mainWindow.show();
});

page.on('new-window', (e, url) => {
e.preventDefault();

shell.openExternal(url);
});
}

app.on('ready', createWindow);

// Quit when all windows are closed.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});

app.on('activate', () => {
if (mainWindow === null) {
createWindow();
}
});
Binary file added media/Icon.icns
Binary file not shown.
Binary file added media/Icon.ico
Binary file not shown.
Binary file added media/Icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "instatine",
"version": "0.1.0",
"description": "Instagram to electron port",
"main": "main.js",
"private": true,
"scripts": {
"start": "electron main.js",
"lint": "eslint .",
"build": "npm run build:linux && npm run build:windows",
"build:linux": "NODE_ENV=production electron-packager . --overwrite --asar --out=dist --prune --platform=linux --arch=x64 --app-bundle-id=com.bjarneoeverli.instatine --app-version=$npm_package_version && cd dist/instatine-linux-x64/ && zip -ryq9 ../instatine-linux-${npm_package_version}.zip *",
"build:windows": "NODE_ENV=production electron-packager . --overwrite --asar --out=dist --ignore='^/media/(?!Icon.*ico$).*' --prune --platform=win32 --arch=ia32 --icon=media/Icon.ico --version-string.ProductName=$npm_package_productName --app-version=$npm_package_version && cd dist/instatine-win32-ia32 && zip -ryq9 ../instatine-windows-${npm_package_version}.zip *",
"build:osx": "electron-packager . --overwrite --asar --out=dist --ignore='^/media/(?!Icon.icns$).*' --prune --platform=darwin --arch=x64 --icon=media/Icon.icns --app-bundle-id=com.bjarneoeverli.instatine --app-version=$npm_package_version && cd dist/instatine-darwin-x64 && zip -ryXq9 ../instatine-osx-${npm_package_version}.zip instatine.app"
},
"repository": {
"type": "git",
"url": "git+https://github.com/bjarneo/instatine.git"
},
"keywords": [
"instagram",
"electron",
"desktop",
"application"
],
"author": {
"name": "Bjarne Oeverli",
"email": "bjarne.oeverli@gmail.com",
"url": "bjarneo.codes"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/bjarneo/instatine/issues"
},
"homepage": "https://github.com/bjarneo/instatine#readme",
"devDependencies": {
"electron-packager": "7.0.0",
"electron-prebuilt": "0.37.8",
"eslint": "2.9.0",
"eslint-config-vgno": "6.0.0"
}
}
54 changes: 54 additions & 0 deletions src/menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
'use strict';

const { dialog, shell, Menu } = require('electron');

const tpl = [
{
label: 'View',
submenu: [
{
label: 'Copy link',
accelerator: 'CmdOrCtrl+L',
click: (item, focusedWindow) => {
dialog.showMessageBox(focusedWindow, {
type: 'none',
buttons: ['close'],
title: 'Fetch current URL',
message: focusedWindow.webContents.getURL()
});
}
},
{
label: 'Go back',
accelerator: 'CmdOrCtrl+backspace',
click: (item, focusedWindow) => {
if (focusedWindow.webContents.canGoBack()) {
focusedWindow.webContents.goBack();
}
}
},
{
label: 'Reload',
accelerator: 'CmdOrCtrl+R',
click: (item, focusedWindow) => {
if (focusedWindow) {
focusedWindow.webContents.reloadIgnoringCache();
}
}
}
]
},
{
label: 'Help',
submenu: [
{
label: 'Website',
click() {
shell.openExternal('https://github.com/bjarneo/instatine');
}
}
]
}
];

module.exports = Menu.buildFromTemplate(tpl);
14 changes: 14 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
::-webkit-scrollbar {
width: 5px;
}

::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 3px rgba(0,0,0,0.3);
border-radius: 1px;
}

::-webkit-scrollbar-thumb {
background: #444;
border-radius: 1px;
-webkit-box-shadow: inset 0 0 3px rgba(0,0,0,0.3);
}

0 comments on commit 373daf8

Please sign in to comment.