This commit is contained in:
yflory
2018-06-28 15:31:30 +02:00
parent c85a551546
commit 470f404a24
4 changed files with 39 additions and 18 deletions

View File

@@ -761,7 +761,7 @@ define([
UI.getFileIcon = function (data) {
var $icon = UI.getIcon();
if (!data) { return $icon; }
var href = data.href;
var href = data.href || data.roHref;
var type = data.type;
if (!href && !type) { return $icon; }

View File

@@ -73,6 +73,8 @@ define([
data.password = val;
}));
}).nThen(function (waitFor) {
var base = common.getMetadataMgr().getPrivateData().origin;
/* XXX
common.getPadAttribute('href', waitFor(function (err, val) {
var base = common.getMetadataMgr().getPrivateData().origin;
@@ -93,6 +95,12 @@ define([
if (!hrefsecret.keys) { return; }
var viewHash = Hash.getViewHashFromKeys(hrefsecret);
data.roHref = hBase + viewHash;
}));*/
common.getPadAttribute('href', waitFor(function (err, val) {
data.href = base + val;
}));
common.getPadAttribute('roHref', waitFor(function (err, val) {
data.roHref = base + val;
}));
common.getPadAttribute('channel', waitFor(function (err, val) {
data.channel = val;
@@ -162,7 +170,7 @@ define([
$d.append(password);
}
var parsed = Hash.parsePadUrl(data.href);
var parsed = Hash.parsePadUrl(data.href || data.roHref);
if (owned && parsed.hashData.type === 'pad') {
var sframeChan = common.getSframeChannel();
var changePwTitle = Messages.properties_changePassword;
@@ -186,7 +194,7 @@ define([
UI.confirm(changePwConfirm, function (yes) {
if (!yes) { return; }
sframeChan.query("Q_PAD_PASSWORD_CHANGE", {
href: data.href,
href: data.href || data.roHref,
password: $(newPassword).find('input').val()
}, function (err, data) {
if (err || data.error) {
@@ -195,11 +203,11 @@ define([
UI.findOKButton().click();
if (data.warning) {
return void UI.alert(Messages.properties_passwordWarning, function () {
common.gotoURL(hasPassword ? undefined : data.href);
common.gotoURL(hasPassword ? undefined : (data.href || data.roHref));
}, {force: true});
}
return void UI.alert(Messages.properties_passwordSuccess, function () {
common.gotoURL(hasPassword ? undefined : data.href);
common.gotoURL(hasPassword ? undefined : (data.href || data.roHref));
}, {force: true});
});
});

View File

@@ -613,7 +613,7 @@ define([
if (!parsed.hash) { return void cb({ error: 'EINVAL_HREF' }); }
var warning = false;
var newHash;
var newHash, newRoHref;
var oldChannel;
if (parsed.hashData.password) {
newHash = parsed.hash;
@@ -678,6 +678,11 @@ define([
common.setPadAttribute('channel', secret.channel, waitFor(function (err) {
if (err) { warning = true; }
}), href);
var viewHash = Hash.getViewHashFromKeys(secret);
newRoHref = '/' + parsed.type + '/#' + viewHash;
common.setPadAttribute('roHref', newRoHref, waitFor(function (err) {
if (err) { warning = true; }
}), href);
if (parsed.hashData.password) { return; } // same hash
common.setPadAttribute('href', newHref, waitFor(function (err) {
@@ -687,7 +692,8 @@ define([
cb({
warning: warning,
hash: newHash,
href: newHref
href: newHref,
roHref: newRoHref
});
});
};