Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
See
https://community.endlessm.com/t/sugarizer-in-endless/2097

Also need to check which of these runtime permissions we might
need to list in the json
        "--device=dri",
        "--filesystem=home",
        "--share=ipc",
        "--share=network",
        "--socket=pulseaudio",
        "--socket=x11"
  • Loading branch information
dsd committed May 26, 2017
0 parents commit 091dfc0
Show file tree
Hide file tree
Showing 8 changed files with 187 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
all:
cd electron && npm install
cd electron && npm run pack

install:
mkdir -p /app/lib/sugarizer
cp -ar dist/*/* /app/lib/sugarizer
ln -sf /app/lib/sugarizer/sugarizer /app/bin/sugarizer
install -D org.sugarizer.Sugarizer.desktop "/app/share/applications/org.sugarizer.Sugarizer.desktop"
install -D icon.png "/app/share/icons/hicolor/64x64/apps/org.sugarizer.Sugarizer.png"

.PHONY: all install
Empty file added configure
Empty file.
7 changes: 7 additions & 0 deletions electron/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"dest": "dist/installers/",
"icon": "resources/icon.png",
"categories": [
"Education"
]
}
68 changes: 68 additions & 0 deletions electron/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
const electron = require('electron')
// Module to control application life.
const app = electron.app
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow

const path = require('path')
const url = require('url')

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow

function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
icon: path.join(__dirname, '/resources/icon.png'),
webPreferences: { nodeIntegration: false }
})

// and load the index.html of the app.
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'sugarizer/index.html'),
protocol: 'file:',
slashes: true
}))

// Open the DevTools.
// mainWindow.webContents.openDevTools()

// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)

// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})

app.on('activate', function () {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})

app.on('browser-window-created',function(e,window) {
window.setMenu(null);
});
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
25 changes: 25 additions & 0 deletions electron/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "sugarizer",
"version": "0.1.0",
"description": "Sugarizer Learning Platform",
"main": "main.js",
"scripts": {
"start": "electron .",
"pack": "electron-packager . sugarizer --platform linux --arch x64 --icon resources/icon.png --out dist/",
"flatpak64": "electron-installer-flatpak --src dist/sugarizer-linux-x64/ --arch x64 --config config.json",
"build": "npm run pack && npm run flatpak64"
},
"keywords": [
"Sugar",
"Learning",
"Education",
"demo"
],
"author": "Manuel Quiñones",
"license": "Apache-2.0",
"devDependencies": {
"electron-installer-flatpak": "*",
"electron-packager": "*",
"electron": "~1.6.2"
}
}
Binary file added electron/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.
66 changes: 66 additions & 0 deletions org.sugarizer.Sugarizer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"app-id": "org.sugarizer.Sugarizer",
"base": "io.atom.electron.BaseApp",
"base-version": "master",
"runtime": "org.freedesktop.Platform",
"runtime-version": "1.4",
"sdk": "org.freedesktop.Sdk",
"command": "sugarizer",
"modules": [
{
"name": "nodejs",
"sources": [
{
"type": "archive",
"url": "https://nodejs.org/dist/v5.12.0/node-v5.12.0.tar.xz",
"path": "node-v5.12.0.tar.xz",
"sha256": "4f926373f11f2a25156eee1804ec012eb912c42e5d34fc2909889da22efdadfe"
}
]
},
{
"name": "sugarizer",
"build-options": {
"build-args": [
"--share=network"
]
},
"sources": [
{
"type": "git",
"url": "https://github.com/llaske/sugarizer.git",
"branch": "v0.8",
"dest": "electron/sugarizer"
},
{
"type": "file",
"path": "electron/package.json"
},
{
"type": "file",
"path": "electron/config.json"
},
{
"type": "file",
"path": "electron/main.js"
},
{
"type": "file",
"path": "electron/resources/icon.png"
},
{
"type": "file",
"path": "Makefile"
},
{
"type": "file",
"path": "configure"
},
{
"type": "file",
"path": "resources/org.sugarizer.Sugarizer.desktop"
}
]
}
]
}
9 changes: 9 additions & 0 deletions resources/org.sugarizer.Sugarizer.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Type=Application
Name=Sugarizer
GenericName=Sugar Learning Platform
Comment=A web implementation of the Sugar platform
Exec=sugarizer
Icon=org.sugarizer.Sugarizer
Terminal=false
Categories=Euducation;

0 comments on commit 091dfc0

Please sign in to comment.