New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

converter-toless-plugin

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

converter-toless-plugin - npm Package Compare versions

Comparing version 0.0.30 to 0.0.31

4

lib/components/utils.d.ts

@@ -1,2 +0,2 @@

import type { Compiler } from "../../d/types";
import type { Compiler, Req } from "../../d/types";
export declare function getProps(name: string): {

@@ -9,2 +9,2 @@ type: string;

export declare function getNameOf(arry: Compiler[], name: string): number;
export declare function queryparse(params: any[]): any;
export declare const getIp: (req: Req) => string;

@@ -39,6 +39,9 @@ import * as path from "path";

}
export function queryparse(params) {
return params.reduce((p, c) => {
return `${p}&${encodeURI(c.name)}=${encodeURI(JSON.stringify(c.value))}`;
});
}
export const getIp = (req) => {
var forwardedIpsStr = req.header('x-forwarded-for');
var IP = '';
if (forwardedIpsStr) {
IP = forwardedIpsStr.split(',')[0];
}
return IP;
};
import { Compiler, converterOptions, Req, Res } from "../d/types";
export default class CompilersHandler {
app: any;
filter: any;
deleteallTempFilesOnStart: boolean;

@@ -13,6 +11,8 @@ maindir: string;

timetoGarbageCleaner: number;
app: any;
filter: any;
router: any;
debug: any;
logInFile: any;
logfile: any;
router: any;
constructor(props?: converterOptions | object);

@@ -49,3 +49,3 @@ /** this function starts the server */

/** just a debugger and a messenger to the client if error*/
log(errorMes: string, ip: string, res?: Res): void;
log(errorMes: string, ip?: string, res?: Res): void;
/** function to delete temp files off input and output folders*/

@@ -52,0 +52,0 @@ deleteGarbage(): void;

@@ -14,3 +14,3 @@ import { createRequire } from 'module';

// for utils
import { getNameOf, getProps, deleteFile, deleteAllFilesInDirectory, queryparse } from "./components/utils.js";
import { getNameOf, getProps, deleteFile, deleteAllFilesInDirectory, getIp } from "./components/utils.js";
// for filtering names

@@ -55,29 +55,24 @@ import filter from "./components/filter.js";

setup() {
console.log(this.maindir);
if (this.debug)
this.log(this.maindir);
// Main Page
this.app.get(this.maindir, this.mainPage);
this.app.get(`/${this.maindir}`, this.mainPage);
// Uploading Page
this.app.post(`${this.maindir}/upload`, this.uploadFile);
this.app.post(`/${this.maindir}/upload`, this.uploadFile);
}
/**main page */
async mainPage(req, res) {
// get ip adress
var forwardedIpsStr = req.header('x-forwarded-for');
var IP = '';
if (forwardedIpsStr) {
IP = forwardedIpsStr.split(',')[0];
}
// log a user visit
this.log(`visited`, IP);
res.send(this.router.page("main", queryparse([{ name: "compilers", value: this.compilers }])));
this.log(`visited`, getIp(req));
this.router.setPage(res, "main", [
{
name: "compilers",
value: this.compilers
}
]);
}
/**upload file */
async uploadFile(req, res) {
let forwardedIps;
// get ip adress
var forwardedIpsStr = req.header('x-forwarded-for');
var IP = '';
if (forwardedIpsStr) {
IP = forwardedIps = forwardedIpsStr.split(',')[0];
}
var IP = getIp(req);
if (req.files) {

@@ -84,0 +79,0 @@ var file = req.files.upfile;

{
"name": "converter-toless-plugin",
"version": "0.0.30",
"version": "0.0.31",
"description": "this is a plugin",

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

import * as path from "path"
import * as fs from "fs"
import type { Compiler } from "../../d/types"
import type { Compiler, Req } from "../../d/types"

@@ -49,6 +49,12 @@

export function queryparse(params: any[]) {
return params.reduce((p, c) => {
return `${p}&${encodeURI(c.name)}=${encodeURI(JSON.stringify(c.value))}`
})
export const getIp = (req: Req) => {
var forwardedIpsStr = req.header('x-forwarded-for');
var IP = '';
if (forwardedIpsStr) {
IP = forwardedIpsStr.split(',')[0];
}
return IP
}

@@ -23,3 +23,3 @@

// for utils
import { getNameOf, getProps, deleteFile, deleteAllFilesInDirectory, queryparse } from "./components/utils.js";
import { getNameOf, getProps, deleteFile, deleteAllFilesInDirectory, getIp } from "./components/utils.js";

@@ -61,4 +61,4 @@ // for filtering names

export default class CompilersHandler {
app: any;
filter: any;
deleteallTempFilesOnStart!: boolean;

@@ -72,13 +72,11 @@ maindir!: string;

timetoGarbageCleaner!: number;
app: any;
filter: any;
router: any;
debug: any;
logInFile: any;
logfile: any;
router: any;
constructor(props: converterOptions | object = {}) {
this.getParams({ ...defaultProps, ...props })
}

@@ -104,8 +102,8 @@

setup() {
console.log(this.maindir)
if (this.debug) this.log(this.maindir)
// Main Page
this.app.get(this.maindir, this.mainPage)
this.app.get(`/${this.maindir}`, this.mainPage)
// Uploading Page
this.app.post(`${this.maindir}/upload`, this.uploadFile)
this.app.post(`/${this.maindir}/upload`, this.uploadFile)
}

@@ -115,14 +113,13 @@

async mainPage(req: Req, res: Res) {
// get ip adress
var forwardedIpsStr = req.header('x-forwarded-for');
var IP = '';
if (forwardedIpsStr) {
IP = forwardedIpsStr.split(',')[0];
}
// log a user visit
this.log(`visited`, IP)
this.log(`visited`, getIp(req))
res.send(this.router.page("main",
queryparse([{ name: "compilers", value: this.compilers }])));
this.router.setPage(res, "main",
[
{
name: "compilers",
value: this.compilers
}
]
)
}

@@ -132,11 +129,5 @@

async uploadFile(req: Req, res: Res) {
let forwardedIps: string;
// get ip adress
var forwardedIpsStr = req.header('x-forwarded-for');
var IP = '';
var IP = getIp(req);
if (forwardedIpsStr) {
IP = forwardedIps = forwardedIpsStr.split(',')[0];
}
if (req.files) {

@@ -309,3 +300,3 @@ var file = req.files.upfile

/** just a debugger and a messenger to the client if error*/
log(errorMes: string, ip: string, res?: Res) {
log(errorMes: string, ip?: string, res?: Res) {
if (res)

@@ -312,0 +303,0 @@ res.send(this.router.message(errorMes))

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc