diff --git a/bundles/org.openhab.ui.basic/gulpfile.js b/bundles/org.openhab.ui.basic/gulpfile.js index 1667955636..58e75b430b 100644 --- a/bundles/org.openhab.ui.basic/gulpfile.js +++ b/bundles/org.openhab.ui.basic/gulpfile.js @@ -33,6 +33,11 @@ .pipe(gulp.dest("./src/main/resources/web")); }); + gulp.task("tile", function() { + return gulp.src("web-src/tile.png") + .pipe(gulp.dest("./src/main/resources/web")); + }); + gulp.task("eslint", function() { return gulp.src(sources.js) .pipe(eslint({ @@ -48,5 +53,5 @@ .pipe(gulp.dest("./src/main/resources/web")); }); - gulp.task("default", gulp.parallel("css", "copyFontLibs", gulp.series("eslint", "js"))); + gulp.task("default", gulp.parallel("css", "tile", "copyFontLibs", gulp.series("eslint", "js"))); })(); diff --git a/bundles/org.openhab.ui/web/src/res/img/basicui.png b/bundles/org.openhab.ui.basic/web-src/tile.png similarity index 100% rename from bundles/org.openhab.ui/web/src/res/img/basicui.png rename to bundles/org.openhab.ui.basic/web-src/tile.png diff --git a/bundles/org.openhab.ui/web/.eslintrc.js b/bundles/org.openhab.ui/web/.eslintrc.js index d8ee6f16e5..c8011e51d4 100644 --- a/bundles/org.openhab.ui/web/.eslintrc.js +++ b/bundles/org.openhab.ui/web/.eslintrc.js @@ -31,7 +31,8 @@ module.exports = { 'ga': true, // Google Analytics 'cordova': true, '__statics': true, - 'process': true + 'process': true, + 'baseUrl': true }, // add your custom rules here diff --git a/bundles/org.openhab.ui/web/build/webpack.config.js b/bundles/org.openhab.ui/web/build/webpack.config.js index f77dd59c91..b641fcfb2b 100644 --- a/bundles/org.openhab.ui/web/build/webpack.config.js +++ b/bundles/org.openhab.ui/web/build/webpack.config.js @@ -20,7 +20,7 @@ const target = process.env.TARGET || 'web' const buildSourceMaps = process.env.SOURCE_MAPS || false const isCordova = target === 'cordova' -const apiBaseUrl = process.env.OH_APIBASE || 'http://localhost:8080' +const apiBaseUrl = process.env.OH_APIBASE || 'http://hubsibase:8080' module.exports = { mode: env, @@ -48,12 +48,15 @@ module.exports = { // compress: true, contentBase: '/www/', disableHostCheck: true, - historyApiFallback: true, + historyApiFallback: { index: '/proxypath/' }, + publicPath: '/proxypath/', + headers: { "Set-Cookie": "X-OPENHAB-BASEURL=/proxypath;" }, // watchOptions: { // poll: 1000, // }, proxy: [{ - context: ['/auth', '/rest', '/chart', '/proxy', '/icon', '/static', '/changePassword', '/createApiToken'], + context: ['/proxypath/auth', '/proxypath/rest', '/proxypath/chart', '/proxypath/proxy', '/proxypath/icon', '/proxypath/static', '/proxypath/changePassword', '/proxypath/createApiToken', '/proxypath/habpanel', '/proxypath/basicui'], + pathRewrite: { '^/proxypath' : '' }, target: apiBaseUrl }] }, @@ -204,7 +207,7 @@ module.exports = { new HtmlWebpackPlugin({ filename: './index.html', template: './src/index.html', - inject: true, + inject: false, minify: env === 'production' ? { collapseWhitespace: true, removeComments: true, @@ -219,8 +222,8 @@ module.exports = { }), new CopyWebpackPlugin([ { - from: resolvePath('src/res'), - to: resolvePath(isCordova ? 'cordova/www/res' : 'www/res') + from: resolvePath('src/images'), + to: resolvePath(isCordova ? 'cordova/www/images' : 'www/images') }, { from: resolvePath('src/manifest.json'), diff --git a/bundles/org.openhab.ui/web/src/components/app.vue b/bundles/org.openhab.ui/web/src/components/app.vue index b107de8124..4bf08aa550 100644 --- a/bundles/org.openhab.ui/web/src/components/app.vue +++ b/bundles/org.openhab.ui/web/src/components/app.vue @@ -307,6 +307,7 @@ export default { iosSwipeBack: !this.$device.ios || this.$device.cordova, auroraSwipeBack: !this.$device.ios || this.$device.cordova, pushState: true, // !this.$device.cordova + pushStateRoot: baseUrl, pushStateSeparator: '' }, // Enable panel left visibility breakpoint @@ -510,7 +511,7 @@ export default { this.cleanSession().then(() => { this.loggedIn = false this.$f7.views.main.router.navigate('/', { animate: false, clearPreviousHistory: true }) - window.location = window.location.origin + window.location = window.location.origin + baseUrl + '/' if (this.$device.cordova) { this.loginScreenOpened = true } diff --git a/bundles/org.openhab.ui/web/src/components/auth-mixin.js b/bundles/org.openhab.ui/web/src/components/auth-mixin.js index 7d9c6920ea..95c1033805 100644 --- a/bundles/org.openhab.ui/web/src/components/auth-mixin.js +++ b/bundles/org.openhab.ui/web/src/components/auth-mixin.js @@ -31,8 +31,8 @@ export default { const payload = Utils.serializeObject({ 'grant_type': 'authorization_code', - 'client_id': window.location.origin, - 'redirect_uri': window.location.origin, + 'client_id': window.location.origin + baseUrl, + 'redirect_uri': window.location.origin + baseUrl + '/', 'code': queryParams.code, 'code_verifier': codeVerifier }) @@ -65,8 +65,8 @@ export default { const refreshToken = this.getRefreshToken() const payload = Utils.serializeObject({ 'grant_type': 'refresh_token', - 'client_id': window.location.origin, - 'redirect_uri': window.location.origin, + 'client_id': window.location.origin + baseUrl, + 'redirect_uri': window.location.origin + baseUrl + '/', 'refresh_token': refreshToken }) diff --git a/bundles/org.openhab.ui/web/src/components/widgets/system/oh-icon.vue b/bundles/org.openhab.ui/web/src/components/widgets/system/oh-icon.vue index df3857627e..c1ddbba5fd 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/system/oh-icon.vue +++ b/bundles/org.openhab.ui/web/src/components/widgets/system/oh-icon.vue @@ -89,8 +89,8 @@ export default { updateIcon () { if (!this.currentIcon) return this.$oh.media.getIcon(this.currentIcon, this.iconFormat, this.currentState).then((url) => { - if (url !== this.iconUrl) { - this.iconUrl = url + if (baseUrl + url !== this.iconUrl) { + this.iconUrl = baseUrl + url } }) } diff --git a/bundles/org.openhab.ui/web/src/css/icons.css b/bundles/org.openhab.ui/web/src/css/icons.css index f3c1e7645f..cad1ffa3b1 100644 --- a/bundles/org.openhab.ui/web/src/css/icons.css +++ b/bundles/org.openhab.ui/web/src/css/icons.css @@ -5,9 +5,9 @@ font-weight: 400; src: local('Material Icons'), local('MaterialIcons-Regular'), - url(../fonts/MaterialIcons-Regular.woff2) format('woff2'), - url(../fonts/MaterialIcons-Regular.woff) format('woff'), - url(../fonts/MaterialIcons-Regular.ttf) format('truetype'); + url("../fonts/MaterialIcons-Regular.woff2") format('woff2'), + url("../fonts/MaterialIcons-Regular.woff") format('woff'), + url("../fonts/MaterialIcons-Regular.ttf") format('truetype'); } .material-icons { font-family: 'Material Icons'; diff --git a/bundles/org.openhab.ui/web/src/res/icons/128x128.png b/bundles/org.openhab.ui/web/src/images/icons/128x128.png similarity index 100% rename from bundles/org.openhab.ui/web/src/res/icons/128x128.png rename to bundles/org.openhab.ui/web/src/images/icons/128x128.png diff --git a/bundles/org.openhab.ui/web/src/res/icons/144x144.png b/bundles/org.openhab.ui/web/src/images/icons/144x144.png similarity index 100% rename from bundles/org.openhab.ui/web/src/res/icons/144x144.png rename to bundles/org.openhab.ui/web/src/images/icons/144x144.png diff --git a/bundles/org.openhab.ui/web/src/res/icons/152x152.png b/bundles/org.openhab.ui/web/src/images/icons/152x152.png similarity index 100% rename from bundles/org.openhab.ui/web/src/res/icons/152x152.png rename to bundles/org.openhab.ui/web/src/images/icons/152x152.png diff --git a/bundles/org.openhab.ui/web/src/res/icons/192x192.png b/bundles/org.openhab.ui/web/src/images/icons/192x192.png similarity index 100% rename from bundles/org.openhab.ui/web/src/res/icons/192x192.png rename to bundles/org.openhab.ui/web/src/images/icons/192x192.png diff --git a/bundles/org.openhab.ui/web/src/res/icons/256x256.png b/bundles/org.openhab.ui/web/src/images/icons/256x256.png similarity index 100% rename from bundles/org.openhab.ui/web/src/res/icons/256x256.png rename to bundles/org.openhab.ui/web/src/images/icons/256x256.png diff --git a/bundles/org.openhab.ui/web/src/res/icons/512x512.png b/bundles/org.openhab.ui/web/src/images/icons/512x512.png similarity index 100% rename from bundles/org.openhab.ui/web/src/res/icons/512x512.png rename to bundles/org.openhab.ui/web/src/images/icons/512x512.png diff --git a/bundles/org.openhab.ui/web/src/res/icons/apple-touch-icon.png b/bundles/org.openhab.ui/web/src/images/icons/apple-touch-icon.png similarity index 100% rename from bundles/org.openhab.ui/web/src/res/icons/apple-touch-icon.png rename to bundles/org.openhab.ui/web/src/images/icons/apple-touch-icon.png diff --git a/bundles/org.openhab.ui/web/src/res/icons/favicon.svg b/bundles/org.openhab.ui/web/src/images/icons/favicon.svg similarity index 100% rename from bundles/org.openhab.ui/web/src/res/icons/favicon.svg rename to bundles/org.openhab.ui/web/src/images/icons/favicon.svg diff --git a/bundles/org.openhab.ui/web/src/index.html b/bundles/org.openhab.ui/web/src/index.html index 756e93531b..38d27a0de7 100644 --- a/bundles/org.openhab.ui/web/src/index.html +++ b/bundles/org.openhab.ui/web/src/index.html @@ -21,18 +21,29 @@ <% if (process.env.TARGET === 'web') { %> - - - - + + + + <% } %> +
<% if (process.env.TARGET === 'cordova') { %> <% } %> - +