Fix cryptget inner
This commit is contained in:
@@ -33,7 +33,7 @@ define([
|
||||
var secret = Hash.getSecrets('pad', hash, opt.password);
|
||||
if (!secret.keys) { secret.keys = secret.key; } // support old hashses
|
||||
var config = {
|
||||
websocketURL: NetConfig.getWebsocketURL(),
|
||||
websocketURL: NetConfig.getWebsocketURL(opt.origin),
|
||||
channel: secret.channel,
|
||||
validateKey: secret.keys.validateKey || undefined,
|
||||
crypto: Crypto.createEncryptor(secret.keys),
|
||||
|
||||
@@ -43,7 +43,7 @@ var factory = function (Hash, Crypt, Nacl, Scrypt/*, Util, Cred, nThen */) {
|
||||
'base64'); // format, could be 'base64'
|
||||
};
|
||||
|
||||
Invite.getPreviewContent = function (seeds, cb) {
|
||||
Invite.getPreviewContent = function (seeds, cryptgetOpts, cb) {
|
||||
setTimeout(function () {
|
||||
cb(void 0, {
|
||||
author: {
|
||||
@@ -67,7 +67,7 @@ var factory = function (Hash, Crypt, Nacl, Scrypt/*, Util, Cred, nThen */) {
|
||||
console.error(e);
|
||||
cb(e);
|
||||
}
|
||||
});
|
||||
}, cryptgetOpts);
|
||||
// cb("NOT_IMPLEMENTED"); // XXX cryptget
|
||||
};
|
||||
|
||||
|
||||
@@ -3,13 +3,18 @@ define([
|
||||
], function (ApiConfig) {
|
||||
var Config = {};
|
||||
|
||||
Config.getWebsocketURL = function () {
|
||||
Config.getWebsocketURL = function (origin) {
|
||||
if (!ApiConfig.websocketPath) { return ApiConfig.websocketURL; }
|
||||
var path = ApiConfig.websocketPath;
|
||||
if (/^ws{1,2}:\/\//.test(path)) { return path; }
|
||||
|
||||
var protocol = window.location.protocol.replace(/http/, 'ws');
|
||||
var host = window.location.host;
|
||||
var l = window.location;
|
||||
if (origin && window && window.document) {
|
||||
var l = document.createElement("a");
|
||||
l.href = origin;
|
||||
}
|
||||
var protocol = l.protocol.replace(/http/, 'ws');
|
||||
var host = l.host;
|
||||
var url = protocol + '//' + host + path;
|
||||
|
||||
return url;
|
||||
|
||||
Reference in New Issue
Block a user