From 0d742395fa1adff8b3df25577e004d3fb8d7cf06 Mon Sep 17 00:00:00 2001 From: Yash Ladha <201551061@iiitvadodara.ac.in> Date: Sun, 3 Jun 2018 22:54:26 +0530 Subject: [PATCH] Fixes #919 : Deploy Backend API to heroku and frontend fix for prod (#920) Fixes #919 #### Checklist - [x] I have read the [Contribution & Best practices Guide](https://blog.fossasia.org/open-source-developer-guide-and-best-practices-at-fossasia) and my PR follows them. - [x] My branch is up-to-date with the Upstream `development` branch. - [ ] I have added necessary documentation (if appropriate) ### Preview Link - **Replace XXX with your PR no** - Link to live demo: http://pr-920-fossasia-badgeyay.surge.sh #### Changes proposed in this pull request: - Deployed new backend to heroku - Fixes asset path for production --- api/controllers/assetHelper.py | 2 +- api/controllers/generateBadges.py | 5 +- .../def-image-component.js | 2 +- frontend/app/index.html | 1 + .../def-image-component.hbs | 2 +- frontend/ember-cli-build.js | 11 +- frontend/package-lock.json | 9125 +++++++++-------- frontend/package.json | 1 + .../badge_backgrounds/black_futuristic.png | Bin .../badge_backgrounds/blue_futuristic.png | Bin .../badge_backgrounds/cyan_futuristic.png | Bin .../badge_backgrounds/gray_futuristic.png | Bin .../badge_backgrounds/green_futuristic.png | Bin .../badge_backgrounds/red_futuristic.png | Bin .../images/badge_backgrounds/user_defined.png | Bin .../badge_backgrounds/yellow_futuristic.png | Bin runtime.txt | 1 + 17 files changed, 4623 insertions(+), 4527 deletions(-) rename frontend/public/{ => assets}/images/badge_backgrounds/black_futuristic.png (100%) rename frontend/public/{ => assets}/images/badge_backgrounds/blue_futuristic.png (100%) rename frontend/public/{ => assets}/images/badge_backgrounds/cyan_futuristic.png (100%) rename frontend/public/{ => assets}/images/badge_backgrounds/gray_futuristic.png (100%) rename frontend/public/{ => assets}/images/badge_backgrounds/green_futuristic.png (100%) rename frontend/public/{ => assets}/images/badge_backgrounds/red_futuristic.png (100%) rename frontend/public/{ => assets}/images/badge_backgrounds/user_defined.png (100%) rename frontend/public/{ => assets}/images/badge_backgrounds/yellow_futuristic.png (100%) create mode 100644 runtime.txt diff --git a/api/controllers/assetHelper.py b/api/controllers/assetHelper.py index fd6115c54..5c83c94da 100644 --- a/api/controllers/assetHelper.py +++ b/api/controllers/assetHelper.py @@ -21,7 +21,7 @@ def getDefaultBackgrounds(): obj['id'] = idx obj['type'] = 'def-image' obj['attributes'] = { - 'name': file_, + 'name': file_.split('.')[0], } resp.append(obj) resp_ = {'data': resp} diff --git a/api/controllers/generateBadges.py b/api/controllers/generateBadges.py index 1777cec37..b0cf34a2a 100644 --- a/api/controllers/generateBadges.py +++ b/api/controllers/generateBadges.py @@ -40,7 +40,10 @@ def generateBadges(): text_color = data.get('font_color', '#ffffff') badge_size = data.get('badge_size', 'A3') svg2png = SVG2PNG() - svg2png.do_text_fill('static/badges/8BadgesOnA3.svg', text_color) + if config.ENV == 'PROD': + svg2png.do_text_fill(os.getcwd()+ '/api/static/badges/8BadgesOnA3.svg', text_color) + else: + svg2png.do_text_fill('static/badges/8BadgesOnA3.svg', text_color) merge_badges = MergeBadges(image_name, csv_name, badge_size) merge_badges.merge_pdfs() diff --git a/frontend/app/components/background-component/def-image-component.js b/frontend/app/components/background-component/def-image-component.js index 00985aeaa..23e624f5d 100644 --- a/frontend/app/components/background-component/def-image-component.js +++ b/frontend/app/components/background-component/def-image-component.js @@ -3,7 +3,7 @@ import Component from '@ember/component'; export default Component.extend({ init() { // To be inflated from the backend data - this.host = 'http://localhost:5000/'; + this.fingerPrint = window.ASSET_FINGERPRINT_HASH; return this._super(...arguments); }, click() { diff --git a/frontend/app/index.html b/frontend/app/index.html index a223cced4..ed89843ae 100644 --- a/frontend/app/index.html +++ b/frontend/app/index.html @@ -34,6 +34,7 @@ + {{content-for "body-footer"}} diff --git a/frontend/app/templates/components/background-component/def-image-component.hbs b/frontend/app/templates/components/background-component/def-image-component.hbs index fc43db636..9f61bdccd 100644 --- a/frontend/app/templates/components/background-component/def-image-component.hbs +++ b/frontend/app/templates/components/background-component/def-image-component.hbs @@ -6,7 +6,7 @@