mirror of https://github.com/xwiki-labs/cryptpad
Make sure we can't open a pad using the wrong app
This commit is contained in:
parent
35a313d6ee
commit
72f0952835
|
@ -378,7 +378,6 @@ define([
|
||||||
};
|
};
|
||||||
|
|
||||||
config.onReady = function (info) {
|
config.onReady = function (info) {
|
||||||
console.log('onready');
|
|
||||||
if (APP.realtime !== info.realtime) {
|
if (APP.realtime !== info.realtime) {
|
||||||
var realtime = APP.realtime = info.realtime;
|
var realtime = APP.realtime = info.realtime;
|
||||||
APP.patchText = TextPatcher.create({
|
APP.patchText = TextPatcher.create({
|
||||||
|
@ -400,7 +399,8 @@ define([
|
||||||
metadataMgr.updateMetadata(hjson.metadata);
|
metadataMgr.updateMetadata(hjson.metadata);
|
||||||
}
|
}
|
||||||
if (typeof (hjson) !== 'object' || Array.isArray(hjson) ||
|
if (typeof (hjson) !== 'object' || Array.isArray(hjson) ||
|
||||||
(typeof(hjson.type) !== 'undefined' && hjson.type !== 'code')) {
|
(hjson.metadata && typeof(hjson.metadata.type) !== 'undefined' &&
|
||||||
|
hjson.metadata.type !== 'code')) {
|
||||||
var errorText = Messages.typeError;
|
var errorText = Messages.typeError;
|
||||||
Cryptpad.errorLoadingScreen(errorText);
|
Cryptpad.errorLoadingScreen(errorText);
|
||||||
throw new Error(errorText);
|
throw new Error(errorText);
|
||||||
|
|
|
@ -563,7 +563,6 @@ define([
|
||||||
|
|
||||||
realtimeOptions.onInit = function (info) {
|
realtimeOptions.onInit = function (info) {
|
||||||
readOnly = metadataMgr.getPrivateData().readOnly;
|
readOnly = metadataMgr.getPrivateData().readOnly;
|
||||||
console.log('onInit');
|
|
||||||
var titleCfg = { getHeadingText: getHeadingText };
|
var titleCfg = { getHeadingText: getHeadingText };
|
||||||
Title = common.createTitle(titleCfg, realtimeOptions.onLocal);
|
Title = common.createTitle(titleCfg, realtimeOptions.onLocal);
|
||||||
var configTb = {
|
var configTb = {
|
||||||
|
@ -700,7 +699,6 @@ define([
|
||||||
|
|
||||||
// this should only ever get called once, when the chain syncs
|
// this should only ever get called once, when the chain syncs
|
||||||
realtimeOptions.onReady = function (info) {
|
realtimeOptions.onReady = function (info) {
|
||||||
console.log('onReady');
|
|
||||||
if (!module.isMaximized) {
|
if (!module.isMaximized) {
|
||||||
module.isMaximized = true;
|
module.isMaximized = true;
|
||||||
$('iframe.cke_wysiwyg_frame').css('width', '');
|
$('iframe.cke_wysiwyg_frame').css('width', '');
|
||||||
|
@ -723,10 +721,13 @@ define([
|
||||||
if (shjson === '') { newPad = true; }
|
if (shjson === '') { newPad = true; }
|
||||||
|
|
||||||
if (!newPad) {
|
if (!newPad) {
|
||||||
|
if (shjson[0] !== '[') {
|
||||||
|
var errorText = Messages.typeError;
|
||||||
|
Cryptpad.errorLoadingScreen(errorText);
|
||||||
|
throw new Error(errorText);
|
||||||
|
}
|
||||||
applyHjson(shjson);
|
applyHjson(shjson);
|
||||||
|
|
||||||
// Update the user list (metadata) from the hyperjson
|
|
||||||
// XXX Metadata.update(shjson);
|
|
||||||
var parsed = JSON.parse(shjson);
|
var parsed = JSON.parse(shjson);
|
||||||
if (parsed[3] && parsed[3].metadata) {
|
if (parsed[3] && parsed[3].metadata) {
|
||||||
metadataMgr.updateMetadata(parsed[3].metadata);
|
metadataMgr.updateMetadata(parsed[3].metadata);
|
||||||
|
|
|
@ -552,7 +552,8 @@ define([
|
||||||
metadataMgr.updateMetadata(hjson.metadata);
|
metadataMgr.updateMetadata(hjson.metadata);
|
||||||
}
|
}
|
||||||
if (typeof (hjson) !== 'object' || Array.isArray(hjson) ||
|
if (typeof (hjson) !== 'object' || Array.isArray(hjson) ||
|
||||||
(typeof(hjson.type) !== 'undefined' && hjson.type !== 'code')) {
|
(hjson.metadata && typeof(hjson.metadata.type) !== 'undefined' &&
|
||||||
|
hjson.metadata.type !== 'slide')) {
|
||||||
var errorText = Messages.typeError;
|
var errorText = Messages.typeError;
|
||||||
Cryptpad.errorLoadingScreen(errorText);
|
Cryptpad.errorLoadingScreen(errorText);
|
||||||
throw new Error(errorText);
|
throw new Error(errorText);
|
||||||
|
|
Loading…
Reference in New Issue