Use es6 import syntax
This commit is contained in:
parent
b2cc8d9531
commit
0cb8dc73bb
@ -11,9 +11,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const throttle = require("lodash/throttle");
|
import throttle from "lodash/throttle";
|
||||||
const constants = require("../js/constants");
|
import constants from "../js/constants";
|
||||||
const storage = require("../js/localStorage");
|
import storage from "../js/localStorage";
|
||||||
|
|
||||||
import Sidebar from "./Sidebar.vue";
|
import Sidebar from "./Sidebar.vue";
|
||||||
import ImageViewer from "./ImageViewer.vue";
|
import ImageViewer from "./ImageViewer.vue";
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const roundBadgeNumber = require("../js/helpers/roundBadgeNumber");
|
import roundBadgeNumber from "../js/helpers/roundBadgeNumber";
|
||||||
import ChannelWrapper from "./ChannelWrapper.vue";
|
import ChannelWrapper from "./ChannelWrapper.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -48,12 +48,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import Mousetrap from "mousetrap";
|
||||||
|
import {wrapCursor} from "undate";
|
||||||
import autocompletion from "../js/autocompletion";
|
import autocompletion from "../js/autocompletion";
|
||||||
const commands = require("../js/commands/index");
|
import commands from "../js/commands/index";
|
||||||
const socket = require("../js/socket");
|
import socket from "../js/socket";
|
||||||
const upload = require("../js/upload");
|
import upload from "../js/upload";
|
||||||
const Mousetrap = require("mousetrap");
|
|
||||||
const {wrapCursor} = require("undate");
|
|
||||||
|
|
||||||
const formattingHotkeys = {
|
const formattingHotkeys = {
|
||||||
"mod+k": "\x03",
|
"mod+k": "\x03",
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const fuzzy = require("fuzzy");
|
import {filter as fuzzyFilter} from "fuzzy";
|
||||||
import Username from "./Username.vue";
|
import Username from "./Username.vue";
|
||||||
import UsernameFiltered from "./UsernameFiltered.vue";
|
import UsernameFiltered from "./UsernameFiltered.vue";
|
||||||
import {generateUserContextMenu} from "../js/helpers/contextMenu.js";
|
import {generateUserContextMenu} from "../js/helpers/contextMenu.js";
|
||||||
@ -85,7 +85,7 @@ export default {
|
|||||||
// filteredUsers is computed, to avoid unnecessary filtering
|
// filteredUsers is computed, to avoid unnecessary filtering
|
||||||
// as it is shared between filtering and keybindings.
|
// as it is shared between filtering and keybindings.
|
||||||
filteredUsers() {
|
filteredUsers() {
|
||||||
return fuzzy.filter(this.userSearchInput, this.channel.users, {
|
return fuzzyFilter(this.userSearchInput, this.channel.users, {
|
||||||
pre: "<b>",
|
pre: "<b>",
|
||||||
post: "</b>",
|
post: "</b>",
|
||||||
extract: (u) => u.nick,
|
extract: (u) => u.nick,
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const Mousetrap = require("mousetrap");
|
import Mousetrap from "mousetrap";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ContextMenu",
|
name: "ContextMenu",
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const socket = require("../js/socket");
|
import socket from "../js/socket";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "InlineChannel",
|
name: "InlineChannel",
|
||||||
|
@ -107,7 +107,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const friendlysize = require("../js/helpers/friendlysize");
|
import friendlysize from "../js/helpers/friendlysize";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "LinkPreview",
|
name: "LinkPreview",
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const constants = require("../js/constants");
|
import constants from "../js/constants";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "LinkPreviewFileSize",
|
name: "LinkPreviewFileSize",
|
||||||
|
@ -75,8 +75,7 @@ import LinkPreview from "./LinkPreview.vue";
|
|||||||
import ParsedMessage from "./ParsedMessage.vue";
|
import ParsedMessage from "./ParsedMessage.vue";
|
||||||
import MessageTypes from "./MessageTypes";
|
import MessageTypes from "./MessageTypes";
|
||||||
import {generateUserContextMenu} from "../js/helpers/contextMenu.js";
|
import {generateUserContextMenu} from "../js/helpers/contextMenu.js";
|
||||||
|
import constants from "../js/constants";
|
||||||
const constants = require("../js/constants");
|
|
||||||
|
|
||||||
MessageTypes.ParsedMessage = ParsedMessage;
|
MessageTypes.ParsedMessage = ParsedMessage;
|
||||||
MessageTypes.LinkPreview = LinkPreview;
|
MessageTypes.LinkPreview = LinkPreview;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const constants = require("../js/constants");
|
import constants from "../js/constants";
|
||||||
import Message from "./Message.vue";
|
import Message from "./Message.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -56,8 +56,8 @@
|
|||||||
<script>
|
<script>
|
||||||
require("intersection-observer");
|
require("intersection-observer");
|
||||||
|
|
||||||
const constants = require("../js/constants");
|
import constants from "../js/constants";
|
||||||
const clipboard = require("../js/clipboard");
|
import clipboard from "../js/clipboard";
|
||||||
import socket from "../js/socket";
|
import socket from "../js/socket";
|
||||||
import Message from "./Message.vue";
|
import Message from "./Message.vue";
|
||||||
import MessageCondensed from "./MessageCondensed.vue";
|
import MessageCondensed from "./MessageCondensed.vue";
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// Second argument says it's recursive, third makes sure we only load templates.
|
// Second argument says it's recursive, third makes sure we only load templates.
|
||||||
const requireViews = require.context(".", false, /\.vue$/);
|
const requireViews = require.context(".", false, /\.vue$/);
|
||||||
|
|
||||||
module.exports = requireViews.keys().reduce((acc, path) => {
|
export default requireViews.keys().reduce((acc, path) => {
|
||||||
acc["message-" + path.substring(2, path.length - 4)] = requireViews(path).default;
|
acc["message-" + path.substring(2, path.length - 4)] = requireViews(path).default;
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
|
@ -47,10 +47,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const roundBadgeNumber = require("../js/helpers/roundBadgeNumber");
|
import roundBadgeNumber from "../js/helpers/roundBadgeNumber";
|
||||||
import ChannelWrapper from "./ChannelWrapper.vue";
|
import ChannelWrapper from "./ChannelWrapper.vue";
|
||||||
import socket from "../js/socket";
|
import socket from "../js/socket";
|
||||||
const storage = require("../js/localStorage");
|
import storage from "../js/localStorage";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Channel",
|
name: "Channel",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
const parse = require("../js/helpers/parse");
|
import parse from "../js/helpers/parse";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ParsedMessage",
|
name: "ParsedMessage",
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const Auth = require("../js/auth");
|
import Auth from "../js/auth";
|
||||||
const socket = require("../js/socket");
|
import socket from "../js/socket";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Session",
|
name: "Session",
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const colorClass = require("../js/helpers/colorClass");
|
import colorClass from "../js/helpers/colorClass";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Username",
|
name: "Username",
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const colorClass = require("../js/helpers/colorClass");
|
import colorClass from "../js/helpers/colorClass";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "UsernameFiltered",
|
name: "UsernameFiltered",
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const socket = require("../js/socket");
|
import socket from "../js/socket";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "VersionChecker",
|
name: "VersionChecker",
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const socket = require("../../js/socket");
|
import socket from "../../js/socket";
|
||||||
|
|
||||||
import NetworkForm from "../NetworkForm.vue";
|
import NetworkForm from "../NetworkForm.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const socket = require("../../js/socket");
|
import socket from "../../js/socket";
|
||||||
import NetworkForm from "../NetworkForm.vue";
|
import NetworkForm from "../NetworkForm.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const storage = require("../../js/localStorage");
|
import storage from "../../js/localStorage";
|
||||||
import socket from "../../js/socket";
|
import socket from "../../js/socket";
|
||||||
import RevealPassword from "../RevealPassword.vue";
|
import RevealPassword from "../RevealPassword.vue";
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const localStorage = require("./localStorage");
|
import storage from "./localStorage";
|
||||||
const location = require("./location");
|
import location from "./location";
|
||||||
|
|
||||||
module.exports = class Auth {
|
export default class Auth {
|
||||||
static signout() {
|
static signout() {
|
||||||
localStorage.clear();
|
storage.clear();
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const fuzzy = require("fuzzy");
|
import Mousetrap from "mousetrap";
|
||||||
const Mousetrap = require("mousetrap");
|
import {Textcomplete, Textarea} from "textcomplete";
|
||||||
const {Textcomplete, Textarea} = require("textcomplete");
|
import fuzzy from "fuzzy";
|
||||||
const emojiMap = require("./helpers/simplemap.json");
|
|
||||||
const constants = require("./constants");
|
import emojiMap from "./helpers/simplemap.json";
|
||||||
const store = require("./store").default;
|
import constants from "./constants";
|
||||||
|
import store from "./store";
|
||||||
|
|
||||||
export default enableAutocomplete;
|
export default enableAutocomplete;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
module.exports = function(chat) {
|
export default function(chat) {
|
||||||
// Disable in Firefox as it already copies flex text correctly
|
// Disable in Firefox as it already copies flex text correctly
|
||||||
if (typeof window.InstallTrigger !== "undefined") {
|
if (typeof window.InstallTrigger !== "undefined") {
|
||||||
return;
|
return;
|
||||||
@ -28,4 +28,4 @@ module.exports = function(chat) {
|
|||||||
selection.removeAllRanges();
|
selection.removeAllRanges();
|
||||||
selection.addRange(range);
|
selection.addRange(range);
|
||||||
}, 0);
|
}, 0);
|
||||||
};
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
exports.input = function() {
|
function input() {
|
||||||
const messageIds = [];
|
const messageIds = [];
|
||||||
|
|
||||||
for (const message of store.state.activeChannel.channel.messages) {
|
for (const message of store.state.activeChannel.channel.messages) {
|
||||||
@ -31,4 +31,6 @@ exports.input = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
export default {input};
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
exports.input = function() {
|
function input() {
|
||||||
const messageIds = [];
|
const messageIds = [];
|
||||||
|
|
||||||
for (const message of store.state.activeChannel.channel.messages) {
|
for (const message of store.state.activeChannel.channel.messages) {
|
||||||
@ -31,4 +31,6 @@ exports.input = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
export default {input};
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
// Second argument says it's recursive, third makes sure we only load javascript.
|
// Second argument says it's recursive, third makes sure we only load javascript.
|
||||||
const commands = require.context("./", true, /\.js$/);
|
const commands = require.context("./", true, /\.js$/);
|
||||||
|
|
||||||
module.exports = commands.keys().reduce((acc, path) => {
|
export default commands.keys().reduce((acc, path) => {
|
||||||
const command = path.substring(2, path.length - 3);
|
const command = path.substring(2, path.length - 3);
|
||||||
|
|
||||||
if (command === "index") {
|
if (command === "index") {
|
||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
acc[command] = commands(path);
|
acc[command] = commands(path).default;
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
const {switchToChannel} = require("../router");
|
import {switchToChannel} from "../router";
|
||||||
|
|
||||||
exports.input = function(args) {
|
function input(args) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
let channels = args[0];
|
let channels = args[0];
|
||||||
|
|
||||||
@ -44,4 +44,6 @@ exports.input = function(args) {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
export default {input};
|
||||||
|
@ -29,7 +29,7 @@ const timeFormats = {
|
|||||||
|
|
||||||
const sizeUnits = ["B", "KiB", "MiB", "GiB", "TiB"];
|
const sizeUnits = ["B", "KiB", "MiB", "GiB", "TiB"];
|
||||||
|
|
||||||
module.exports = {
|
export default {
|
||||||
colorCodeMap,
|
colorCodeMap,
|
||||||
commands: [],
|
commands: [],
|
||||||
condensedTypes,
|
condensedTypes,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Generates a string from "color-1" to "color-32" based on an input string
|
// Generates a string from "color-1" to "color-32" based on an input string
|
||||||
module.exports = function(str) {
|
export default (str) => {
|
||||||
let hash = 0;
|
let hash = 0;
|
||||||
|
|
||||||
for (let i = 0; i < str.length; i++) {
|
for (let i = 0; i < str.length; i++) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
import socket from "../socket";
|
import socket from "../socket";
|
||||||
|
|
||||||
export function generateChannelContextMenu($root, channel, network) {
|
export function generateChannelContextMenu($root, channel, network) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
||||||
|
|
||||||
module.exports = function(size) {
|
export default (size) => {
|
||||||
// Loosely inspired from https://stackoverflow.com/a/18650828/1935861
|
// Loosely inspired from https://stackoverflow.com/a/18650828/1935861
|
||||||
const i = size > 0 ? Math.floor(Math.log(size) / Math.log(1024)) : 0;
|
const i = size > 0 ? Math.floor(Math.log(size) / Math.log(1024)) : 0;
|
||||||
const fixedSize = parseFloat((size / Math.pow(1024, i)).toFixed(1));
|
const fixedSize = parseFloat((size / Math.pow(1024, i)).toFixed(1));
|
||||||
|
@ -11,4 +11,4 @@ function anyIntersection(a, b) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = anyIntersection;
|
export default anyIntersection;
|
||||||
|
@ -32,4 +32,4 @@ function fill(existingEntries, text) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = fill;
|
export default fill;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// Escapes the RegExp special characters "^", "$", "", ".", "*", "+", "?", "(",
|
// Escapes the RegExp special characters "^", "$", "", ".", "*", "+", "?", "(",
|
||||||
// ")", "[", "]", "{", "}", and "|" in string.
|
// ")", "[", "]", "{", "}", and "|" in string.
|
||||||
// See https://lodash.com/docs/#escapeRegExp
|
// See https://lodash.com/docs/#escapeRegExp
|
||||||
const escapeRegExp = require("lodash/escapeRegExp");
|
import escapeRegExp from "lodash/escapeRegExp";
|
||||||
|
|
||||||
// Given an array of channel prefixes (such as "#" and "&") and an array of user
|
// Given an array of channel prefixes (such as "#" and "&") and an array of user
|
||||||
// modes (such as "@" and "+"), this function extracts channels and nicks from a
|
// modes (such as "@" and "+"), this function extracts channels and nicks from a
|
||||||
@ -40,4 +40,4 @@ function findChannels(text, channelPrefixes, userModes) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = findChannels;
|
export default findChannels;
|
||||||
|
@ -17,4 +17,4 @@ function findEmoji(text) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = findEmoji;
|
export default findEmoji;
|
||||||
|
@ -25,4 +25,4 @@ function findNames(text, users) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = findNames;
|
export default findNames;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const anyIntersection = require("./anyIntersection");
|
import anyIntersection from "./anyIntersection";
|
||||||
const fill = require("./fill");
|
import fill from "./fill";
|
||||||
|
|
||||||
// Merge text part information within a styling fragment
|
// Merge text part information within a styling fragment
|
||||||
function assign(textPart, fragment) {
|
function assign(textPart, fragment) {
|
||||||
@ -51,4 +51,4 @@ function merge(textParts, styleFragments, cleanText) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = merge;
|
export default merge;
|
||||||
|
@ -234,4 +234,4 @@ function prepare(text) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = prepare;
|
export default prepare;
|
||||||
|
@ -2,6 +2,4 @@
|
|||||||
|
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
export const localetime = function(time) {
|
export default (time) => dayjs(time).format("D MMMM YYYY, HH:mm:ss");
|
||||||
return dayjs(time).format("D MMMM YYYY, HH:mm:ss");
|
|
||||||
};
|
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const parseStyle = require("./ircmessageparser/parseStyle");
|
import parseStyle from "./ircmessageparser/parseStyle";
|
||||||
const findChannels = require("./ircmessageparser/findChannels");
|
import findChannels from "./ircmessageparser/findChannels";
|
||||||
const findLinks = require("./ircmessageparser/findLinks");
|
import findLinks from "./ircmessageparser/findLinks";
|
||||||
const findEmoji = require("./ircmessageparser/findEmoji");
|
import findEmoji from "./ircmessageparser/findEmoji";
|
||||||
const findNames = require("./ircmessageparser/findNames");
|
import findNames from "./ircmessageparser/findNames";
|
||||||
const merge = require("./ircmessageparser/merge");
|
import merge from "./ircmessageparser/merge";
|
||||||
const colorClass = require("./colorClass");
|
import colorClass from "./colorClass";
|
||||||
const emojiMap = require("./fullnamemap.json");
|
import emojiMap from "./fullnamemap.json";
|
||||||
const LinkPreviewToggle = require("../../components/LinkPreviewToggle.vue").default;
|
import LinkPreviewToggle from "../../components/LinkPreviewToggle.vue";
|
||||||
const LinkPreviewFileSize = require("../../components/LinkPreviewFileSize.vue").default;
|
import LinkPreviewFileSize from "../../components/LinkPreviewFileSize.vue";
|
||||||
const InlineChannel = require("../../components/InlineChannel.vue").default;
|
import InlineChannel from "../../components/InlineChannel.vue";
|
||||||
|
import store from "../store";
|
||||||
|
import {generateUserContextMenu} from "./contextMenu";
|
||||||
|
|
||||||
const emojiModifiersRegex = /[\u{1f3fb}-\u{1f3ff}]/gu;
|
const emojiModifiersRegex = /[\u{1f3fb}-\u{1f3ff}]/gu;
|
||||||
const store = require("../store").default;
|
|
||||||
const {generateUserContextMenu} = require("./contextMenu");
|
|
||||||
|
|
||||||
// Create an HTML `span` with styling information for a given fragment
|
// Create an HTML `span` with styling information for a given fragment
|
||||||
function createFragment(fragment, createElement) {
|
function createFragment(fragment, createElement) {
|
||||||
@ -71,13 +72,7 @@ function createFragment(fragment, createElement) {
|
|||||||
|
|
||||||
// Transform an IRC message potentially filled with styling control codes, URLs,
|
// Transform an IRC message potentially filled with styling control codes, URLs,
|
||||||
// nicknames, and channels into a string of HTML elements to display on the client.
|
// nicknames, and channels into a string of HTML elements to display on the client.
|
||||||
module.exports = function parse(
|
function parse(createElement, text, message = undefined, network = undefined, $root) {
|
||||||
createElement,
|
|
||||||
text,
|
|
||||||
message = undefined,
|
|
||||||
network = undefined,
|
|
||||||
$root
|
|
||||||
) {
|
|
||||||
// Extract the styling information and get the plain text version from it
|
// Extract the styling information and get the plain text version from it
|
||||||
const styleFragments = parseStyle(text);
|
const styleFragments = parseStyle(text);
|
||||||
const cleanText = styleFragments.map((fragment) => fragment.text).join("");
|
const cleanText = styleFragments.map((fragment) => fragment.text).join("");
|
||||||
@ -220,4 +215,6 @@ module.exports = function parse(
|
|||||||
|
|
||||||
return fragments;
|
return fragments;
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
|
export default parse;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
module.exports = function(count) {
|
export default (count) => {
|
||||||
if (count < 1000) {
|
if (count < 1000) {
|
||||||
return count.toString();
|
return count.toString();
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
import Mousetrap from "mousetrap";
|
||||||
|
|
||||||
const $ = require("jquery");
|
const $ = require("jquery");
|
||||||
const Mousetrap = require("mousetrap");
|
import store from "./store";
|
||||||
const store = require("./store").default;
|
import {switchToChannel} from "./router";
|
||||||
const {switchToChannel} = require("./router");
|
|
||||||
|
|
||||||
// Switch to the next/previous window in the channel list.
|
// Switch to the next/previous window in the channel list.
|
||||||
Mousetrap.bind(["alt+up", "alt+down"], function(e, keys) {
|
Mousetrap.bind(["alt+up", "alt+down"], function(e, keys) {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
// https://github.com/thelounge/thelounge/issues/2699
|
// https://github.com/thelounge/thelounge/issues/2699
|
||||||
// https://www.chromium.org/for-testers/bug-reporting-guidelines/uncaught-securityerror-failed-to-read-the-localstorage-property-from-window-access-is-denied-for-this-document
|
// https://www.chromium.org/for-testers/bug-reporting-guidelines/uncaught-securityerror-failed-to-read-the-localstorage-property-from-window-access-is-denied-for-this-document
|
||||||
|
|
||||||
module.exports = {
|
export default {
|
||||||
set(key, value) {
|
set(key, value) {
|
||||||
try {
|
try {
|
||||||
window.localStorage.setItem(key, value);
|
window.localStorage.setItem(key, value);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// This is a thin wrapper around `window.location`, in order to contain the
|
// This is a thin wrapper around `window.location`, in order to contain the
|
||||||
// side-effects. Do not add logic to it as it cannot be tested, only mocked.
|
// side-effects. Do not add logic to it as it cannot be tested, only mocked.
|
||||||
module.exports = {
|
export default {
|
||||||
reload() {
|
reload() {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
},
|
},
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const Vue = require("vue").default;
|
import Vue from "vue";
|
||||||
const VueRouter = require("vue-router").default;
|
import VueRouter from "vue-router";
|
||||||
|
|
||||||
Vue.use(VueRouter);
|
Vue.use(VueRouter);
|
||||||
|
|
||||||
const store = require("./store").default;
|
import SignIn from "../components/Windows/SignIn.vue";
|
||||||
|
import Connect from "../components/Windows/Connect.vue";
|
||||||
const SignIn = require("../components/Windows/SignIn.vue").default;
|
import Settings from "../components/Windows/Settings.vue";
|
||||||
const Connect = require("../components/Windows/Connect.vue").default;
|
import Help from "../components/Windows/Help.vue";
|
||||||
const Settings = require("../components/Windows/Settings.vue").default;
|
import Changelog from "../components/Windows/Changelog.vue";
|
||||||
const Help = require("../components/Windows/Help.vue").default;
|
import NetworkEdit from "../components/Windows/NetworkEdit.vue";
|
||||||
const Changelog = require("../components/Windows/Changelog.vue").default;
|
import RoutedChat from "../components/RoutedChat.vue";
|
||||||
const NetworkEdit = require("../components/Windows/NetworkEdit.vue").default;
|
import constants from "./constants";
|
||||||
const RoutedChat = require("../components/RoutedChat.vue").default;
|
import store from "./store";
|
||||||
const constants = require("./constants");
|
|
||||||
|
|
||||||
const router = new VueRouter({
|
const router = new VueRouter({
|
||||||
routes: [
|
routes: [
|
||||||
@ -127,9 +127,8 @@ function navigate(routeName, params = {}) {
|
|||||||
router.push({name: routeName, params}).catch(() => {});
|
router.push({name: routeName, params}).catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
function switchToChannel(channel) {
|
||||||
initialize,
|
return navigate("RoutedChat", {id: channel.id});
|
||||||
router,
|
}
|
||||||
navigate,
|
|
||||||
switchToChannel: (channel) => navigate("RoutedChat", {id: channel.id}),
|
export {initialize, router, navigate, switchToChannel};
|
||||||
};
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const socket = require("./socket");
|
import socket from "./socket";
|
||||||
|
|
||||||
const defaultSettingConfig = {
|
const defaultSettingConfig = {
|
||||||
apply() {},
|
apply() {},
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const storage = require("../localStorage");
|
import storage from "../localStorage";
|
||||||
const {router, navigate} = require("../router");
|
import {router, navigate} from "../router";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
import location from "../location";
|
||||||
let lastServerHash = null;
|
let lastServerHash = null;
|
||||||
|
|
||||||
socket.on("auth:success", function() {
|
socket.on("auth:success", function() {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
socket.on("changelog", function(data) {
|
socket.on("changelog", function(data) {
|
||||||
store.commit("versionData", data);
|
store.commit("versionData", data);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const constants = require("../constants");
|
import constants from "../constants";
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
|
|
||||||
socket.on("commands", function(commands) {
|
socket.on("commands", function(commands) {
|
||||||
if (commands) {
|
if (commands) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const upload = require("../upload");
|
import upload from "../upload";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
const router = require("../router");
|
import {initialize as routerInitialize} from "../router";
|
||||||
|
|
||||||
socket.once("configuration", function(data) {
|
socket.once("configuration", function(data) {
|
||||||
store.commit("serverConfiguration", data);
|
store.commit("serverConfiguration", data);
|
||||||
@ -17,7 +17,7 @@ socket.once("configuration", function(data) {
|
|||||||
upload.initialize();
|
upload.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
router.initialize();
|
routerInitialize();
|
||||||
|
|
||||||
// If localStorage contains a theme that does not exist on this server, switch
|
// If localStorage contains a theme that does not exist on this server, switch
|
||||||
// back to its default theme.
|
// back to its default theme.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
|
|
||||||
socket.on("disconnect", handleDisconnect);
|
socket.on("disconnect", handleDisconnect);
|
||||||
socket.on("connect_error", handleDisconnect);
|
socket.on("connect_error", handleDisconnect);
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
require("./connection");
|
import "./connection";
|
||||||
require("./auth");
|
import "./auth";
|
||||||
require("./commands");
|
import "./commands";
|
||||||
require("./init");
|
import "./init";
|
||||||
require("./join");
|
import "./join";
|
||||||
require("./more");
|
import "./more";
|
||||||
require("./msg");
|
import "./msg";
|
||||||
require("./msg_preview");
|
import "./msg_preview";
|
||||||
require("./msg_special");
|
import "./msg_special";
|
||||||
require("./names");
|
import "./names";
|
||||||
require("./network");
|
import "./network";
|
||||||
require("./nick");
|
import "./nick";
|
||||||
require("./open");
|
import "./open";
|
||||||
require("./part");
|
import "./part";
|
||||||
require("./quit");
|
import "./quit";
|
||||||
require("./sync_sort");
|
import "./sync_sort";
|
||||||
require("./topic");
|
import "./topic";
|
||||||
require("./users");
|
import "./users";
|
||||||
require("./sign_out");
|
import "./sign_out";
|
||||||
require("./sessions_list");
|
import "./sessions_list";
|
||||||
require("./configuration");
|
import "./configuration";
|
||||||
require("./changelog");
|
import "./changelog";
|
||||||
require("./setting");
|
import "./setting";
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const storage = require("../localStorage");
|
import storage from "../localStorage";
|
||||||
const {router, switchToChannel, navigate} = require("../router");
|
import {router, switchToChannel, navigate} from "../router";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
socket.on("init", function(data) {
|
socket.on("init", function(data) {
|
||||||
store.commit("networks", mergeNetworkData(data.networks));
|
store.commit("networks", mergeNetworkData(data.networks));
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
const {switchToChannel} = require("../router");
|
import {switchToChannel} from "../router";
|
||||||
|
|
||||||
socket.on("join", function(data) {
|
socket.on("join", function(data) {
|
||||||
store.getters.initChannel(data.chan);
|
store.getters.initChannel(data.chan);
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
socket.on("more", function(data) {
|
socket.on("more", function(data) {
|
||||||
const channel = store.getters.findChannel(data.chan);
|
const channel = store.getters.findChannel(data.chan);
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const cleanIrcMessage = require("../helpers/ircmessageparser/cleanIrcMessage");
|
import cleanIrcMessage from "../helpers/ircmessageparser/cleanIrcMessage";
|
||||||
const webpush = require("../webpush");
|
import store from "../store";
|
||||||
const store = require("../store").default;
|
import {switchToChannel} from "../router";
|
||||||
const {switchToChannel} = require("../router");
|
|
||||||
|
|
||||||
let pop;
|
let pop;
|
||||||
|
|
||||||
@ -129,7 +128,7 @@ function notifyMessage(targetId, channel, activeChannel, msg) {
|
|||||||
const timestamp = Date.parse(msg.time);
|
const timestamp = Date.parse(msg.time);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (webpush.hasServiceWorker) {
|
if (store.state.hasServiceWorker) {
|
||||||
navigator.serviceWorker.ready.then((registration) => {
|
navigator.serviceWorker.ready.then((registration) => {
|
||||||
registration.active.postMessage({
|
registration.active.postMessage({
|
||||||
type: "notification",
|
type: "notification",
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
socket.on("msg:preview", function(data) {
|
socket.on("msg:preview", function(data) {
|
||||||
const {channel} = store.getters.findChannel(data.chan);
|
const {channel} = store.getters.findChannel(data.chan);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
const {switchToChannel} = require("../router");
|
import {switchToChannel} from "../router";
|
||||||
|
|
||||||
socket.on("msg:special", function(data) {
|
socket.on("msg:special", function(data) {
|
||||||
const channel = store.getters.findChannel(data.chan);
|
const channel = store.getters.findChannel(data.chan);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
socket.on("names", function(data) {
|
socket.on("names", function(data) {
|
||||||
const channel = store.getters.findChannel(data.id);
|
const channel = store.getters.findChannel(data.id);
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
const {switchToChannel} = require("../router");
|
import {switchToChannel} from "../router";
|
||||||
|
|
||||||
socket.on("network", function(data) {
|
socket.on("network", function(data) {
|
||||||
const network = data.networks[0];
|
const network = data.networks[0];
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
socket.on("nick", function(data) {
|
socket.on("nick", function(data) {
|
||||||
const network = store.getters.findNetwork(data.network);
|
const network = store.getters.findNetwork(data.network);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
// Sync unread badge and marker when other clients open a channel
|
// Sync unread badge and marker when other clients open a channel
|
||||||
socket.on("open", function(id) {
|
socket.on("open", function(id) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
const {switchToChannel} = require("../router");
|
import {switchToChannel} from "../router";
|
||||||
|
|
||||||
socket.on("part", function(data) {
|
socket.on("part", function(data) {
|
||||||
// When parting from the active channel/query, jump to the network's lobby
|
// When parting from the active channel/query, jump to the network's lobby
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const {switchToChannel, navigate} = require("../router");
|
import {switchToChannel, navigate} from "../router";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
socket.on("quit", function(data) {
|
socket.on("quit", function(data) {
|
||||||
// If we're in a channel, and it's on the network that is being removed,
|
// If we're in a channel, and it's on the network that is being removed,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
socket.on("sessions:list", function(data) {
|
socket.on("sessions:list", function(data) {
|
||||||
data.sort((a, b) => b.lastUse - a.lastUse);
|
data.sort((a, b) => b.lastUse - a.lastUse);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
socket.on("setting:new", function(data) {
|
socket.on("setting:new", function(data) {
|
||||||
const name = data.name;
|
const name = data.name;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const Auth = require("../auth");
|
import Auth from "../auth";
|
||||||
|
|
||||||
socket.on("sign-out", function() {
|
socket.on("sign-out", function() {
|
||||||
Auth.signout();
|
Auth.signout();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
socket.on("sync_sort", function(data) {
|
socket.on("sync_sort", function(data) {
|
||||||
const order = data.order;
|
const order = data.order;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
socket.on("topic", function(data) {
|
socket.on("topic", function(data) {
|
||||||
const channel = store.getters.findChannel(data.chan);
|
const channel = store.getters.findChannel(data.chan);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
import socket from "../socket";
|
||||||
const store = require("../store").default;
|
import store from "../store";
|
||||||
|
|
||||||
socket.on("users", function(data) {
|
socket.on("users", function(data) {
|
||||||
if (store.state.activeChannel && store.state.activeChannel.channel.id === data.chan) {
|
if (store.state.activeChannel && store.state.activeChannel.channel.id === data.chan) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const io = require("socket.io-client");
|
import io from "socket.io-client";
|
||||||
|
|
||||||
const socket = io({
|
const socket = io({
|
||||||
transports: JSON.parse(document.body.dataset.transports),
|
transports: JSON.parse(document.body.dataset.transports),
|
||||||
@ -9,4 +9,4 @@ const socket = io({
|
|||||||
reconnection: !document.body.classList.contains("public"),
|
reconnection: !document.body.classList.contains("public"),
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = socket;
|
export default socket;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const storage = require("./localStorage");
|
import storage from "./localStorage";
|
||||||
const socket = require("./socket");
|
import socket from "./socket";
|
||||||
import {config, createState} from "./settings";
|
import {config, createState} from "./settings";
|
||||||
|
|
||||||
export function createSettingsStore(store) {
|
export function createSettingsStore(store) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
import Vuex from "vuex";
|
import Vuex from "vuex";
|
||||||
import {createSettingsStore} from "./store-settings";
|
import {createSettingsStore} from "./store-settings";
|
||||||
|
import storage from "./localStorage";
|
||||||
|
|
||||||
const storage = require("./localStorage");
|
|
||||||
const appName = document.title;
|
const appName = document.title;
|
||||||
|
|
||||||
Vue.use(Vuex);
|
Vue.use(Vuex);
|
||||||
@ -26,6 +26,7 @@ const store = new Vuex.Store({
|
|||||||
isAutoCompleting: false,
|
isAutoCompleting: false,
|
||||||
isConnected: false,
|
isConnected: false,
|
||||||
networks: [],
|
networks: [],
|
||||||
|
hasServiceWorker: false,
|
||||||
pushNotificationState: "unsupported",
|
pushNotificationState: "unsupported",
|
||||||
serverConfiguration: null,
|
serverConfiguration: null,
|
||||||
sessions: [],
|
sessions: [],
|
||||||
@ -67,6 +68,9 @@ const store = new Vuex.Store({
|
|||||||
sortNetworks(state, sortFn) {
|
sortNetworks(state, sortFn) {
|
||||||
state.networks.sort(sortFn);
|
state.networks.sort(sortFn);
|
||||||
},
|
},
|
||||||
|
hasServiceWorker(state) {
|
||||||
|
state.hasServiceWorker = true;
|
||||||
|
},
|
||||||
pushNotificationState(state, pushNotificationState) {
|
pushNotificationState(state, pushNotificationState) {
|
||||||
state.pushNotificationState = pushNotificationState;
|
state.pushNotificationState = pushNotificationState;
|
||||||
},
|
},
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("./socket");
|
import {update as updateCursor} from "undate";
|
||||||
const updateCursor = require("undate").update;
|
|
||||||
const store = require("./store").default;
|
import socket from "./socket";
|
||||||
|
import store from "./store";
|
||||||
|
|
||||||
class Uploader {
|
class Uploader {
|
||||||
init() {
|
init() {
|
||||||
@ -219,7 +220,7 @@ class Uploader {
|
|||||||
|
|
||||||
const instance = new Uploader();
|
const instance = new Uploader();
|
||||||
|
|
||||||
module.exports = {
|
export default {
|
||||||
abort: () => instance.abort(),
|
abort: () => instance.abort(),
|
||||||
initialize: () => instance.init(),
|
initialize: () => instance.init(),
|
||||||
mounted: () => instance.mounted(),
|
mounted: () => instance.mounted(),
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const Vue = require("vue").default;
|
import Vue from "vue";
|
||||||
|
import store from "./store";
|
||||||
const store = require("./store").default;
|
import App from "../components/App.vue";
|
||||||
const App = require("../components/App.vue").default;
|
import localetime from "./helpers/localetime";
|
||||||
const {localetime} = require("./helpers/localetime");
|
import storage from "./localStorage";
|
||||||
const storage = require("./localStorage");
|
import {router, navigate} from "./router";
|
||||||
const {router, navigate} = require("./router");
|
import constants from "./constants";
|
||||||
const constants = require("./constants");
|
import socket from "./socket";
|
||||||
const socket = require("./socket");
|
|
||||||
|
|
||||||
Vue.filter("localetime", localetime);
|
Vue.filter("localetime", localetime);
|
||||||
|
|
||||||
require("./socket-events");
|
import "./socket-events";
|
||||||
require("./webpush");
|
import "./webpush";
|
||||||
require("./keybinds");
|
import "./keybinds";
|
||||||
|
|
||||||
const favicon = document.getElementById("favicon");
|
const favicon = document.getElementById("favicon");
|
||||||
const faviconNormal = favicon.getAttribute("href");
|
const faviconNormal = favicon.getAttribute("href");
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("./socket");
|
import socket from "./socket";
|
||||||
const store = require("./store").default;
|
import store from "./store";
|
||||||
const {switchToChannel} = require("./router");
|
import {switchToChannel} from "./router";
|
||||||
|
|
||||||
|
export default {togglePushSubscription};
|
||||||
|
|
||||||
if ("serviceWorker" in navigator) {
|
if ("serviceWorker" in navigator) {
|
||||||
navigator.serviceWorker.addEventListener("message", (event) => {
|
navigator.serviceWorker.addEventListener("message", (event) => {
|
||||||
@ -17,8 +19,6 @@ if ("serviceWorker" in navigator) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.hasServiceWorker = false;
|
|
||||||
|
|
||||||
socket.once("push:issubscribed", function(hasSubscriptionOnServer) {
|
socket.once("push:issubscribed", function(hasSubscriptionOnServer) {
|
||||||
if (!isAllowedServiceWorkersHost()) {
|
if (!isAllowedServiceWorkersHost()) {
|
||||||
store.commit("pushNotificationState", "nohttps");
|
store.commit("pushNotificationState", "nohttps");
|
||||||
@ -32,7 +32,7 @@ socket.once("push:issubscribed", function(hasSubscriptionOnServer) {
|
|||||||
navigator.serviceWorker
|
navigator.serviceWorker
|
||||||
.register("service-worker.js")
|
.register("service-worker.js")
|
||||||
.then((registration) => {
|
.then((registration) => {
|
||||||
module.exports.hasServiceWorker = true;
|
store.commit("hasServiceWorker");
|
||||||
|
|
||||||
if (!registration.pushManager) {
|
if (!registration.pushManager) {
|
||||||
return;
|
return;
|
||||||
@ -62,7 +62,7 @@ socket.once("push:issubscribed", function(hasSubscriptionOnServer) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports.togglePushSubscription = () => {
|
function togglePushSubscription() {
|
||||||
store.commit("pushNotificationState", "loading");
|
store.commit("pushNotificationState", "loading");
|
||||||
|
|
||||||
navigator.serviceWorker.ready
|
navigator.serviceWorker.ready
|
||||||
@ -94,7 +94,7 @@ module.exports.togglePushSubscription = () => {
|
|||||||
store.commit("pushNotificationState", "unsupported");
|
store.commit("pushNotificationState", "unsupported");
|
||||||
console.error(err); // eslint-disable-line no-console
|
console.error(err); // eslint-disable-line no-console
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
function isAllowedServiceWorkersHost() {
|
function isAllowedServiceWorkersHost() {
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user