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 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>

View File

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

View File

@ -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) {