webui: integrate new webui in unix build process

This commit is contained in:
zeners 2016-03-24 00:33:22 +01:00
parent a19a068339
commit cef07fff91
8 changed files with 242 additions and 4 deletions

View File

@ -13,13 +13,23 @@ CONFIG += libmicrohttpd
INCLUDEPATH += ../../libretroshare/src
unix {
webui_files.path = "$${DATA_DIR}/webui"
webui_files.files = webfiles/*
INSTALLS += webui_files
webui_files.path = "$${DATA_DIR}/webui"
webui_files.files = webui-src/public-gen/app.js
webui_files.files += webui-src/public-gen/app.css
webui_files.files += webui-src/public-gen/index.html
INSTALLS += webui_files
webui_img_files.path = "$${DATA_DIR}/webui/img"
webui_img_files.files = ../../retroshare-gui/src/gui/images/logo/logo_splash.png
INSTALLS += webui_img_files
create_webfiles.commands = sh $$_PRO_FILE_PWD_/webui-src/make-src/build.sh $$_PRO_FILE_PWD_/webui-src
QMAKE_EXTRA_TARGETS += create_webfiles
PRE_TARGETDEPS += create_webfiles
system($$create_webfiles.commands)
}
win32{

View File

@ -1,2 +1,3 @@
node_modules/*
public/*
public-gen/*

View File

@ -56,3 +56,4 @@ need 4 master
[X] unsubscribe lobby
[X] unread chat message counter in menu
[X] list chat-lobby participants
[ ] creating app.js on build (no need for npm on regulary build)

View File

@ -1,4 +1,4 @@
rs=require("retroshare");
var rs=require("retroshare");
module.exports = { nodes: [
{
name: "home",

View File

@ -0,0 +1,40 @@
#!/usr/bin/sh
echo $1
if [ "$1" == "" ];then
publicdest=../public-gen
src=..
else
publicdest=$1/public-gen
src=$1
fi
echo $publicdest
if [ -d "$publicdest" ]; then
echo remove $publicdest
rm $publicdest -R
fi
echo mkdir $publicdest
mkdir $publicdest
echo copy template.js ...
cp $src/make-src/template.js $publicdest/app.js
for filename in $src/app/*.js; do
fname=$(basename "$filename")
fname="${fname%.*}"
echo adding $fname ...
echo require.register\(\"$fname\", function\(exports, require, module\) { >> $publicdest/app.js
cat $filename >> $publicdest/app.js
echo >> $publicdest/app.js
echo }\)\; >> $publicdest/app.js
done
echo building app.css
cat $src/app/green-black.scss >> $publicdest/app.css
cat $src/make-src/main.css >> $publicdest/app.css
cat $src/make-src/chat.css >> $publicdest/app.css
echo copy index.html
cp $src/app/assets/index.html $publicdest/index.html
echo build.sh complete

View File

@ -0,0 +1,72 @@
.chat {
padding: 15px; }
.chat.container {
height: 100%;
padding: 0px;
position: relative;
box-sizing: border-box; }
.chat.header {
position: absolute;
top: 0px;
left: 0px;
right: 0px;
height: 50px;
background-color: black;
border-bottom: solid 1px gray;
box-sizing: border-box; }
.chat.left {
position: absolute;
top: 50px;
bottom: 0px;
left: 0px;
width: 200px;
box-sizing: border-box;
background-color: black; }
.chat.right {
position: absolute;
top: 50px;
right: 0px;
bottom: 0px;
width: 200px;
box-sizing: border-box; }
.chat.middle {
position: absolute;
top: 0px;
margin-top: 50px;
left: 200px;
right: 200px;
box-sizing: border-box;
padding: 0px;
height: 100%;
overflow-y: scroll; }
.chat.bottom {
position: absolute;
bottom: 0px;
right: 200px;
left: 200px;
padding: 5px; }
.chat.msg {
padding: 0px; }
.chat.msg.container {
position: relative;
border-bottom: solid 1px lightgray;
padding: 10px;
height: unset; }
.chat.msg.from {
position: absolute;
width: 100px;
top: 10px;
left: 0px;
color: white;
text-align: right; }
.chat.msg.when {
float: right;
color: lightgray;
margin-bottom: 10px; }
.chat.msg.text {
padding-left: 100px;
top: 0px;
left: 100px;
white-space: pre-wrap;
height: initial; }

View File

@ -0,0 +1,2 @@
html, body, #main {
height: 100%; }

View File

@ -0,0 +1,112 @@
(function() {
'use strict';
var globals = typeof window === 'undefined' ? global : window;
if (typeof globals.require === 'function') return;
var modules = {};
var cache = {};
var aliases = {};
var has = ({}).hasOwnProperty;
var endsWith = function(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
};
var _cmp = 'components/';
var unalias = function(alias, loaderPath) {
var start = 0;
if (loaderPath) {
if (loaderPath.indexOf(_cmp) === 0) {
start = _cmp.length;
}
if (loaderPath.indexOf('/', start) > 0) {
loaderPath = loaderPath.substring(start, loaderPath.indexOf('/', start));
}
}
var result = aliases[alias + '/index.js'] || aliases[loaderPath + '/deps/' + alias + '/index.js'];
if (result) {
return _cmp + result.substring(0, result.length - '.js'.length);
}
return alias;
};
var _reg = /^\.\.?(\/|$)/;
var expand = function(root, name) {
var results = [], part;
var parts = (_reg.test(name) ? root + '/' + name : name).split('/');
for (var i = 0, length = parts.length; i < length; i++) {
part = parts[i];
if (part === '..') {
results.pop();
} else if (part !== '.' && part !== '') {
results.push(part);
}
}
return results.join('/');
};
var dirname = function(path) {
return path.split('/').slice(0, -1).join('/');
};
var localRequire = function(path) {
return function expanded(name) {
var absolute = expand(dirname(path), name);
return globals.require(absolute, path);
};
};
var initModule = function(name, definition) {
var module = {id: name, exports: {}};
cache[name] = module;
definition(module.exports, localRequire(name), module);
return module.exports;
};
var require = function(name, loaderPath) {
var path = expand(name, '.');
if (loaderPath == null) loaderPath = '/';
path = unalias(name, loaderPath);
if (has.call(cache, path)) return cache[path].exports;
if (has.call(modules, path)) return initModule(path, modules[path]);
var dirIndex = expand(path, './index');
if (has.call(cache, dirIndex)) return cache[dirIndex].exports;
if (has.call(modules, dirIndex)) return initModule(dirIndex, modules[dirIndex]);
throw new Error('Cannot find module "' + name + '" from '+ '"' + loaderPath + '"');
};
require.alias = function(from, to) {
aliases[to] = from;
};
require.register = require.define = function(bundle, fn) {
if (typeof bundle === 'object') {
for (var key in bundle) {
if (has.call(bundle, key)) {
modules[key] = bundle[key];
}
}
} else {
modules[bundle] = fn;
}
};
require.list = function() {
var result = [];
for (var item in modules) {
if (has.call(modules, item)) {
result.push(item);
}
}
return result;
};
require.brunch = true;
require._cache = cache;
globals.require = require;
})();