HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/quadcode.com/build/server/chunks/WLogger-ddafd77a.js
import crypto$1 from 'crypto';
import { createLogger, format, transports } from 'winston';

function getDefaultExportFromCjs (x) {
	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}

let urlAlphabet =
  'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';

const POOL_SIZE_MULTIPLIER = 128;
let pool, poolOffset;
let fillPool = bytes => {
  if (!pool || pool.length < bytes) {
    pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
    crypto$1.randomFillSync(pool);
    poolOffset = 0;
  } else if (poolOffset + bytes > pool.length) {
    crypto$1.randomFillSync(pool);
    poolOffset = 0;
  }
  poolOffset += bytes;
};
let nanoid = (size = 21) => {
  fillPool((size -= 0));
  let id = '';
  for (let i = poolOffset - size; i < poolOffset; i++) {
    id += urlAlphabet[pool[i] & 63];
  }
  return id
};

var ttlcache;
var hasRequiredTtlcache;

function requireTtlcache () {
	if (hasRequiredTtlcache) return ttlcache;
	hasRequiredTtlcache = 1;
	// A simple TTL cache with max capacity option, ms resolution,
	// autopurge, and reasonably optimized performance
	// Relies on the fact that integer Object keys are kept sorted,
	// and managed very efficiently by V8.

	/* istanbul ignore next */
	const perf =
	  typeof performance === 'object' &&
	  performance &&
	  typeof performance.now === 'function'
	    ? performance
	    : Date;

	const now = () => perf.now();
	const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n);
	const isPosIntOrInf = n => n === Infinity || isPosInt(n);

	class TTLCache {
	  constructor({
	    max = Infinity,
	    ttl,
	    updateAgeOnGet = false,
	    checkAgeOnGet = false,
	    noUpdateTTL = false,
	    dispose,
	    noDisposeOnSet = false,
	  } = {}) {
	    // {[expirationTime]: [keys]}
	    this.expirations = Object.create(null);
	    // {key=>val}
	    this.data = new Map();
	    // {key=>expiration}
	    this.expirationMap = new Map();
	    if (ttl !== undefined && !isPosIntOrInf(ttl)) {
	      throw new TypeError(
	        'ttl must be positive integer or Infinity if set'
	      )
	    }
	    if (!isPosIntOrInf(max)) {
	      throw new TypeError('max must be positive integer or Infinity')
	    }
	    this.ttl = ttl;
	    this.max = max;
	    this.updateAgeOnGet = !!updateAgeOnGet;
	    this.checkAgeOnGet = !!checkAgeOnGet;
	    this.noUpdateTTL = !!noUpdateTTL;
	    this.noDisposeOnSet = !!noDisposeOnSet;
	    if (dispose !== undefined) {
	      if (typeof dispose !== 'function') {
	        throw new TypeError('dispose must be function if set')
	      }
	      this.dispose = dispose;
	    }

	    this.timer = undefined;
	    this.timerExpiration = undefined;
	  }

	  setTimer(expiration, ttl) {
	    if (this.timerExpiration < expiration) {
	      return
	    }

	    if (this.timer) {
	      clearTimeout(this.timer);
	    }

	    const t = setTimeout(() => {
	      this.timer = undefined;
	      this.timerExpiration = undefined;
	      this.purgeStale();
	      for (const exp in this.expirations) {
	        this.setTimer(exp, exp - now());
	        break
	      }
	    }, ttl);

	    /* istanbul ignore else - affordance for non-node envs */
	    if (t.unref) t.unref();

	    this.timerExpiration = expiration;
	    this.timer = t;
	  }

	  // hang onto the timer so we can clearTimeout if all items
	  // are deleted.  Deno doesn't have Timer.unref(), so it
	  // hangs otherwise.
	  cancelTimer() {
	    if (this.timer) {
	      clearTimeout(this.timer);
	      this.timerExpiration = undefined;
	      this.timer = undefined;
	    }
	  }

	  /* istanbul ignore next */
	  cancelTimers() {
	    process.emitWarning(
	      'TTLCache.cancelTimers has been renamed to ' +
	        'TTLCache.cancelTimer (no "s"), and will be removed in the next ' +
	        'major version update'
	    );
	    return this.cancelTimer()
	  }

	  clear() {
	    const entries =
	      this.dispose !== TTLCache.prototype.dispose ? [...this] : [];
	    this.data.clear();
	    this.expirationMap.clear();
	    // no need for any purging now
	    this.cancelTimer();
	    this.expirations = Object.create(null);
	    for (const [key, val] of entries) {
	      this.dispose(val, key, 'delete');
	    }
	  }

	  setTTL(key, ttl = this.ttl) {
	    const current = this.expirationMap.get(key);
	    if (current !== undefined) {
	      // remove from the expirations list, so it isn't purged
	      const exp = this.expirations[current];
	      if (!exp || exp.length <= 1) {
	        delete this.expirations[current];
	      } else {
	        this.expirations[current] = exp.filter(k => k !== key);
	      }
	    }

	    if (ttl !== Infinity) {
	      const expiration = Math.floor(now() + ttl);
	      this.expirationMap.set(key, expiration);
	      if (!this.expirations[expiration]) {
	        this.expirations[expiration] = [];
	        this.setTimer(expiration, ttl);
	      }
	      this.expirations[expiration].push(key);
	    } else {
	      this.expirationMap.set(key, Infinity);
	    }
	  }

	  set(
	    key,
	    val,
	    {
	      ttl = this.ttl,
	      noUpdateTTL = this.noUpdateTTL,
	      noDisposeOnSet = this.noDisposeOnSet,
	    } = {}
	  ) {
	    if (!isPosIntOrInf(ttl)) {
	      throw new TypeError('ttl must be positive integer or Infinity')
	    }
	    if (this.expirationMap.has(key)) {
	      if (!noUpdateTTL) {
	        this.setTTL(key, ttl);
	      }
	      // has old value
	      const oldValue = this.data.get(key);
	      if (oldValue !== val) {
	        this.data.set(key, val);
	        if (!noDisposeOnSet) {
	          this.dispose(oldValue, key, 'set');
	        }
	      }
	    } else {
	      this.setTTL(key, ttl);
	      this.data.set(key, val);
	    }

	    while (this.size > this.max) {
	      this.purgeToCapacity();
	    }

	    return this
	  }

	  has(key) {
	    return this.data.has(key)
	  }

	  getRemainingTTL(key) {
	    const expiration = this.expirationMap.get(key);
	    return expiration === Infinity
	      ? expiration
	      : expiration !== undefined
	      ? Math.max(0, Math.ceil(expiration - now()))
	      : 0
	  }

	  get(
	    key,
	    {
	      updateAgeOnGet = this.updateAgeOnGet,
	      ttl = this.ttl,
	      checkAgeOnGet = this.checkAgeOnGet,
	    } = {}
	  ) {
	    const val = this.data.get(key);
	    if (checkAgeOnGet && this.getRemainingTTL(key) === 0) {
	      this.delete(key);
	      return undefined
	    }
	    if (updateAgeOnGet) {
	      this.setTTL(key, ttl);
	    }
	    return val
	  }

	  dispose(_, __) {}

	  delete(key) {
	    const current = this.expirationMap.get(key);
	    if (current !== undefined) {
	      const value = this.data.get(key);
	      this.data.delete(key);
	      this.expirationMap.delete(key);
	      const exp = this.expirations[current];
	      if (exp) {
	        if (exp.length <= 1) {
	          delete this.expirations[current];
	        } else {
	          this.expirations[current] = exp.filter(k => k !== key);
	        }
	      }
	      this.dispose(value, key, 'delete');
	      if (this.size === 0) {
	        this.cancelTimer();
	      }
	      return true
	    }
	    return false
	  }

	  purgeToCapacity() {
	    for (const exp in this.expirations) {
	      const keys = this.expirations[exp];
	      if (this.size - keys.length >= this.max) {
	        delete this.expirations[exp];
	        const entries = [];
	        for (const key of keys) {
	          entries.push([key, this.data.get(key)]);
	          this.data.delete(key);
	          this.expirationMap.delete(key);
	        }
	        for (const [key, val] of entries) {
	          this.dispose(val, key, 'evict');
	        }
	      } else {
	        const s = this.size - this.max;
	        const entries = [];
	        for (const key of keys.splice(0, s)) {
	          entries.push([key, this.data.get(key)]);
	          this.data.delete(key);
	          this.expirationMap.delete(key);
	        }
	        for (const [key, val] of entries) {
	          this.dispose(val, key, 'evict');
	        }
	        return
	      }
	    }
	  }

	  get size() {
	    return this.data.size
	  }

	  purgeStale() {
	    const n = Math.ceil(now());
	    for (const exp in this.expirations) {
	      if (exp === 'Infinity' || exp > n) {
	        return
	      }

	      /* istanbul ignore next
	       * mysterious need for a guard here?
	       * https://github.com/isaacs/ttlcache/issues/26 */
	      const keys = [...(this.expirations[exp] || [])];
	      const entries = [];
	      delete this.expirations[exp];
	      for (const key of keys) {
	        entries.push([key, this.data.get(key)]);
	        this.data.delete(key);
	        this.expirationMap.delete(key);
	      }
	      for (const [key, val] of entries) {
	        this.dispose(val, key, 'stale');
	      }
	    }
	    if (this.size === 0) {
	      this.cancelTimer();
	    }
	  }

	  *entries() {
	    for (const exp in this.expirations) {
	      for (const key of this.expirations[exp]) {
	        yield [key, this.data.get(key)];
	      }
	    }
	  }
	  *keys() {
	    for (const exp in this.expirations) {
	      for (const key of this.expirations[exp]) {
	        yield key;
	      }
	    }
	  }
	  *values() {
	    for (const exp in this.expirations) {
	      for (const key of this.expirations[exp]) {
	        yield this.data.get(key);
	      }
	    }
	  }
	  [Symbol.iterator]() {
	    return this.entries()
	  }
	}

	ttlcache = TTLCache;
	return ttlcache;
}

