Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
268f906ea4 | ||
|
|
44a98c8823 | ||
|
|
fe44300c0a | ||
|
|
2c7ba6df1d | ||
|
|
283ffc64b2 | ||
|
|
2486c98da7 | ||
|
|
5955e6a71e | ||
|
|
59a711f150 | ||
|
|
b75c3461f7 |
@@ -1,6 +1,6 @@
|
|||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
|
|
||||||
const config = {
|
let config = {
|
||||||
graphqlEndpoint: "http://127.0.0.1:17000/graphql",
|
graphqlEndpoint: "http://127.0.0.1:17000/graphql",
|
||||||
playgroundEndpoint: "http://127.0.0.1:17000/playground",
|
playgroundEndpoint: "http://127.0.0.1:17000/playground",
|
||||||
port: 8080,
|
port: 8080,
|
||||||
@@ -35,6 +35,31 @@ if (typeof(window) !== "undefined") {
|
|||||||
delete config.redis
|
delete config.redis
|
||||||
delete config.backend
|
delete config.backend
|
||||||
} else {
|
} else {
|
||||||
|
config = {
|
||||||
|
graphqlEndpoint: process.env.RPDATA_API_GRAPHQL || "http://127.0.0.1:17000/graphql",
|
||||||
|
playgroundEndpoint: process.env.RPDATA_API_PLAYGROUND || "http://127.0.0.1:17000/playground",
|
||||||
|
port: Number(process.env.PORT || "8080"),
|
||||||
|
root: process.env.ROOT || "http://localhost:8080",
|
||||||
|
trustedProxy: process.env.TRUSTED_PROXY || null,
|
||||||
|
auth0: {
|
||||||
|
secret: process.env.AUTH0_SECRET || "INVALID_SECRET",
|
||||||
|
clientId: process.env.AUTH0_CLIENT_ID || "",
|
||||||
|
domain: process.env.AUTH0_DOMAIN || "aiterp.eu.auth0.com",
|
||||||
|
},
|
||||||
|
session: {
|
||||||
|
secret: process.env.SESSION_SECRET || "",
|
||||||
|
secure: process.env.SESSION_SECURE === "true",
|
||||||
|
},
|
||||||
|
redis: {
|
||||||
|
host: process.env.REDIS_HOST || "127.0.0.1",
|
||||||
|
port: process.env.REDIS_PORT || 6379,
|
||||||
|
},
|
||||||
|
backend: {
|
||||||
|
kid: process.env.RPDATA_KID || "",
|
||||||
|
secret: process.env.RPDATA_SECRET || "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = fs.readFileSync("/etc/aiterp/rpdata-frontend.json", "utf8")
|
const data = fs.readFileSync("/etc/aiterp/rpdata-frontend.json", "utf8")
|
||||||
const parsed = JSON.parse(data)
|
const parsed = JSON.parse(data)
|
||||||
@@ -44,6 +69,11 @@ if (typeof(window) !== "undefined") {
|
|||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.error("Failed to load configuration: " + err.message || err.stack || err)
|
console.error("Failed to load configuration: " + err.message || err.stack || err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("Config/Auth0", config.auth0.clientId, config.auth0.domain);
|
||||||
|
console.log("Config/API", config.graphqlEndpoint, config.backend.kid);
|
||||||
|
console.log("Config/Redis", config.redis.host, config.redis.port);
|
||||||
|
console.log("Config/Root", config.root);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = config
|
module.exports = config
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<td class="icon color-highlight-primary">${input.icon}</td>
|
<td class="icon color-highlight-primary">${input.icon}</td>
|
||||||
<td class="content color-primary color-highlight-dark">
|
<td class="content color-primary color-highlight-dark">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<a class="color-primary" href=input.link>${input.name}</a>
|
<a class="color-primary" href=input.link>${input.name || "(Untitled)"}</a>
|
||||||
</div>
|
</div>
|
||||||
<div if(input.description) class="description color-text">
|
<div if(input.description) class="description color-text">
|
||||||
<div class="content">${input.description}</div>
|
<div class="content">${input.description}</div>
|
||||||
@@ -20,4 +20,4 @@
|
|||||||
<item-meta kind="author" value=input.author />
|
<item-meta kind="author" value=input.author />
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
<menu-link key="characters" selected=input.selected.characters icon="C" href="/data/characters/">Characters</menu-link>
|
<menu-link key="characters" selected=input.selected.characters icon="C" href="/data/characters/">Characters</menu-link>
|
||||||
<menu-link key="channels" selected=input.selected.channels icon="#" href="/data/channels/">Channels</menu-link>
|
<menu-link key="channels" selected=input.selected.channels icon="#" href="/data/channels/">Channels</menu-link>
|
||||||
<menu-link key="history" selected=input.selected.changes icon="H" href="/data/changes/">History</menu-link>
|
<menu-link key="history" selected=input.selected.changes icon="H" href="/data/changes/">History</menu-link>
|
||||||
<menu-link key="files" selected=input.selected.files icon="F" href="/data/files/">Files</menu-link>
|
|
||||||
<if-permitted user=input.user permission=["member", "character.add", "channel.add", "file.add"]>
|
<if-permitted user=input.user permission=["member", "character.add", "channel.add", "file.add"]>
|
||||||
<menu-gap />
|
<menu-gap />
|
||||||
<menu-header>Add</menu-header>
|
<menu-header>Add</menu-header>
|
||||||
@@ -13,8 +12,5 @@
|
|||||||
<if-permitted key="channels_add" user=input.user permission="channel.add">
|
<if-permitted key="channels_add" user=input.user permission="channel.add">
|
||||||
<menu-link dark icon="+" on-click("emit", "open", "channel.add")>Channel</menu-link>
|
<menu-link dark icon="+" on-click("emit", "open", "channel.add")>Channel</menu-link>
|
||||||
</if-permitted>
|
</if-permitted>
|
||||||
<if-permitted key="files_add" user=input.user permission=["file.add", "member"]>
|
|
||||||
<menu-link dark icon="+" on-click("emit", "open", "file.add")>File</menu-link>
|
|
||||||
</if-permitted>
|
|
||||||
</if-permitted>
|
</if-permitted>
|
||||||
</menu>
|
</menu>
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
<option value="annotation.info" selected=(state.values.kind === "annotation.info")>Annotation - Info</option>
|
<option value="annotation.info" selected=(state.values.kind === "annotation.info")>Annotation - Info</option>
|
||||||
<option value="annotation.warning" selected=(state.values.kind === "annotation.warning")>Annotation - Warning</option>
|
<option value="annotation.warning" selected=(state.values.kind === "annotation.warning")>Annotation - Warning</option>
|
||||||
<option value="annotation.error" selected=(state.values.kind === "annotation.error")>Annotation - Error</option>
|
<option value="annotation.error" selected=(state.values.kind === "annotation.error")>Annotation - Error</option>
|
||||||
|
<option value="chars" selected=(state.values.kind === "chars")>Character Hints</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<label>Nick</label>
|
<label>Nick</label>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<option value="annotation.info" selected=(state.values.kind === "annotation.info")>Annotation - Info</option>
|
<option value="annotation.info" selected=(state.values.kind === "annotation.info")>Annotation - Info</option>
|
||||||
<option value="annotation.warning" selected=(state.values.kind === "annotation.warning")>Annotation - Warning</option>
|
<option value="annotation.warning" selected=(state.values.kind === "annotation.warning")>Annotation - Warning</option>
|
||||||
<option value="annotation.error" selected=(state.values.kind === "annotation.error")>Annotation - Error</option>
|
<option value="annotation.error" selected=(state.values.kind === "annotation.error")>Annotation - Error</option>
|
||||||
|
<option value="chars" selected=(state.values.kind === "chars")>Character Hints</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<label>Nick</label>
|
<label>Nick</label>
|
||||||
|
|||||||
@@ -22,6 +22,9 @@
|
|||||||
<irc-caret-notation class="post-content" source=state.text />
|
<irc-caret-notation class="post-content" source=state.text />
|
||||||
</annotation>
|
</annotation>
|
||||||
</div>
|
</div>
|
||||||
|
<div if(input.post.kind === "chars") class="post-body color-menu" >
|
||||||
|
<p><em>Character hint: ${input.post.text}</em></p>
|
||||||
|
</div>
|
||||||
<div if(input.post.kind === "scene") class="post-body color-text">
|
<div if(input.post.kind === "scene") class="post-body color-text">
|
||||||
<irc-caret-notation class="post-content post-scene" source=state.text />
|
<irc-caret-notation class="post-content post-scene" source=state.text />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ module.exports = class {
|
|||||||
channelName: "",
|
channelName: "",
|
||||||
date: "",
|
date: "",
|
||||||
data: "",
|
data: "",
|
||||||
|
sessionThresholdHours: 12,
|
||||||
},
|
},
|
||||||
timezones: tz.names(),
|
timezones: tz.names(),
|
||||||
}
|
}
|
||||||
@@ -58,12 +59,24 @@ module.exports = class {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else if (input.importer === "MircLike") {
|
} 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
|
return
|
||||||
} else {
|
} else {
|
||||||
input.date = null;
|
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) !== "#") {
|
if (input.channelName.length < 2 || input.channelName.includes(" ") || input.channelName.includes(" ") || input.channelName.charAt(0) !== "#") {
|
||||||
this.state.error = "A valid channelName name is required"
|
this.state.error = "A valid channelName name is required"
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import moment from "moment"
|
|||||||
<select key="importer" autofocus class="big" placeholder="Kind" on-change("change", "importer") value=state.values.importer>
|
<select key="importer" autofocus class="big" placeholder="Kind" on-change("change", "importer") value=state.values.importer>
|
||||||
<option value="MircLike" selected=(state.values.importer === "MircLike")>mIRC-Like log</option>
|
<option value="MircLike" selected=(state.values.importer === "MircLike")>mIRC-Like log</option>
|
||||||
<option value="ForumLog" selected=(state.values.importer === "ForumLog")>Forum Log</option>
|
<option value="ForumLog" selected=(state.values.importer === "ForumLog")>Forum Log</option>
|
||||||
|
<option value="IrcCloud" selected=(state.values.importer === "IrcCloud")>IRCCloud log export</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<label>Timezone</label>
|
<label>Timezone</label>
|
||||||
@@ -25,6 +26,11 @@ import moment from "moment"
|
|||||||
<input key="date" class="big" placeholder="(Required)" on-change("change", "date") value=state.values.date />
|
<input key="date" class="big" placeholder="(Required)" on-change("change", "date") value=state.values.date />
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
<if(state.values.importer === "IrcCloud")>
|
||||||
|
<label>Session Change Threshold (Hours)</label>
|
||||||
|
<input key="sessionThreshold" class="big" placeholder="(Required)" on-change("change", "sessionThresholdHours") value=state.values.sessionThresholdHours />
|
||||||
|
</if>
|
||||||
|
|
||||||
<label>Content</label>
|
<label>Content</label>
|
||||||
<textarea key="data" placeholder="(Required)" class="tall" on-change("change", "data") value=state.values.data />
|
<textarea key="data" placeholder="(Required)" class="tall" on-change("change", "data") value=state.values.data />
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ module.exports = class {
|
|||||||
|
|
||||||
let fictionalDate = new Date(comment.fictionalDate)
|
let fictionalDate = new Date(comment.fictionalDate)
|
||||||
if (comment.fictionalDate && !Number.isNaN(fictionalDate.getTime()) && fictionalDate.getTime() !== 0) {
|
if (comment.fictionalDate && !Number.isNaN(fictionalDate.getTime()) && fictionalDate.getTime() !== 0) {
|
||||||
fictionalDate = moment(fictionalDate).format("MMM D, YYYY")
|
fictionalDate = moment.utc(fictionalDate).format("MMM D, YYYY")
|
||||||
} else {
|
} else {
|
||||||
fictionalDate = ""
|
fictionalDate = ""
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+7524
-24
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,12 @@ lasso.configure(require("./marko-config"))
|
|||||||
|
|
||||||
// Set trusted proxy
|
// Set trusted proxy
|
||||||
if (config.trustedProxy != null) {
|
if (config.trustedProxy != null) {
|
||||||
if (ip.isV4Format(config.trustedProxy) || ip.isV6Format(config.trustedProxy)) {
|
if (config.trustedProxy === "GATEWAY") {
|
||||||
|
const ip = require("child_process").execSync("/sbin/ip route|awk '/default/ { print $3 }'").toString().trim()
|
||||||
|
app.set('trust proxy', ip)
|
||||||
|
|
||||||
|
console.log("Trusting proxy from default gateway", ip);
|
||||||
|
} else if (ip.isV4Format(config.trustedProxy) || ip.isV6Format(config.trustedProxy)) {
|
||||||
app.set('trust proxy', config.trustedProxy)
|
app.set('trust proxy', config.trustedProxy)
|
||||||
|
|
||||||
console.log("Trusting proxy", config.trustedProxy);
|
console.log("Trusting proxy", config.trustedProxy);
|
||||||
@@ -128,4 +133,4 @@ app.listen(config.port, function() {
|
|||||||
|
|
||||||
// Handle shutdown signals (Docker needs this to shutdown quickly)
|
// Handle shutdown signals (Docker needs this to shutdown quickly)
|
||||||
process.on('SIGINT', () => process.exit(0))
|
process.on('SIGINT', () => process.exit(0))
|
||||||
process.on('SIGTERM', () => process.exit(0))
|
process.on('SIGTERM', () => process.exit(0))
|
||||||
|
|||||||
Reference in New Issue
Block a user