Added 'prefetch' option

This commit is contained in:
Mattias Erming 2014-10-10 23:12:01 +02:00
parent 66352d6519
commit 681d3dac1a
3 changed files with 19 additions and 0 deletions

View File

@ -209,6 +209,7 @@
Enable colored nicknames
</label>
</div>
<% if (typeof prefetch === "undefined" || prefetch !== false) { %>
<div class="col-sm-12">
<h2>Links and URLs</h2>
</div>
@ -224,6 +225,7 @@
Auto-expand links
</label>
</div>
<% } %>
<div class="col-sm-12">
<h2>Notifications</h2>
</div>

View File

@ -45,6 +45,17 @@ module.exports = {
//
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
//

View File

@ -2,10 +2,16 @@ var _ = require("lodash");
var cheerio = require("cheerio");
var Msg = require("../../models/msg");
var request = require("superagent");
var Helper = require("../../helper");
module.exports = function(irc, network) {
var client = this;
irc.on("message", function(data) {
var config = Helper.getConfig();
if (!config.prefetch) {
return;
}
var links = [];
var split = data.message.split(" ");
_.each(split, function(w) {