Browse Source

Enable CSP by default

master
Igor Zhukov 11 years ago
parent
commit
ab5f85c63e
  1. 4
      README.md
  2. 2
      app/index.html
  3. 9
      gulpfile.js

4
README.md

@ -67,10 +67,6 @@ Install [node.js](http://nodejs.org/) and run `node server.js`. Open page http:/ @@ -67,10 +67,6 @@ Install [node.js](http://nodejs.org/) and run `node server.js`. Open page http:/
#### Running as Chrome Packaged App
It is possible to run this application in Chrome browser as a packaged app. In order to do this, open this URL in Chrome: `chrome://extensions/`, then tick "Developer mode" and press "Load unpacked extension...". Select the downloaded `app` folder and Webogram application should appear in the list.
Also it's necessary to replace following line in index.html:
```<html lang="en" ng-app="myApp"><!-- ng-csp=""-->```
with:
```<html lang="en" ng-app="myApp" ng-csp="">```
You can also download this application from Chrome Web Store: [chrome.google.com/webstore/detail/telegram-unofficial/clhhggbfdinjmjhajaheehoeibfljjno](https://chrome.google.com/webstore/detail/telegram-unofficial/clhhggbfdinjmjhajaheehoeibfljjno). This is more secure way to use app than plain HTTP in web, because sources are downloaded only once and via HTTPS.

2
app/index.html

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<!doctype html>
<html lang="en" ng-app="myApp" manifest="webogram.appcache"><!-- ng-csp="" -->
<html lang="en" ng-app="myApp" manifest="webogram.appcache" ng-csp="">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no">

9
gulpfile.js

@ -62,7 +62,7 @@ gulp.task('copy', function() { @@ -62,7 +62,7 @@ gulp.task('copy', function() {
);
});
gulp.task('compress-dist', ['add-csp'], function() {
gulp.task('compress-dist', function() {
return gulp.src('**/*', {cwd: path.join(process.cwd(), '/dist')})
.pipe($.zip('webogram_v' + pj.version + '.zip'))
.pipe(gulp.dest('releases'));
@ -72,12 +72,6 @@ gulp.task('cleanup-dist', ['compress-dist'], function() { @@ -72,12 +72,6 @@ gulp.task('cleanup-dist', ['compress-dist'], function() {
return gulp.src(['releases/**/*', '!releases/*.zip']).pipe($.clean());
});
gulp.task('add-csp', ['build'], function() {
return gulp.src('dist/index.html')
.pipe($.replace(/<html(.*?)>/, '<html$1 ng-csp="">'))
.pipe(gulp.dest('dist'));
});
gulp.task('update-version-manifests', function() {
return gulp.src(['app/manifest.webapp', 'app/manifest.json'])
.pipe($.replace(/"version": ".*",/, '"version": "' + pj.version + '",'))
@ -177,7 +171,6 @@ gulp.task('package-dev', function() { @@ -177,7 +171,6 @@ gulp.task('package-dev', function() {
.pipe(gulp.dest('dist_package/vendor')),
gulp.src('app/**/*.html')
.pipe($.replace(/<html(.*?)>/, '<html$1 ng-csp="">'))
.pipe($.replace(/PRODUCTION_ONLY_BEGIN/g, 'PRODUCTION_ONLY_BEGIN-->'))
.pipe($.replace(/PRODUCTION_ONLY_END/, '<!--PRODUCTION_ONLY_END'))
.pipe(gulp.dest('dist_package')),

Loading…
Cancel
Save