Socket
Socket
Sign inDemoInstall

trev

Package Overview
Dependencies
8
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.6 to 2.0.7

52

index.js
const fetch = require("node-fetch");
const subreddits = require("./subreddits.json");
const fs = require("fs");
const utf8 = require("utf8");
const { table } = require("console");
// useless global vars
var paths = [];
var varstore = [];
var tableplace = 0;
var paths;
var varstore;
var tableplace;
// useless functions

@@ -62,21 +64,24 @@ function redo(str) {

}
// start of code yay
this.test = subreddits;
signPaths(this.test);
this.loadTrev();
}
loadTrev() {
// or reload
paths = [];
varstore = [];
tableplace = 0;
this.subreddits = subreddits;
signPaths(this.subreddits);
for (let i = 0; i < paths.length; i++) {
paths[i] = redo(paths[i]);
}
// console.log(paths);
this.nsfw = {};
this.memes = {};
// memes category comming soon, you can already see it in subreddits.json but its empty for the moment
if (this.verbose) console.log("[+] Loading/creating functions | trev");
for (var path of paths) {
let part = gjov(this.test, path);
let part = gjov(this.subreddits, path);
for (let key of Object.keys(part)) {
var curp = path + "." + key;
if (isArr(gjov(this.test, curp))) {
varstore[tableplace] = gjov(this.test, curp);
if (isArr(gjov(this.subreddits, curp))) {
varstore[tableplace] = gjov(this.subreddits, curp);
eval(`
this.test${buildpath(curp)} = async () => {
this.subreddits${buildpath(curp)} = async () => {
let subreddit = choice(varstore[${tableplace}]);

@@ -91,8 +96,23 @@ let result = await this.getCustomSubreddit(subreddit);

}
for (let key of Object.keys(this.test)) {
this[key] = this.test[key];
for (let key of Object.keys(this.subreddits)) {
this[key] = this.subreddits[key];
}
delete this.test;
this.subreddits = subreddits;
if (this.verbose) console.log("[+] Fully loaded | trev");
}
changeTrevList(link) {
if (link === "default")
link =
"https://gist.githubusercontent.com/rblxploit/28078547cd8b1a10bbf4d6a9f98f0a0e/raw/3fd6bee40b981369781f9073f6312b905d389412/Trev%2520default%2520subreddits";
fetch(link)
.then((r) => r.json())
.then((trevlist) => {
// save to file
// recall the constructor
// btw this is sync, not async
// the reason why its not async is that i want it to be blocking
fs.writeFileSync("subreddits.json", JSON.stringify(trevlist, null, 2));
this.loadTrev();
});
}
async getSubreddit(sr) {

@@ -99,0 +119,0 @@ let link = `https://www.reddit.com${sr}/random.json`;

{
"name": "trev",
"version": "2.0.6",
"version": "2.0.7",
"description": "Getting random nsfw images, hentai images and memes from reddit. Fast and tons of features supported.",

@@ -36,4 +36,6 @@ "main": "index.js",

"images",
"api"
"api",
"sfw",
"modular"
]
}

@@ -9,7 +9,2 @@ # Trev

## Full list of functions
You can check the full list here: [https://hastebin.com/tohozitavu.cs](https://hastebin.com/tohozitavu.cs)
It is too long to how here, so i encourage checking it out.
## Usage example

@@ -30,2 +25,11 @@

## Major change
Trev is now modular! More documentation on that later, i need to fix some issues first. Basically, it means that you can customize Trev however you can. Don't worry, there is also a way to revert those changes.
## Full list of functions
You can check the full list here: [https://hastebin.com/tohozitavu.cs](https://hastebin.com/tohozitavu.cs)
It is too long to how here, so i encourage checking it out.
## Other methods

@@ -47,5 +51,1 @@

Converts a normal Gfy url into a Gfy embed. The point of this is that a Gfy embed page contains way less HTML than the normal page, which will save speed when doing web scraping.
## Comming soon
I recently did major changes to to the code of Trev, it is now more modular than before. This means that Trev can now "code itself" from any JSON file. If you did not know, there is a file called subreddits.json in Trev. Trev works by making functions for each of the things there, which is pretty cool. This means that if i want to add a subreddit or a category, i don't need to code a whole function, i just need to edit the subreddits.json file. In the future, i plan on adding a feature that makes it possible for anyone to add their own subreddits list (mine will stay default though). If you want to help me develop Trev, please join the discord server: [https://discord.gg/PrVRHPh](https://discord.gg/PrVRHPh)
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