diff --git a/.gitignore b/.gitignore index 7b820477..ec388491 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ .DS_Store .idea +*.sublime-workspace # Node.js package manager -/node_modules -/npm-debug.log +node_modules +npm-debug.log dist -package_dist +releases webogram*.zip -app/js/partials.js -*.sublime-workspace +app/js/templates.js \ No newline at end of file diff --git a/app/css/app.css b/app/css/app.css index ad0860a3..77ac1bfb 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -484,7 +484,7 @@ input[type="number"]::-webkit-inner-spin-button { margin-right: -7px; } .im_dialogs_col .nano > .pane { - background : rgba(0,0,0,.0); + background : rgba(0,0,0,0.0); width : 12px; right: 0px; -webkit-transition : .2s; diff --git a/app/index.html b/app/index.html index 6ece9a17..4e23df0d 100644 --- a/app/index.html +++ b/app/index.html @@ -44,16 +44,20 @@ - - + + + + - + \ No newline at end of file diff --git a/app/js/app.js b/app/js/app.js index cddd3249..cb8b4501 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -30,10 +30,12 @@ angular.module('myApp', [ 'ngAnimate', 'ngSanitize', 'ui.bootstrap', - 'partials', + 'mtproto.services', 'myApp.filters', 'myApp.services', - 'mtproto.services', + /*PRODUCTION_ONLY_BEGIN + 'myApp.templates', + PRODUCTION_ONLY_END*/ 'myApp.directives', 'myApp.controllers' ]). diff --git a/app/js/background.js b/app/js/background.js index 2f8ac9ad..09020469 100644 --- a/app/js/background.js +++ b/app/js/background.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/controllers.js b/app/js/controllers.js index 4f8e1cba..fa8e062c 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/directives.js b/app/js/directives.js index 93d9ae14..d87312d1 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/filters.js b/app/js/filters.js index 1ede38eb..b2fedc6e 100644 --- a/app/js/filters.js +++ b/app/js/filters.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/aes_worker.js b/app/js/lib/aes_worker.js index 0c5ef9d9..a8418fe7 100644 --- a/app/js/lib/aes_worker.js +++ b/app/js/lib/aes_worker.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/mtproto.js b/app/js/lib/mtproto.js index 8cae493f..4682afa5 100644 --- a/app/js/lib/mtproto.js +++ b/app/js/lib/mtproto.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -1122,7 +1122,7 @@ factory('MtpAuthorizer', function (MtpDcConfigurator, MtpRsaKeysManager, MtpSecu console.log('PQ factorization start'); if (!!window.Worker) { - var worker = new Worker('js/lib/pq_worker.js?1'); + var worker = new Worker('js/lib/pq_worker.js'); worker.onmessage = function (e) { auth.p = e.data[0]; @@ -1416,7 +1416,7 @@ factory('MtpAesService', function ($q) { }; } - var worker = new Worker('js/lib/aes_worker.js?2'), + var worker = new Worker('js/lib/aes_worker.js'), taskID = 0, awaiting = {}; @@ -1468,7 +1468,7 @@ factory('MtpSha1Service', function ($q) { }; } - var worker = new Worker('js/lib/sha1_worker.js?2'), + var worker = new Worker('js/lib/sha1_worker.js'), taskID = 0, awaiting = {}; diff --git a/app/js/lib/pq_worker.js b/app/js/lib/pq_worker.js index 4123a7d5..721a2c24 100644 --- a/app/js/lib/pq_worker.js +++ b/app/js/lib/pq_worker.js @@ -1,12 +1,12 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE */ importScripts( - '../../vendor/console-polyfill/console-polyfill.js?1', + '../../vendor/console-polyfill/console-polyfill.js', 'mtproto.js', '../../vendor/jsbn/jsbn_combined.js' ); diff --git a/app/js/lib/sha1_worker.js b/app/js/lib/sha1_worker.js index 5d677b1a..1d7cd87f 100644 --- a/app/js/lib/sha1_worker.js +++ b/app/js/lib/sha1_worker.js @@ -1,14 +1,14 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE */ importScripts( - '../../vendor/console-polyfill/console-polyfill.js?1', + '../../vendor/console-polyfill/console-polyfill.js', 'mtproto.js', - '../../vendor/cryptoJS/crypto.js?1' + '../../vendor/cryptoJS/crypto.js' ); onmessage = function (e) { diff --git a/app/js/services.js b/app/js/services.js index 8efd1641..313fc240 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/util.js b/app/js/util.js index 51d3a57f..ac0d08ee 100644 --- a/app/js/util.js +++ b/app/js/util.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/gulpfile.js b/gulpfile.js index fc268a38..ff7d5b0d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,28 +4,29 @@ var pj = require('./package.json'); var $ = require('gulp-load-plugins')(); var concat = require('gulp-concat'); -gulp.task('usemin', ['templates'], function() { - return gulp.src('app/index.html') - .pipe($.usemin({ - html: [$.minifyHtml({empty: true})], - js: ['concat', $.rev()], - css: [$.minifyCss(), 'concat'] - })) - .pipe(gulp.dest('dist')); -}); -// The generated file is being created at src +// The generated file is being created at src // so it can be fetched by usemin. gulp.task('templates', function() { return gulp.src('app/partials/*.html') - .pipe($.angularTemplatecache('partials.js', { + .pipe($.angularTemplatecache('templates.js', { root: 'partials', - module: 'partials', + module: 'myApp.templates', standalone: true })) .pipe(gulp.dest('app/js')); }); +gulp.task('usemin', ['templates', 'enable-production'], function() { + return gulp.src('app/index.html') + .pipe($.usemin({ + html: [$.minifyHtml({empty: true})], + js: ['concat', $.rev()], + css: [$.minifyCss(), 'concat'] + })) + .pipe(gulp.dest('dist')); +}); + gulp.task('copy', function() { return es.concat( gulp.src(['app/favicon.ico', 'app/favicon_unread.ico', 'app/manifest.webapp', 'app/manifest.json', 'app/**/*worker.js']) @@ -46,13 +47,13 @@ gulp.task('copy', function() { }); gulp.task('compress-dist', ['add-csp'], function() { - return es.concat( - gulp.src('dist/*') - .pipe($.zip('webogram_v' + pj.version + '.zip')) - .pipe(gulp.dest('package')), - gulp.src('package/*.zip') - .pipe(gulp.dest('.')) - ); + return gulp.src('dist/**/*') + .pipe($.zip('webogram_v' + pj.version + '.zip')) + .pipe(gulp.dest('releases')); +}); + +gulp.task('cleanup-dist', ['compress-dist'], function() { + return gulp.src(['releases/**/*', '!releases/*.zip']).pipe($.clean()); }); gulp.task('add-csp', ['build'], function() { @@ -74,22 +75,48 @@ gulp.task('update-version-settings', function() { }); gulp.task('update-version-comments', function() { - return gulp.src('app/**/*') - .pipe($.grepStream('Webogram v')) + return gulp.src('app/**/*.js') .pipe($.replace(/Webogram v[0-9.]*/, 'Webogram v' + pj.version)) .pipe(gulp.dest('app')); }); +gulp.task('enable-production', function() { + return es.concat( + gulp.src('app/**/*.html') + .pipe($.replace(/PRODUCTION_ONLY_BEGIN/g, 'PRODUCTION_ONLY_BEGIN-->')) + .pipe($.replace(/PRODUCTION_ONLY_END/, '/g, 'PRODUCTION_ONLY_BEGIN')) + .pipe($.replace(/