From 185f1e7c6c15314bd1b57bd300796345c7ebb8c5 Mon Sep 17 00:00:00 2001 From: Arnis Vuskans Date: Thu, 3 Oct 2019 01:00:31 +0300 Subject: [PATCH 1/2] proof of concept --- editor/client/app/components/style.scss | 1 + .../ui-route/emulators/hex/component.js | 14 +++++++++ .../ui-route/emulators/hex/style.scss | 17 +++++++++++ .../ui-route/emulators/hex/template.hbs | 3 ++ editor/client/app/router.js | 5 ++++ editor/client/app/routes/emulators/hex.js | 29 +++++++++++++++++++ editor/client/app/templates/emulators/hex.hbs | 1 + 7 files changed, 70 insertions(+) create mode 100644 editor/client/app/components/ui-route/emulators/hex/component.js create mode 100644 editor/client/app/components/ui-route/emulators/hex/style.scss create mode 100644 editor/client/app/components/ui-route/emulators/hex/template.hbs create mode 100644 editor/client/app/routes/emulators/hex.js create mode 100644 editor/client/app/templates/emulators/hex.hbs diff --git a/editor/client/app/components/style.scss b/editor/client/app/components/style.scss index 259c222d..e7bae8dc 100644 --- a/editor/client/app/components/style.scss +++ b/editor/client/app/components/style.scss @@ -17,3 +17,4 @@ @import "ui-route/projects/index/style"; @import "ui-route/projects/new/style"; @import "ui-route/projects/project/index/style"; +@import "ui-route/emulators/hex/style"; diff --git a/editor/client/app/components/ui-route/emulators/hex/component.js b/editor/client/app/components/ui-route/emulators/hex/component.js new file mode 100644 index 00000000..b3ffb1c1 --- /dev/null +++ b/editor/client/app/components/ui-route/emulators/hex/component.js @@ -0,0 +1,14 @@ +import Component from '@ember/component'; +import { computed } from '@ember/object'; + +let base = 'https://felipemanga.github.io/ProjectABE/?skin=BareFit&color=FFFFFF&url=' + +export default Component.extend({ + classNameBindings: [ ':ui-route-emulators-hex' ], + + url: computed('model.url', function() { + let { model: { url } } = this; + return `${base}${encodeURIComponent(url)}`; + }).readOnly(), + +}); diff --git a/editor/client/app/components/ui-route/emulators/hex/style.scss b/editor/client/app/components/ui-route/emulators/hex/style.scss new file mode 100644 index 00000000..9920582c --- /dev/null +++ b/editor/client/app/components/ui-route/emulators/hex/style.scss @@ -0,0 +1,17 @@ +.ui-route-emulators-hex { + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + > .content { + display: flex; + flex-direction: column; + border: 1px solid fade-out(#000, 0.7); + box-shadow: 0 1px 5px fade-out(#000, 0.7); + > .iframe { + width: 512px; + height: 256px; + } + } +} diff --git a/editor/client/app/components/ui-route/emulators/hex/template.hbs b/editor/client/app/components/ui-route/emulators/hex/template.hbs new file mode 100644 index 00000000..4b310453 --- /dev/null +++ b/editor/client/app/components/ui-route/emulators/hex/template.hbs @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file diff --git a/editor/client/app/router.js b/editor/client/app/router.js index 279e1b3e..7a4a727a 100644 --- a/editor/client/app/router.js +++ b/editor/client/app/router.js @@ -19,6 +19,11 @@ Router.map(function() { }); }); + this.route('emulators', function() { + this.route('hex', { path: ':hex_id' }, function() { + }); + }); + this.route('users', function() { this.route('new'); }); diff --git a/editor/client/app/routes/emulators/hex.js b/editor/client/app/routes/emulators/hex.js new file mode 100644 index 00000000..9b1cd593 --- /dev/null +++ b/editor/client/app/routes/emulators/hex.js @@ -0,0 +1,29 @@ +import Route from '@ember/routing/route'; +import { route } from 'ember-cli-zuglet/lifecycle'; +import { BreadcrumbsMixin, breadcrumb } from '../-breadcrumbs'; + +export default Route.extend(BreadcrumbsMixin, { + + model: route().inline({ + + breadcrumb: breadcrumb({ + title: "Emulator" + }), + + id: null, + url: null, + + prepare(route, { hex_id }) { + this.setProperties({ id: hex_id }); + }, + + async load() { + let ref = this.store.storage.ref(`builds/${this.id}.hex`); + await ref.url.load(); + let url = ref.url.value; + this.setProperties({ url }); + } + + }) + +}); diff --git a/editor/client/app/templates/emulators/hex.hbs b/editor/client/app/templates/emulators/hex.hbs new file mode 100644 index 00000000..db075cee --- /dev/null +++ b/editor/client/app/templates/emulators/hex.hbs @@ -0,0 +1 @@ +{{ui-route/emulators/hex model=model}} \ No newline at end of file From fb7f307de7c572de4cc4788ae21ad5c85e6afb25 Mon Sep 17 00:00:00 2001 From: Arnis Vuskans Date: Thu, 3 Oct 2019 01:04:48 +0300 Subject: [PATCH 2/2] Update storage.rules --- editor/firebase/rules/storage.rules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/firebase/rules/storage.rules b/editor/firebase/rules/storage.rules index d494542e..93152d97 100644 --- a/editor/firebase/rules/storage.rules +++ b/editor/firebase/rules/storage.rules @@ -1,7 +1,8 @@ service firebase.storage { match /b/{bucket}/o { match /{allPaths=**} { - allow read, write: if request.auth!=null; + allow read: if true; + allow write: if false; } } }