-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e9a7be6
Showing
56 changed files
with
141,120 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,317 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>Worldstate Emitter Source: handlers/RSS.js</title> | ||
|
||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/sunlight.dark.css"> | ||
|
||
<link type="text/css" rel="stylesheet" href="styles/site.cosmo.css"> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
<div class="navbar navbar-default navbar-fixed-top navbar-inverse"> | ||
<div class="container"> | ||
<div class="navbar-header"> | ||
<a class="navbar-brand" href="index.html">Worldstate Emitter</a> | ||
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation"> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
</button> | ||
</div> | ||
<div class="navbar-collapse collapse" id="topNavigation"> | ||
<ul class="nav navbar-nav"> | ||
|
||
<li class="dropdown"> | ||
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a> | ||
<ul class="dropdown-menu inline"> | ||
<li><a href="module.html#.exports">module.exports</a></li> | ||
</ul> | ||
</li> | ||
|
||
<li class="dropdown"> | ||
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a> | ||
<ul class="dropdown-menu inline"> | ||
<li><a href="global.html#arbitration">arbitration</a></li><li><a href="global.html#between">between</a></li><li><a href="global.html#data">data</a></li><li><a href="global.html#emit">emit</a></li><li><a href="global.html#fromNow">fromNow</a></li><li><a href="global.html#get">get</a></li><li><a href="global.html#getData">getData</a></li><li><a href="global.html#getParseableData">getParseableData</a></li><li><a href="global.html#groupBy">groupBy</a></li><li><a href="global.html#initCycleStart">initCycleStart</a></li><li><a href="global.html#lastUpdated">lastUpdated</a></li><li><a href="global.html#onError">onError</a></li><li><a href="global.html#parseEvents">parseEvents</a></li><li><a href="global.html#setUpRawEmitters">setUpRawEmitters</a></li><li><a href="global.html#setupParsedEvents">setupParsedEvents</a></li><li><a href="global.html#twitter">twitter</a></li><li><a href="global.html#update">update</a></li> | ||
</ul> | ||
</li> | ||
|
||
</ul> | ||
|
||
<div class="col-sm-3 col-md-3"> | ||
<form class="navbar-form" role="search"> | ||
<div class="input-group"> | ||
<input type="text" class="form-control" placeholder="Search" name="q" id="search-input"> | ||
<div class="input-group-btn"> | ||
<button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
|
||
<div class="container" id="toc-content"> | ||
<div class="row"> | ||
|
||
|
||
<div class="col-md-12"> | ||
|
||
<div id="main"> | ||
|
||
|
||
<h1 class="page-title">Source: handlers/RSS.js</h1> | ||
|
||
<section> | ||
<article> | ||
<pre | ||
class="sunlight-highlight-javascript linenums">import RssFeedEmitter from 'rss-feed-emitter'; | ||
|
||
import feeds from '../resources/rssFeeds.json' assert { type: 'json' }; | ||
import { logger } from '../utilities/index.js'; | ||
|
||
/** | ||
* RSS Emitter, leverages [rss-feed-emitter](https://npmjs.org/package/rss-feed-emitter) | ||
*/ | ||
export default class RSS { | ||
/** | ||
* Set up emitting events for warframe forum entries | ||
* @param {EventEmitter} eventEmitter Emitter to send events from | ||
*/ | ||
constructor(eventEmitter) { | ||
this.logger = logger; | ||
this.emitter = eventEmitter; | ||
this.feeder = new RssFeedEmitter({ | ||
userAgent: 'WFCD Feed Notifier', | ||
skipFirstLoad: true, | ||
}); | ||
|
||
feeds.forEach((feed) => { | ||
this.feeder.add({ url: feed.url, timeout: 30000 }); | ||
}); | ||
this.logger.debug('RSS Feed active'); | ||
|
||
this.start = Date.now(); | ||
this.feeder.on('error', this.logger.error.bind(this.logger)); | ||
this.feeder.on('new-item', this.handleNew.bind(this)); | ||
} | ||
|
||
handleNew(item) { | ||
try { | ||
if (Object.keys(item.image).length) { | ||
this.logger.debug(`Image: ${JSON.stringify(item.image)}`); | ||
} | ||
if (new Date(item.pubDate).getTime() <= this.start) return; | ||
|
||
const feed = feeds.filter((feedEntry) => feedEntry.url === item.meta.link)[0]; | ||
let firstImg = ((item.description || '').match(/<img.*src="(.*)".*>/i) || [])[1]; | ||
if (!firstImg) { | ||
firstImg = feed.defaultAttach; | ||
} else if (firstImg.startsWith('//')) { | ||
firstImg = firstImg.replace('//', 'https://'); | ||
} | ||
|
||
const rssSummary = { | ||
body: (item.description || '\u200B').replace(/<(?:.|\n)*?>/gm, '').replace(/\n\n+\s*/gm, '\n\n'), | ||
url: item.link, | ||
timestamp: item.pubDate, | ||
description: item.meta.description, | ||
author: feed.author || { | ||
name: 'Warframe Forums', | ||
url: item['rss:link']['#'], | ||
icon_url: 'https://i.imgur.com/hE2jdpv.png', | ||
}, | ||
title: item.title, | ||
image: firstImg, | ||
id: feed.key, | ||
}; | ||
this.emitter.emit('rss', rssSummary); | ||
} catch (error) { | ||
this.logger.error(error); | ||
} | ||
} | ||
} | ||
</pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
|
||
</div> | ||
</div> | ||
|
||
<div class="clearfix"></div> | ||
|
||
|
||
|
||
</div> | ||
</div> | ||
|
||
|
||
<div class="modal fade" id="searchResults"> | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
<h4 class="modal-title">Search results</h4> | ||
</div> | ||
<div class="modal-body"></div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | ||
</div> | ||
</div><!-- /.modal-content --> | ||
</div><!-- /.modal-dialog --> | ||
</div> | ||
|
||
|
||
<footer> | ||
|
||
|
||
<span class="copyright"> | ||
©2024, WFCD | ||
</span> | ||
|
||
<span class="jsdoc-message"> | ||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> | ||
|
||
on Wednesday, April 24th 2024, 18:47:18 | ||
|
||
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. | ||
</span> | ||
</footer> | ||
|
||
<script src="scripts/docstrap.lib.js"></script> | ||
<script src="scripts/toc.js"></script> | ||
|
||
<script type="text/javascript" src="scripts/fulltext-search-ui.js"></script> | ||
|
||
|
||
<script> | ||
$( function () { | ||
$( "[id*='$']" ).each( function () { | ||
var $this = $( this ); | ||
|
||
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) ); | ||
} ); | ||
|
||
$( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () { | ||
var $this = $( this ); | ||
|
||
var example = $this.find( "code" ); | ||
exampleText = example.html(); | ||
var lang = /{@lang (.*?)}/.exec( exampleText ); | ||
if ( lang && lang[1] ) { | ||
exampleText = exampleText.replace( lang[0], "" ); | ||
example.html( exampleText ); | ||
lang = lang[1]; | ||
} else { | ||
var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/); | ||
lang = langClassMatch ? langClassMatch[1] : "javascript"; | ||
} | ||
|
||
if ( lang ) { | ||
|
||
$this | ||
.addClass( "sunlight-highlight-" + lang ) | ||
.addClass( "linenums" ) | ||
.html( example.html() ); | ||
|
||
} | ||
} ); | ||
|
||
Sunlight.highlightAll( { | ||
lineNumbers : true, | ||
showMenu : true, | ||
enableDoclinks : true | ||
} ); | ||
|
||
$.catchAnchorLinks( { | ||
navbarOffset: 10 | ||
} ); | ||
$( "#toc" ).toc( { | ||
anchorName : function ( i, heading, prefix ) { | ||
return $( heading ).attr( "id" ) || ( prefix + i ); | ||
}, | ||
selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4", | ||
showAndHide : false, | ||
smoothScrolling: true | ||
} ); | ||
|
||
$( "#main span[id^='toc']" ).addClass( "toc-shim" ); | ||
$( '.dropdown-toggle' ).dropdown(); | ||
|
||
$( "table" ).each( function () { | ||
var $this = $( this ); | ||
$this.addClass('table'); | ||
} ); | ||
|
||
} ); | ||
</script> | ||
|
||
|
||
|
||
<!--Navigation and Symbol Display--> | ||
|
||
<script> | ||
$( function () { | ||
$( '#main' ).localScroll( { | ||
offset : { top : 60 } //offset by the height of your header (give or take a few px, see what works for you) | ||
} ); | ||
$( "dt.name" ).each( function () { | ||
var $this = $( this ).find("h4"); | ||
var icon = $( "<i/>" ).addClass( "icon-plus-sign" ).addClass( "pull-right" ).addClass( "icon-white" ); | ||
var dt = $(this); | ||
var children = dt.next( "dd" ); | ||
|
||
dt.prepend( icon ).css( {cursor : "pointer"} ); | ||
dt.addClass( "member-collapsed" ).addClass( "member" ); | ||
|
||
|
||
children.hide(); | ||
|
||
dt.children().on( "click", function () { | ||
children = dt.next( "dd" ); | ||
children.slideToggle( "fast", function () { | ||
|
||
if ( children.is( ":visible" ) ) { | ||
icon.addClass( "icon-minus-sign" ).removeClass( "icon-plus-sign" ).removeClass( "icon-white" ); | ||
dt.addClass( "member-open" ).animate( "member-collapsed" ); | ||
} else { | ||
icon.addClass( "icon-plus-sign" ).removeClass( "icon-minus-sign" ).addClass( "icon-white" ); | ||
dt.addClass( "member-collapsed" ).removeClass( "member-open" ); | ||
} | ||
} ); | ||
} ); | ||
|
||
} ); | ||
} ); | ||
</script> | ||
|
||
|
||
<!--Google Analytics--> | ||
|
||
|
||
|
||
<script type="text/javascript"> | ||
$(document).ready(function() { | ||
SearcherDisplay.init(); | ||
}); | ||
</script> | ||
|
||
|
||
</body> | ||
</html> |
Oops, something went wrong.