forked from reactioncommerce/reaction
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Reaction CDN sources for font and favicon assets (reactioncommerc…
…e#1223) * switch FontAwesome source to Cloudflare CDN * clean up browser policy configs and add Cloudflare * remove unnecessary version query string from font urls * switch fonts to Reaction CDN * clean up policy config * add custom headers for CDN assets * add default favicons to default theme for all platforms * add missing import * add local font file fallback and fix fa console error * back to Cloudflare for FontAwesome CDN * Meteor 1.4.1 and update packages
- Loading branch information
1 parent
c76282e
commit 2f4a0a6
Showing
16 changed files
with
206 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[email protected] | ||
[email protected].0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ aldeed:[email protected] | |
[email protected] | ||
[email protected] | ||
[email protected] | ||
autoupdate@1.2.11 | ||
autoupdate@1.3.11 | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
|
@@ -53,13 +53,13 @@ cfs:[email protected] | |
cfs:[email protected] | ||
[email protected] | ||
chuangbo:[email protected] | ||
coffeescript@1.1.4 | ||
dburles:factory@1.0.0 | ||
coffeescript@1.2.3 | ||
dburles:factory@1.1.0 | ||
[email protected] | ||
ddp-client@1.2.9 | ||
ddp-client@1.3.0 | ||
[email protected] | ||
[email protected] | ||
ddp-server@1.2.10 | ||
ddp-server@1.3.9 | ||
[email protected] | ||
[email protected] | ||
dispatch:[email protected] | ||
|
@@ -103,7 +103,7 @@ meteorhacks:[email protected] | |
meteorhacks:[email protected] | ||
meteorhacks:[email protected] | ||
meteorhacks:[email protected] | ||
minifier-css@1.1.13 | ||
minifier-css@1.2.13 | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/** | ||
* Set up default Reaction favicon for all browsers/platforms | ||
* Assets generated by https://realfavicongenerator.net | ||
*/ | ||
|
||
|
||
// folder path where all assets live | ||
const basePath = "https://assets.reactioncommerce.com/favicon/"; | ||
|
||
|
||
// define link tags | ||
const linkTags = [ | ||
{ | ||
rel: "apple-touch-icon", | ||
sizes: "180x180", | ||
href: basePath + "apple-touch-icon.png" | ||
}, | ||
{ | ||
rel: "icon", | ||
type: "image/png", | ||
sizes: "32x32", | ||
href: basePath + "favicon-32x32.png" | ||
}, | ||
{ | ||
rel: "icon", | ||
type: "image/png", | ||
sizes: "16x16", | ||
href: basePath + "favicon-16x16.png" | ||
}, | ||
{ | ||
rel: "manifest", | ||
href: basePath + "manifest.json" | ||
}, | ||
{ | ||
rel: "mask-icon", | ||
color: "#5bbad5", | ||
href: basePath + "safari-pinned-tab.svg" | ||
}, | ||
{ | ||
rel: "shortcut icon", | ||
href: basePath + "favicon.ico" | ||
} | ||
]; | ||
|
||
|
||
// define meta tags | ||
const metaTags = [ | ||
{ | ||
name: "msapplication-config", | ||
content: basePath + "browserconfig.xml" | ||
}, | ||
{ | ||
name: "theme-color", | ||
content: "#ffffff" | ||
} | ||
]; | ||
|
||
|
||
/** | ||
* Add a tag to the <head> of the page | ||
* @param {String} type - tag type (link, meta, etc.) | ||
* @param {Object} details - key/value pairs for tag attributes | ||
* @return {undefined} no return value | ||
*/ | ||
function addTag(type, details) { | ||
let props = ""; | ||
for (let key in details) { | ||
if ({}.hasOwnProperty.call(details, key)) { | ||
props += `${key}="${details[key]}" `; | ||
} | ||
} | ||
const tag = `<${type} ${props}/>`; | ||
document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend", tag); | ||
} | ||
|
||
|
||
// add the favicon tags to the <head> | ||
linkTags.forEach(tag => addTag("link", tag)); | ||
metaTags.forEach(tag => addTag("meta", tag)); | ||
|
||
|
||
// HTML output should look like this... | ||
// | ||
// <link rel="apple-touch-icon" sizes="180x180" href="https://assets.reactioncommerce.com/favicon/apple-touch-icon.png"> | ||
// <link rel="icon" type="image/png" href="https://assets.reactioncommerce.com/favicon/favicon-32x32.png" sizes="32x32"> | ||
// <link rel="icon" type="image/png" href="https://assets.reactioncommerce.com/favicon/favicon-16x16.png" sizes="16x16"> | ||
// <link rel="manifest" href="https://assets.reactioncommerce.com/favicon/manifest.json"> | ||
// <link rel="mask-icon" href="https://assets.reactioncommerce.com/favicon/safari-pinned-tab.svg" color="#5bbad5"> | ||
// <link rel="shortcut icon" href="https://assets.reactioncommerce.com/favicon/favicon.ico"> | ||
// <meta name="msapplication-config" content="https://assets.reactioncommerce.com/favicon/browserconfig.xml"> | ||
// <meta name="theme-color" content="#ffffff"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// Favicons | ||
import "./favicons"; | ||
|
||
// Styles | ||
import "./styles/main.less"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { BrowserPolicy } from "meteor/browser-policy-common"; | ||
import { WebApp } from "meteor/webapp"; | ||
|
||
|
||
/** | ||
* Set headers for Reaction CDN | ||
*/ | ||
WebApp.rawConnectHandlers.use((req, res, next) => { | ||
if (req._parsedUrl.pathname.match(/\.(ttf|ttc|otf|eot|woff|svg|font\.css|css)$/)) { | ||
res.setHeader("Access-Control-Allow-Origin", "assets.reactioncommerce.com"); | ||
} | ||
next(); | ||
}); | ||
|
||
|
||
/** | ||
* Set browser policies | ||
*/ | ||
if (process.env.NODE_ENV === "development") { | ||
BrowserPolicy.content.allowOriginForAll("localhost:*"); | ||
BrowserPolicy.content.allowConnectOrigin("ws://localhost:*"); | ||
BrowserPolicy.content.allowConnectOrigin("http://localhost:*"); | ||
BrowserPolicy.content.allowConnectOrigin("https://localhost:*"); | ||
BrowserPolicy.framing.allowAll(); | ||
} | ||
|
||
BrowserPolicy.content.allowOriginForAll("*.facebook.com"); | ||
BrowserPolicy.content.allowOriginForAll("*.fbcdn.net"); | ||
BrowserPolicy.content.allowOriginForAll("connect.facebook.net"); | ||
BrowserPolicy.content.allowOriginForAll("*.googleusercontent.com"); | ||
|
||
BrowserPolicy.content.allowImageOrigin("fbcdn-profile-a.akamaihd.net"); | ||
BrowserPolicy.content.allowImageOrigin("secure.gravatar.com"); | ||
BrowserPolicy.content.allowImageOrigin("i0.wp.com"); | ||
|
||
BrowserPolicy.content.allowFontDataUrl(); | ||
BrowserPolicy.content.allowOriginForAll("assets.reactioncommerce.com"); | ||
BrowserPolicy.content.allowOriginForAll("cdnjs.cloudflare.com"); | ||
BrowserPolicy.content.allowOriginForAll("fonts.googleapis.com"); | ||
BrowserPolicy.content.allowOriginForAll("fonts.gstatic.com"); | ||
BrowserPolicy.content.allowOriginForAll("fonts.gstatic.com"); | ||
|
||
BrowserPolicy.content.allowOriginForAll("enginex.kadira.io"); | ||
BrowserPolicy.content.allowOriginForAll("*.stripe.com"); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.