Compare commits

..

No commits in common. "master" and "0.1.1b" have entirely different histories.

12 changed files with 30 additions and 1476 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
node_modules/*

View File

@ -1,14 +0,0 @@
/**
* Project configuration
*/
const Config = {
/**
* URL to access to Comunic
*/
access_url: 'https://comunic.io'
}
module.exports = Config;

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2018 The Comunic Project Copyright (c) 2018 Pierre Hubert
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -3,7 +3,7 @@
## Using for dev ## Using for dev
Please make sure you have installed npm on your computer. Please make sure you have installed npm on your computer.
git clone https://github.com/pierre42100/ComunicDesktop.git git clone https://github.com/pierre42100/ComunicDesktop
npm i --save electron npm i --save electron
npm install npm install
electron index.js electron index.js

View File

@ -1,5 +0,0 @@
/**
* Comunic WebApp custom stylesheet
*
* @author Comunic authors
*/

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,14 +1,28 @@
/** const electron = require('electron');
* Application main script const app = electron.app;
* const BrowserWindow = electron.BrowserWindow;
* @author The Comunic Authors
*/
const {app} = require('electron'); let mainWindow
const MainWindow = require("./modules/MainWindow"); function createWindow() {
mainWindow = new BrowserWindow({
icon:'resources/app/icon.png',
webPreferences: {
nodeIntegration: false,
preload: './preload.js'
}
});
mainWindow.setIco
mainWindow.loadURL('https://beta.communiquons.org/');
console.log("Starting..."); mainWindow.on('closed', () =>{
app.on('ready', () => { mainWindow = null;
MainWindow.show(); });
}
app.on('window-all-closed', () =>{
if(process.platform !== 'darwin'){
app.quit();
}
}); });
app.on('ready', createWindow);

View File

@ -1,136 +0,0 @@
/**
* Application menu
*
* @author Comunic Authors
*/
const {app, Menu} = require('electron');
/**
* Get application menu
*
* @param {BrowserWindow} window
* @return {Menu} Application menu
*/
module.exports.Get = function(window){
/**
* Execute javascript quickly
*/
let js = function(code) {window.webContents.executeJavaScript(code)};
return Menu.buildFromTemplate([
//File menu
{
label: "File",
submenu: [
//Close app
{
label: "Quit",
click: () => {
app.quit();
}
}
]
},
//Shorcuts menu
{
label: "Shorcuts",
submenu: [
//Latest posts
{
label: "Latest posts",
click: () => {
js("openPage('latest');");
}
},
//User page
{
label: "Your page",
click: () => {
js("openPage('user/' + userID());");
}
},
//Conversations
{
label: "Conversations",
click: () => {
js("openPage('conversations');");
}
},
//Groups
{
label: "Groups",
click: () => {
js("openPage('groups');");
}
}
]
},
//Settings menu
{
label: "Settings",
submenu: [
//Dark mode
{
label: "Toggle dark mode",
click: () => {
js("ComunicWeb.components.darkTheme.setEnabled(!ComunicWeb.components.darkTheme.isEnabled());");
}
},
//Incognito mode
{
label: "Enable incognito mode",
sublabel: "F6",
click: () => {
js("ComunicWeb.components.incognito.ui.confirmEnable();");
}
},
//Account settings
{
label: "Account settings",
click: () => {
js("openPage('settings');");
}
}
]
},
//Advanced menu
{
label: "Advanced",
submenu: [
//Dev tools
{
label: "Toggle developer tools",
click: () => {
window.webContents.toggleDevTools();
}
}
]
}
])
}

View File

@ -1,79 +0,0 @@
/**
* Main Window script
*
* @author The Comunic authors
*/
const electron = require('electron');
const BrowserWindow = electron.BrowserWindow;
const {Menu, Tray} = require('electron');
const Config = require("../Config");
const TrayMenu = require("./TrayMenu");
const ApplicationMenu = require("./ApplicationMenu");
const fs = require("fs");
let mainWindow;
let tray = null;
let page_finished_loading = false;
/**
* Show main window
*/
exports.show = function(){
//Create and show main window
mainWindow = new BrowserWindow({
icon:'icon.png',
webPreferences: {
nodeIntegration: false
},
//show: false
});
//mainWindow.maximize();
//set the url which must be open
mainWindow.loadURL(Config.access_url);
mainWindow.on('closed', () =>{
//To close the window
mainWindow = null;
});
//Create tray
tray = new Tray('./icon.png');
tray.setToolTip('Comunic');
tray.setContextMenu(TrayMenu);
console.log("Started successfully");
//Set application menu
Menu.setApplicationMenu(ApplicationMenu.Get(mainWindow));
mainWindow.once('ready-to-show', () => {
mainWindow.show();
});
mainWindow.webContents.on('did-finish-load', function() {
page_finished_loading = true;
//Inject CSS
fs.readFile("./app.css", (err, data) => {
//Check for errors
if(err){
console.error("Error while loading ./app.css: " + err);
return;
}
let style = data.toString();
mainWindow.webContents.executeJavaScript("let style = document.createElement('style');" +
"style.innerHTML = decodeURIComponent(\""+encodeURIComponent(style)+"\");" +
"document.head.appendChild(style);");
});
});
}

View File

@ -1,14 +0,0 @@
/**
* Tray menu
*
* @author Comunic Authors
*/
const {app, Menu} = require('electron');
module.exports = Menu.buildFromTemplate([{
label : 'Close',
click: () => {
app.quit();
console.log("Closed");
}
}]);

1210
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,15 @@
{ {
"name": "communic-desktop", "name": "communic-desktop",
"version": "0.2.0", "version": "0.1.0",
"description": "A client-desktop for communiquons.org", "description": "A client-desktop for communiquons.org",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "electron .", "test": "electron ."
"run": "electron index.js"
}, },
"author": "Team dev communic", "author": "Team dev communic",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"electron": "^3.1.3" "electron": "^2.0.0"
} }
} }