Socket
Socket
Sign inDemoInstall

creamcrop

Package Overview
Dependencies
90
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.2 to 0.6.0

5

CHANGELOG.md

@@ -0,1 +1,6 @@

# v0.6.0
Adds:
- Custom filtering and searching
# v0.5.2

@@ -2,0 +7,0 @@

2

docs/_coverpage.md

@@ -5,3 +5,3 @@ ![header](./assets/Favicon.png)

# Creamcrop <small>v0.5.2</small>
# Creamcrop <small>v0.6.0</small>

@@ -8,0 +8,0 @@ > A cream-of-the-crop, top-of-the-top, slice-and-chop, absolutely minimalist news getter

@@ -18,7 +18,12 @@ > Configuration for the package

...
]
],
"custom": "./template.html",
"read": [
"feed2_url"
],
"format": "%title% @ <a href=\"%link%\">%link%</a> - From <a href=\"%feedlink%\">%feed%</a>. Published at %pubdate%",
}
```
Currently, `feeds` is the only required parameter.
Currently, `feeds` is the only required parameter. `read` does not have to be manually updated, it's automatically updated when you click a link.

@@ -31,3 +36,3 @@ ## Valid parameters

| `format` | The format of the output. Each value should be surrounded by `%`. | `<a href="%link%">%title%</a> from <a href="%feedlink%">%feed%</a>` | `%feed%`- The name of the RSS feed the item is in. <br> `%feedlink%` - The RSS feed's link that the item is in. <br> `%title%` - The name of the RSS feed Item. <br> `%link%` Link to the item. <br> `%pubdate%` - The publication date. |
| `custom` | A custom HTML template. Inside the HTML, use `%feed%`, which will be replaced by the content of the feed. Use `%update%` in the HTML, which will be replaced by a script that auto-updates the RSS feed. | A basic HTML page. | The relative path to the HTML template file |
| `custom` | A custom HTML template. Inside the HTML, use `%feed%`, which will be replaced by the content of the feed. Use `%update%` in the HTML, which will be replaced by a script that auto-updates the RSS feed. Use `%search%` in the HTML to get the search bar to filter through results. | A basic HTML page. | The relative path to the HTML template file |
| `read` | Array of URLs which have already been read. Whenever you click a URL on the webpage, it is automatically added here. | `[]` | An array of URLs as strings. |

@@ -10,7 +10,7 @@ ## Why is creamcrop in alpha?

- [x] ~Multiple RSS feeds~
- [ ] Better websites
- [x] ~Better websites~
- [x] ~Config files~
- [ ] Fast. Fast. Fast. (ie. We want it to be faster.)
- [ ] Filters
- [ ] Git tracking
- [x] ~Filters~
- [ ] Git tracking (Add git commit history to your feeds)
- [ ] Additional Feed types - atom, JSON

@@ -23,3 +23,3 @@ - [ ] Probably a whole lot of bug fixes

Yep! You can read the [contributing guidelines](https://github.com/creamcropdev/creamcrop/blob/main/CONTRIBUTING.md). You can easily set-up your dev enviornment with:
```sh
```bash
git clone https://github.com/creamcropdev/creamcrop.git # or gh repo clone creamcropdev/creamcrop

@@ -26,0 +26,0 @@ cd creamcrop

@@ -113,3 +113,3 @@ > Learn the fundamentals of creamcrop

Qlabs (@Quantalabs)
0.5.2
0.6.0
```

@@ -155,3 +155,3 @@

$ cream --version
0.5.2
0.6.0
```
{
"name": "@creamcropdev/creamcrop",
"version": "0.5.2",
"version": "0.6.0",
"description": "A cream-of-the-crop, top-of-the-top, slice-and-chop, absolutely minimalist news getter.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

{
"name": "creamcrop",
"version": "0.5.2",
"version": "0.6.0",
"description": "A cream-of-the-crop, top-of-the-top, slice-and-chop, absolutely minimalist news getter.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -60,3 +60,3 @@ <div align='center'>

The creamcrop project is licensed under the GPL-3.0 license.
The creamcrop project is licensed under the MIT license.

@@ -92,2 +92,2 @@

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification.
Contributions of any kind welcome!
Contributions of any kind welcome!

@@ -13,2 +13,6 @@ const http = require('http');

async function serve(dir, port, host, interval) {
// Clear the console
process.stdout.write('\x1Bc');
if (fs.existsSync(dir+'/.creamcroprc') || fs.existsSync(dir+'.creamcroprc')) {

@@ -22,3 +26,3 @@ console.log('Found config file, generating website...')

async function generate(dir) {
async function generate(dir, query=null) {
let feed = {

@@ -42,2 +46,14 @@ items: []

for (var fitem in data.items) {
// Check if the item matches the query, if query is not null. If the item does not match the query, skip the iteration
if (query != null) {
// If the item's title, description, link, feed, feedlink, or pubdate does not match the query, skip the iteration
if (data.items[fitem].title.toLowerCase().indexOf(query.toLowerCase()) == -1 &&
data.items[fitem].link.toLowerCase().indexOf(query.toLowerCase()) == -1 &&
data.title.toLowerCase().indexOf(query.toLowerCase()) == -1 &&
data.link.toLowerCase().indexOf(query.toLowerCase()) == -1 &&
data.items[fitem].isoDate.toLowerCase().indexOf(query.toLowerCase()) == -1) {
continue;
}
}
// If data.items[fitem].link is in config.read list, then add it to read.items and skip the iteration

@@ -124,2 +140,10 @@ if (config.read.indexOf(data.items[fitem].link) != -1) {

`);
// Replace %search% with search box with search in customconf
customconf = customconf.replace(/%search%/g, `
<form action="/search" method="get">
<input type="text" name="q" placeholder="Search" />
<input type="submit" value="Search" />
</form>
`);

@@ -145,2 +169,13 @@

<section id="main-content">
<div class="container" style="margin: 10px;">
<!-- Search box -->
<form action="/search" method="get">
<input type="text" name="q" placeholder="Search" />
<input type="submit" value="Search" />
</form>
<!-- Home Button -->
<a href="/">Home</a>
</div>
<!-- RSS feed -->
<h1 style="width: 100vw; text-align: center;">Your News Feed</h1>

@@ -222,2 +257,14 @@ <p style="margin: auto; text-align: center;">Your news feed from creamcrop, the cream-of-the-crop, top-of-the-top, slice-and-chop, absolutely minimalist news getter.</p>

}
if (url.parse(req.url, true).pathname === '/search') {
console.log('Recieved API Request, searching...');
// Get query from URL
let query = url.parse(req.url, true).query.q
// Get items from RSS feed
html = await generate(dir, query);
res.end(html);
}
}

@@ -224,0 +271,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc