mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
renaming "rss" to "feed"
This commit is contained in:
parent
b7ba4b3bc0
commit
a379f605cf
22 changed files with 72 additions and 71 deletions
|
@ -75,6 +75,6 @@ telescope-kadira
|
||||||
telescope-notifications
|
telescope-notifications
|
||||||
telescope-singleday
|
telescope-singleday
|
||||||
telescope-invites
|
telescope-invites
|
||||||
telescope-post-by-rss
|
telescope-post-by-feed
|
||||||
|
|
||||||
# Custom Packages
|
# Custom Packages
|
||||||
|
|
4
packages/telescope-post-by-feed/i18n/en.i18n.json
Normal file
4
packages/telescope-post-by-feed/i18n/en.i18n.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"feed_already_exists": "A feed with the same URL already exists.",
|
||||||
|
"you_need_to_login_and_be_an_admin_to_add_a_new_feed": "You need to log in and be an admin to add a new feed."
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
<template name="feedItem">
|
||||||
|
<li>
|
||||||
|
<span>Url: {{url}}</span>
|
||||||
|
<a class="delete-feed" href="#">Delete</a>
|
||||||
|
</li>
|
||||||
|
</template>
|
|
@ -0,0 +1,10 @@
|
||||||
|
Meteor.startup(function () {
|
||||||
|
Template[getTemplate('feedItem')].events({
|
||||||
|
'click .delete-feed': function(e, instance){
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
if (confirm(i18n.t('are_you_sure')))
|
||||||
|
Feeds.remove(instance.data._id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,9 +1,9 @@
|
||||||
<template name="rssUrls">
|
<template name="rssUrls">
|
||||||
<div class="grid-small grid-module dialog admin">
|
<div class="grid-small grid-module dialog admin">
|
||||||
<h2>RSS Urls</h2>
|
<h2>Feeds</h2>
|
||||||
|
|
||||||
<form class="form-block">
|
<form class="form-block">
|
||||||
<h3>Add new RSS Url</h3>
|
<h3>Add New Feed</h3>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label>Url</label>
|
<label>Url</label>
|
||||||
<div class="controls"><input id="url" type="text" value="" /></div>
|
<div class="controls"><input id="url" type="text" value="" /></div>
|
||||||
|
@ -13,8 +13,8 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<ul>
|
<ul>
|
||||||
{{#each rssUrls}}
|
{{#each feeds}}
|
||||||
{{> UI.dynamic template=rssUrlItem}}
|
{{> UI.dynamic template=feedItem}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
|
@ -1,20 +1,20 @@
|
||||||
Meteor.startup(function () {
|
Meteor.startup(function () {
|
||||||
Template[getTemplate('rssUrls')].helpers({
|
Template[getTemplate('feeds')].helpers({
|
||||||
rssUrls: function(){
|
feeds: function(){
|
||||||
return RssUrls.find({}, {sort: {url: 1}});
|
return Feeds.find({}, {sort: {url: 1}});
|
||||||
},
|
},
|
||||||
rssUrlItem: function () {
|
feedItem: function () {
|
||||||
return getTemplate('rssUrlItem');
|
return getTemplate('feedItem');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Template[getTemplate('rssUrls')].events({
|
Template[getTemplate('feeds')].events({
|
||||||
'click input[type=submit]': function(e){
|
'click input[type=submit]': function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var url = $('#url').val();
|
var url = $('#url').val();
|
||||||
|
|
||||||
Meteor.call('insertRssUrl', {url: url}, function(error, result) {
|
Meteor.call('insertFeed', {url: url}, function(error, result) {
|
||||||
if(error){
|
if(error){
|
||||||
console.log(error);
|
console.log(error);
|
||||||
flashMessage(error.reason, "error");
|
flashMessage(error.reason, "error");
|
35
packages/telescope-post-by-feed/lib/feeds.js
Normal file
35
packages/telescope-post-by-feed/lib/feeds.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
// feedSchema schema
|
||||||
|
feedSchema = new SimpleSchema({
|
||||||
|
_id: {
|
||||||
|
type: String,
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
type: String,
|
||||||
|
regEx: SimpleSchema.RegEx.Url
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Feeds = new Meteor.Collection("feeds", {
|
||||||
|
schema: feedSchema
|
||||||
|
});
|
||||||
|
|
||||||
|
Meteor.startup(function () {
|
||||||
|
Feeds.allow({
|
||||||
|
remove: isAdminById
|
||||||
|
});
|
||||||
|
|
||||||
|
Meteor.methods({
|
||||||
|
insertFeed: function(feedUrl){
|
||||||
|
check(feedUrl, feedSchema);
|
||||||
|
|
||||||
|
if (Feeds.findOne({url: feedSchema.url}))
|
||||||
|
throw new Meteor.Error('already-exists', i18n.t('feed_already_exists'));
|
||||||
|
|
||||||
|
if (!Meteor.user() || !isAdmin(Meteor.user()))
|
||||||
|
throw new Meteor.Error('login-required', i18n.t('you_need_to_login_and_be_an_admin_to_add_a_new_feed'));
|
||||||
|
|
||||||
|
return Feeds.insert(feedUrl);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,9 +1,9 @@
|
||||||
SyncedCron.add({
|
SyncedCron.add({
|
||||||
name: 'Post by RSS url',
|
name: 'Post by RSS feed',
|
||||||
schedule: function(parser) {
|
schedule: function(parser) {
|
||||||
return parser.text('every 10 mins');
|
return parser.text('every 10 mins');
|
||||||
},
|
},
|
||||||
job: function() {
|
job: function() {
|
||||||
fetchUrls();
|
fetchFeeds();
|
||||||
}
|
}
|
||||||
});
|
});
|
|
@ -78,10 +78,10 @@ var handleFeed = function(error, feed) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchUrls = function() {
|
fetchFeeds = function() {
|
||||||
var content;
|
var content;
|
||||||
|
|
||||||
RssUrls.find().forEach(function(rssUrl) {
|
Feeds.find().forEach(function(rssUrl) {
|
||||||
try {
|
try {
|
||||||
content = HTTP.get(rssUrl.url).content;
|
content = HTTP.get(rssUrl.url).content;
|
||||||
} catch (e) {
|
} catch (e) {
|
|
@ -1,7 +1,7 @@
|
||||||
Package.describe({
|
Package.describe({
|
||||||
summary: 'Auto post via RSS to Telescope',
|
summary: 'Auto post via RSS to Telescope',
|
||||||
version: '0.0.1',
|
version: '0.0.1',
|
||||||
name: 'telescope-post-by-rss'
|
name: 'telescope-post-by-feed'
|
||||||
});
|
});
|
||||||
|
|
||||||
Npm.depends({
|
Npm.depends({
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"rss_url_is_already_exists": "Url is already exists."
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
<template name="rssUrlItem">
|
|
||||||
<li>
|
|
||||||
<span>Url: {{url}}</span>
|
|
||||||
<a class="delete-url" href="#">Delete</a>
|
|
||||||
</li>
|
|
||||||
</template>
|
|
|
@ -1,10 +0,0 @@
|
||||||
Meteor.startup(function () {
|
|
||||||
Template[getTemplate('rssUrlItem')].events({
|
|
||||||
'click .delete-url': function(e, instance){
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
if (confirm(i18n.t('are_you_sure')))
|
|
||||||
RssUrls.remove(instance.data._id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,35 +0,0 @@
|
||||||
// rssUrl schema
|
|
||||||
rssUrlSchema = new SimpleSchema({
|
|
||||||
_id: {
|
|
||||||
type: String,
|
|
||||||
optional: true
|
|
||||||
},
|
|
||||||
url: {
|
|
||||||
type: String,
|
|
||||||
regEx: SimpleSchema.RegEx.Url
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
RssUrls = new Meteor.Collection("rss_urls", {
|
|
||||||
schema: rssUrlSchema
|
|
||||||
});
|
|
||||||
|
|
||||||
Meteor.startup(function () {
|
|
||||||
RssUrls.allow({
|
|
||||||
remove: isAdminById
|
|
||||||
});
|
|
||||||
|
|
||||||
Meteor.methods({
|
|
||||||
insertRssUrl: function(rssUrl){
|
|
||||||
check(rssUrl, rssUrlSchema);
|
|
||||||
|
|
||||||
if (RssUrls.findOne({url: rssUrl.url}))
|
|
||||||
throw new Meteor.Error('already-exists', i18n.t('rss_url_is_already_exists'));
|
|
||||||
|
|
||||||
if (!Meteor.user() || !isAdmin(Meteor.user()))
|
|
||||||
throw new Meteor.Error('login-required', i18n.t('you_need_to_login_and_be_an_admin_to_add_a_new_rss_url'));
|
|
||||||
|
|
||||||
return RssUrls.insert(rssUrl);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
Add table
Reference in a new issue