mirror of
https://github.com/thelounge/thelounge
synced 2024-11-23 12:33:07 +00:00
Added 'prefetch' option
This commit is contained in:
parent
66352d6519
commit
681d3dac1a
3 changed files with 19 additions and 0 deletions
|
@ -209,6 +209,7 @@
|
||||||
Enable colored nicknames
|
Enable colored nicknames
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<% if (typeof prefetch === "undefined" || prefetch !== false) { %>
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<h2>Links and URLs</h2>
|
<h2>Links and URLs</h2>
|
||||||
</div>
|
</div>
|
||||||
|
@ -224,6 +225,7 @@
|
||||||
Auto-expand links
|
Auto-expand links
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<% } %>
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<h2>Notifications</h2>
|
<h2>Notifications</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
11
config.js
11
config.js
|
@ -44,6 +44,17 @@ module.exports = {
|
||||||
// @default true
|
// @default true
|
||||||
//
|
//
|
||||||
autoload: true,
|
autoload: true,
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prefetch URLs
|
||||||
|
//
|
||||||
|
// If enabled, Shout will try to load thumbnails and site descriptions from
|
||||||
|
// URLs posted in channels.
|
||||||
|
//
|
||||||
|
// @type boolean
|
||||||
|
// @default true
|
||||||
|
//
|
||||||
|
prefetch: true,
|
||||||
|
|
||||||
//
|
//
|
||||||
// Log settings
|
// Log settings
|
||||||
|
|
|
@ -2,10 +2,16 @@ var _ = require("lodash");
|
||||||
var cheerio = require("cheerio");
|
var cheerio = require("cheerio");
|
||||||
var Msg = require("../../models/msg");
|
var Msg = require("../../models/msg");
|
||||||
var request = require("superagent");
|
var request = require("superagent");
|
||||||
|
var Helper = require("../../helper");
|
||||||
|
|
||||||
module.exports = function(irc, network) {
|
module.exports = function(irc, network) {
|
||||||
var client = this;
|
var client = this;
|
||||||
irc.on("message", function(data) {
|
irc.on("message", function(data) {
|
||||||
|
var config = Helper.getConfig();
|
||||||
|
if (!config.prefetch) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var links = [];
|
var links = [];
|
||||||
var split = data.message.split(" ");
|
var split = data.message.split(" ");
|
||||||
_.each(split, function(w) {
|
_.each(split, function(w) {
|
||||||
|
|
Loading…
Reference in a new issue