// backend/http-functions.js
import { ok, created, response } from 'wix-http-functions';
import wixData from 'wix-data';
// Basit test: Ziyaretçinin IP'sini döner (GET /_functions/myip)
export function get_myip(request) {
  const ip = request.ip;
  return ok({
    headers: { 'Content-Type': 'application/json' },
    body: { ip }
  });
}
// Loglama: IP + başlık bilgilerini kaydeder (POST /_functions/log-visit)
export async function post_log_visit(request) {
  const common = {
    headers: {
      'Content-Type': 'application/json',
      'Access-Control-Allow-Origin': '*',
      'Access-Control-Allow-Methods': 'POST, OPTIONS',
      'Access-Control-Allow-Headers': 'Content-Type'
    }
  };
  if (request.method === 'OPTIONS') {
    return response({ status: 204, headers: common.headers, body: {} });
  }
  const ip = request.ip || '';
  const headers = request.headers || {};
  const ua = headers['user-agent'] || headers['User-Agent'] || '';
  const referrer = headers['referer'] || headers['referrer'] || '';
  const path = (request.path && request.path.join('/')) || '';
  const ts = new Date();
  let payload = null;
  try {
    if (request.body) {
      const content = await request.body.text();
      payload = content?.slice(0, 5000);
    }
  } catch (e) {}
  await wixData.insert('SecurityLogs', { ip, ua, path, referrer, ts, payload });
  return created({
    ...common,
    body: { ok: true, ip, ts }
  });
}
    
      
      
  
  
  
  
  
    
    
    
    
    
    
    
    
    
top of page
CRYZENCRYPTO.COM KRİPTO DOLANDIRICISI ŞİKAYETLER VE DOLANDIRICI LİSTESİ. 
İSİMLER SAHTEDİR.
BAŞKASININ RESİMLERİ KULLANILMIŞ OLABİLİR
bottom of page