diff --git a/src/stores/NetworkStore.js b/src/stores/NetworkStore.js index 2503e9f..818d2aa 100644 --- a/src/stores/NetworkStore.js +++ b/src/stores/NetworkStore.js @@ -16,6 +16,7 @@ import ChannelStore from './ChannelStore' import Logger from '../utils/logger' import WorkerProxy from '../utils/worker-proxy' +import { createWeeklyChannelName } from '../utils/channels' configure({ enforceActions: 'observed' }) @@ -63,7 +64,7 @@ export default class NetworkStore { swarmPeers = [] @observable - defaultChannels = window.location.href.match('localhost:') ? ['orbit-dev'] : ['orbit'] + defaultChannels = window.location.href.match('localhost:') ? [createWeeklyChannelName('orbit-dev')] : [createWeeklyChannelName('orbit')] // Public instance getters diff --git a/src/utils/channels.js b/src/utils/channels.js new file mode 100644 index 0000000..2f43003 --- /dev/null +++ b/src/utils/channels.js @@ -0,0 +1,9 @@ +import getWeek from 'date-fns/getWeek' +import getYear from 'date-fns/getYear' + +export function createWeeklyChannelName (channelName) { + const now = Date.now() + const year = getYear(now) + const week = getWeek(now) + return channelName + '-' + year + '-' + week +}