Skip to content

Commit

Permalink
#147 - Content Security Policy and modified new directive to honor my…
Browse files Browse the repository at this point in the history
… share factory

Former-commit-id: 06a5c6cf48019d05bb0365d92670b9235a4ab8ff
  • Loading branch information
pliablepixels committed Jan 22, 2016
1 parent 5c5a5fd commit 5a80b23
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' https://www.google.com 'unsafe-inline' 'unsafe-eval'; ">
<meta http-equiv="Content-Security-Policy" content="img-src * 'self' data:; default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' https://www.google.com 'unsafe-inline' 'unsafe-eval'; ">
<title></title>
<meta name="format-detection" content="telephone=no">

Expand Down
10 changes: 8 additions & 2 deletions www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ angular.module('zmApp', [

//credit http://stackoverflow.com/questions/20997406/force-http-interceptor-in-dynamic-ngsrc-request
.directive('httpSrc', [
'$http', function ($http) {
'$http', 'imageLoadingDataShare', function ($http, imageLoadingDataShare) {
var directive = {
link: link,
restrict: 'A'
Expand All @@ -86,6 +86,7 @@ angular.module('zmApp', [
cache: 'true'
};

imageLoadingDataShare.set(1);
$http(requestConfig)
.success(function(data) {
var arr = new Uint8Array(data);
Expand All @@ -100,7 +101,12 @@ angular.module('zmApp', [
var b64 = btoa(raw);

attrs.$set('src', "data:image/jpeg;base64," + b64);
});
imageLoadingDataShare.set(0);
})
.error (function(data) {
attrs.$set('src', 'img/novideo.png');
imageLoadingDataShare.set(0);
});
}

}
Expand Down

0 comments on commit 5a80b23

Please sign in to comment.