server notes

pull/1/head
ansuz 4 years ago
parent 416ba823bd
commit 67af5c220c

@ -12,6 +12,17 @@ Data.getMetadataRaw = function (Env, channel /* channelName */, _cb) {
if (channel.length !== HK.STANDARD_CHANNEL_LENGTH &&
channel.length !== HK.ADMIN_CHANNEL_LENGTH) { return cb("INVALID_CHAN_LENGTH"); }
// return synthetic metadata for admin broadcast channels as a safety net
// in case anybody manages to write metadata
/*
if (channel.length === HK.ADMIN_CHANNEL_LENGTH) { // XXX
return void cb(void 0, {
channel: channel,
creation: +new Date(),
owners: Env.admins,
});
} */
var cached = Env.metadata_cache[channel];
if (HK.isMetadataMessage(cached)) {
Env.checkCache(channel);
@ -141,7 +152,7 @@ Data.setMetadata = function (Env, safeKey, data, cb, Server) {
const metadata_cache = Env.metadata_cache;
// update the cached metadata
metadata_cache[channel] = metadata;
metadata_cache[channel] = metadata; // XXX guard against malicious takeover of the broadcast channel
// it's easy to check if the channel is restricted
const isRestricted = metadata.restricted;

Loading…
Cancel
Save