diff --git a/marko/page/logs/components/import-log-modal/component.js b/marko/page/logs/components/import-log-modal/component.js index ffabb81..0ab268c 100644 --- a/marko/page/logs/components/import-log-modal/component.js +++ b/marko/page/logs/components/import-log-modal/component.js @@ -14,6 +14,7 @@ module.exports = class { channelName: "", date: "", data: "", + sessionThresholdHours: 12, }, timezones: tz.names(), } @@ -58,12 +59,24 @@ module.exports = class { return } } else if (input.importer === "MircLike") { - this.state.error = "Date is required for mIRC-like logs" + this.state.error = "Date is required for mIRC-like logs." return } else { input.date = null; } + if (input.importer === "IRCCloudLog") { + const hours = parseFloat(input.sessionThresholdHours) + if (Number.isNaN(hours)) { + this.state.error = "The session change threshold must be a number." + return + } + + input.sessionThresholdMs = Math.floor(hours * 3600000) + } + + delete input.sessionThresholdHours + if (input.channelName.length < 2 || input.channelName.includes(" ") || input.channelName.includes(" ") || input.channelName.charAt(0) !== "#") { this.state.error = "A valid channelName name is required" return diff --git a/marko/page/logs/components/import-log-modal/index.marko b/marko/page/logs/components/import-log-modal/index.marko index 4a7005b..6907b28 100644 --- a/marko/page/logs/components/import-log-modal/index.marko +++ b/marko/page/logs/components/import-log-modal/index.marko @@ -10,6 +10,7 @@ import moment from "moment" @@ -25,6 +26,11 @@ import moment from "moment" + + + + +