diff --git a/customize.dist/messages.js b/customize.dist/messages.js index 7b766197f..9cda3aba2 100644 --- a/customize.dist/messages.js +++ b/customize.dist/messages.js @@ -121,5 +121,9 @@ define(['/customize/languageSelector.js', '

', ].join(''); + messages.driveReadme = '["BODY",{"class":"cke_editable cke_editable_themed cke_contents_ltr cke_show_borders","contenteditable":"true","spellcheck":"false","style":"color: rgb(51, 51, 51);"},' + + '[["H1",{},["' + messages.driveReadme_h1 + '",["BR",{},[]]]],["UL",{},[["LI",{},["' + messages.driveReadme_li1 + '",["BR",{},[]],["UL",{},[["LI",{},["' + messages.driveReadme_li1_1 + '",["BR",{},[]]]]]]]]]]],' + + '{"metadata":{"defaultTitle":"' + messages.driveReadmeTitle + '","title":"' + messages.driveReadmeTitle + '"}}]'; + return messages; }); diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 44163eb43..0958ad301 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -448,5 +448,10 @@ define(function () { ' - Your slides are updated in realtime' ].join(''); + out.driveReadmeTitle = "What is CryptDrive?"; + out.driveReadme_h1 = "Welcome to CryptPad"; + out.driveReadme_li1 = "CryptDrive : all your pads sorted in one place"; + out.driveReadme_li1_1 = "Tree, trash, unsorted files, etc."; + return out; }); diff --git a/www/drive/main.js b/www/drive/main.js index 18f4fe4f2..0f544ee22 100644 --- a/www/drive/main.js +++ b/www/drive/main.js @@ -1871,6 +1871,27 @@ define([ if (typeof(cb) === "function") { cb(); } } }; + var createReadme = function (proxy, cb) { + if (proxy.initializing) { + console.log('test'); + var hash = Cryptpad.createRandomHash(); + Get.put(hash, Messages.driveReadme, function (e) { + if (e) { console.error(e); } + var href = '/pad/#' + hash; + proxy.drive[UNSORTED].push(href); + proxy.drive[FILES_DATA].push({ + href: href, + title: Messages.driveReadmeTitle, + atime: new Date().toISOString(), + ctime: new Date().toISOString() + }); + if (typeof(cb) === "function") { cb(); } + }); + delete proxy.initializing; + return; + } + if (typeof(cb) === "function") { cb(); } + }; // don't initialize until the store is ready. Cryptpad.ready(function () { @@ -1966,10 +1987,12 @@ define([ module.files = proxy; if (!proxy.drive || typeof(proxy.drive) !== 'object') { proxy.drive = {}; } migrateAnonDrive(proxy, function () { - initLocalStorage(); - init(proxy); - APP.userList.onChange(); - Cryptpad.removeLoadingScreen(); + createReadme(proxy, function () { + initLocalStorage(); + init(proxy); + APP.userList.onChange(); + Cryptpad.removeLoadingScreen(); + }); }); }; var onDisconnect = function (info) { diff --git a/www/register/main.js b/www/register/main.js index 27086b338..d5e17c228 100644 --- a/www/register/main.js +++ b/www/register/main.js @@ -1,9 +1,10 @@ define([ '/common/login.js', '/common/cryptpad-common.js', + '/common/cryptget.js', '/common/credential.js', '/bower_components/jquery/dist/jquery.min.js', -], function (Login, Cryptpad) { +], function (Login, Cryptpad, Crypt) { var $ = window.jQuery; var APP = window.APP = { @@ -118,6 +119,7 @@ define([ proxy.login_name = uname; proxy[Cryptpad.displayNameKey] = uname; + proxy.initializing = true; Cryptpad.whenRealtimeSyncs(result.realtime, function () { Cryptpad.login(result.userHash, result.userName, function () {