var ttlcacheExports = requireTtlcache();
var g = /*@__PURE__*/getDefaultExportFromCjs(ttlcacheExports);

class L{rate;constructor(t){this.rate=t;}async hash(t){return t.getClientAddress()}}class T{rate;constructor(t){this.rate=t;}async hash(t){const e=t.request.headers.get("user-agent");return e?t.getClientAddress()+e:!1}}class p{rate;cookieOptions;secret;requirePreflight;cookieId;hashFunction;constructor(t){this.cookieId=t.name,this.secret=t.secret,this.rate=t.rate,this.requirePreflight=t.preflight,this.hashFunction=t.hashFunction??l,this.cookieOptions={path:"/",httpOnly:!0,maxAge:60*60*24*7,sameSite:"strict",...t.serializeOptions};}async hash(t){const e=await this.userIdFromCookie(t.cookies.get(this.cookieId),t);return e||!1}async preflight(t){const e=t.cookies.get(this.cookieId);if(e){const r=await this.userIdFromCookie(e,t);if(r)return r}const s=nanoid();return t.cookies.set(this.cookieId,s+";"+await this.hashFunction(this.secret+s),this.cookieOptions),s}async userIdFromCookie(t,e){const s=()=>this.requirePreflight?null:this.preflight(e);if(!t)return s();const[r,i]=t.split(";");return !r||!i||await this.hashFunction(this.secret+r)!=i?s():r}}let l;globalThis?.crypto?.subtle&&(l=I);async function I(c){const t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(c));return [...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,"0")).join("")}class a{store;plugins;onLimited;hashFunction;cookieLimiter;static TTLTime(t){switch(t){case"s":return 1e3;case"m":return 6e4;case"h":return 60*6e4;case"2s":return 2e3;case"5s":return 5e3;case"10s":return 1e4;case"15s":return 15e3;case"30s":return 3e4;case"45s":return 45e3;case"15m":return 15*6e4;case"30m":return 30*6e4;case"100ms":return 100;case"250ms":return 250;case"500ms":return 500;case"2h":return 2*60*6e4;case"6h":return 6*60*6e4;case"12h":return 12*60*6e4;case"d":return 24*60*6e4;case"ms":return 1}throw new Error("Invalid unit for TTLTime: "+t)}async isLimited(t){return (await this._isLimited(t)).limited}async clear(){return await this.store.clear()}async _isLimited(t){let e=!1;for(const s of this.plugins){const r=await s.hash(t);if(r===!1)return this.onLimited&&await this.onLimited(t,"rejected")===!0?{limited:!1,hash:null,unit:s.rate[1]}:{limited:!0,hash:null,unit:s.rate[1]};if(r===!0)return {limited:!1,hash:null,unit:s.rate[1]};if(r===null){e=!0;continue}else e=!1;if(!r)throw new Error("Empty hash returned from rate limiter "+s.constructor.name);const i=await this.hashFunction(r);if(await this.store.add(i,s.rate[1])>s.rate[0])return this.onLimited&&await this.onLimited(t,"rate")===!0?{limited:!1,hash:i,unit:s.rate[1]}:{limited:!0,hash:i,unit:s.rate[1]}}return {limited:e,hash:null,unit:this.plugins[this.plugins.length-1].rate[1]}}constructor(t={}){if(this.plugins=[...t.plugins??[]],this.onLimited=t.onLimited,this.hashFunction=t.hashFunction??l,!this.hashFunction)throw new Error("No RateLimiter hash function found. Please set one with the hashFunction option.");const e=t.IP??t.rates?.IP;e&&this.plugins.push(new L(e));const s=t.IPUA??t.rates?.IPUA;s&&this.plugins.push(new T(s));const r=t.cookie??t.rates?.cookie;if(r&&this.plugins.push(this.cookieLimiter=new p({hashFunction:this.hashFunction,...r})),!this.plugins.length)throw new Error("No plugins set for RateLimiter!");this.plugins.sort((o,n)=>{const h=a.TTLTime(o.rate[1])-a.TTLTime(n.rate[1]);return h==0?o.rate[0]-n.rate[0]:h});const i=this.plugins.reduce((o,n)=>{const h=n.rate[1];h=="ms"&&console.warn('RateLimiter: The "ms" unit is not reliable due to OS timing issues.');const d=a.TTLTime(h);return Math.max(d,o)},0);this.store=t.store??new k(i,t.maxItems);}}class k{cache;constructor(t,e=1/0){this.cache=new g({ttl:t,max:e,noUpdateTTL:!0});}async clear(){return this.cache.clear()}async add(t,e){const s=this.cache.get(t)??0;return this.set(t,s+1,e)}set(t,e,s){return this.cache.set(t,e,{ttl:a.TTLTime(s)}),e}}const A=new a({rates:{IP:[5,"h"]}}),C=createLogger({level:"info",format:format.combine(format.timestamp({format:"YYYY-MM-DD HH:mm:ss"}),format.simple()),transports:[new transports.Console,new transports.File({filename:"Logger.log"})]});

export { A, C };
//# sourceMappingURL=WLogger-ddafd77a.js.map