mirror of
https://github.com/pierre42100/ComunicDesktop
synced 2025-04-19 23:20:54 +00:00
Compare commits
No commits in common. "master" and "0.2.0" have entirely different histories.
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
node_modules/*
|
|
14
Config.js
14
Config.js
@ -1,14 +0,0 @@
|
|||||||
/**
|
|
||||||
* Project configuration
|
|
||||||
*/
|
|
||||||
|
|
||||||
const Config = {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* URL to access to Comunic
|
|
||||||
*/
|
|
||||||
access_url: 'https://comunic.io'
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Config;
|
|
2
LICENSE
2
LICENSE
@ -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
|
||||||
|
@ -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
|
||||||
|
5
app.css
5
app.css
@ -1,5 +0,0 @@
|
|||||||
/**
|
|
||||||
* Comunic WebApp custom stylesheet
|
|
||||||
*
|
|
||||||
* @author Comunic authors
|
|
||||||
*/
|
|
BIN
icon.png
BIN
icon.png
Binary file not shown.
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 12 KiB |
75
index.js
75
index.js
@ -1,14 +1,69 @@
|
|||||||
/**
|
const electron = require('electron');
|
||||||
* Application main script
|
const BrowserWindow = electron.BrowserWindow;
|
||||||
*
|
const {app, Menu, Tray} = require('electron')
|
||||||
* @author The Comunic Authors
|
|
||||||
*/
|
|
||||||
|
|
||||||
const {app} = require('electron');
|
let mainWindow
|
||||||
|
let tray = null
|
||||||
|
|
||||||
const MainWindow = require("./modules/MainWindow");
|
function main(){
|
||||||
|
mainWindow = new BrowserWindow({
|
||||||
|
icon:'icon.png',
|
||||||
|
webPreferences :{
|
||||||
|
nodeIntegration :false
|
||||||
|
},
|
||||||
|
show: false
|
||||||
|
});
|
||||||
|
mainWindow.maximize();
|
||||||
|
//createWindow --> create the window
|
||||||
|
mainWindow.loadURL('https://comunic.io');
|
||||||
|
//set the url who must be open
|
||||||
|
|
||||||
|
mainWindow.on('closed', () =>{
|
||||||
|
mainWindow = null;
|
||||||
|
});
|
||||||
|
//To close the window
|
||||||
|
|
||||||
|
tray = new Tray('./icon.png');
|
||||||
|
|
||||||
|
tray.setToolTip('Comunic');
|
||||||
|
|
||||||
|
|
||||||
|
tray.setContextMenu(menu_1);
|
||||||
|
|
||||||
|
console.log("Started succesfully");
|
||||||
|
|
||||||
|
mainWindow.once('ready-to-show', () => {
|
||||||
|
mainWindow.show()
|
||||||
|
})
|
||||||
|
};
|
||||||
|
const menu_1 = Menu.buildFromTemplate([{
|
||||||
|
label: "Ouvrir la version stable",
|
||||||
|
click: () => {
|
||||||
|
mainWindow.loadURL('https://communiquons.org');
|
||||||
|
tray.setContextMenu(menu_2)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label : 'Quit',
|
||||||
|
click: () => {
|
||||||
|
app.quit();
|
||||||
|
console.log("Closed");
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
const menu_2 = Menu.buildFromTemplate([{
|
||||||
|
label: "Ouvrir la nouvelle version",
|
||||||
|
click: () =>{
|
||||||
|
mainWindow.loadURL('https://comunic.io');
|
||||||
|
tray.setContextMenu(menu_1)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'Quit',
|
||||||
|
click: () => {
|
||||||
|
app.quit();
|
||||||
|
console.log("Closed");
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
console.log("Starting...");
|
console.log("Starting...");
|
||||||
app.on('ready', () => {
|
app.on('ready', main);
|
||||||
MainWindow.show();
|
|
||||||
});
|
|
||||||
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
]
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
}
|
|
@ -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);");
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
@ -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
1210
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -4,13 +4,12 @@
|
|||||||
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user