@snappy-stack/core 0.1.2 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  'use server';
2
- import { getPayload } from '@/lib/payload';
2
+ import { getPayload } from '../lib/payload';
3
3
  import { cookies } from 'next/headers';
4
4
  import { redirect } from 'next/navigation';
5
5
  // SHIM: In a real app, this is passed from the outside.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * RUNTIME: Sticky Heartbeat
3
+ * This runs in the browser via SnappyProvider.
4
+ */
5
+ export declare const runStickyHeartbeat: (onVerified: (config: any) => void) => Promise<void>;
@@ -0,0 +1,59 @@
1
+ import { API_PRODUCTION_URL, __SECURITY_STATE__ } from './security.shared';
2
+ /**
3
+ * RUNTIME: Sticky Heartbeat
4
+ * This runs in the browser via SnappyProvider.
5
+ */
6
+ export const runStickyHeartbeat = async (onVerified) => {
7
+ if (typeof window === 'undefined')
8
+ return;
9
+ try {
10
+ const token = window.SNAPPY_LICENSE_TOKEN || process.env.NEXT_PUBLIC_SNAPPY_LICENSE_TOKEN;
11
+ const apiUrl = process.env.NEXT_PUBLIC_SNAPPY_API_URL || API_PRODUCTION_URL;
12
+ if (!token)
13
+ return;
14
+ const machineId = localStorage.getItem('snappy-machine-id') ||
15
+ 'br-' + Math.random().toString(36).substring(2) + Date.now().toString(36);
16
+ localStorage.setItem('snappy-machine-id', machineId);
17
+ const res = await fetch(`${apiUrl}/api/heartbeat`, {
18
+ method: 'POST',
19
+ headers: { 'Content-Type': 'application/json' },
20
+ body: JSON.stringify({
21
+ token,
22
+ domain: window.location.hostname,
23
+ machineId,
24
+ isLocal: window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1',
25
+ version: '0.1.0-runtime'
26
+ }),
27
+ });
28
+ const data = await res.json();
29
+ if (data.ok) {
30
+ onVerified({
31
+ branding: data.branding,
32
+ enforcement: data.enforcement,
33
+ status: data.status
34
+ });
35
+ // Kill the page if terminated
36
+ if (data.status === 'terminated') {
37
+ __SECURITY_STATE__.isValid = false; // Trigger Poison Pill
38
+ document.body.innerHTML = `
39
+ <div style="background:#000;color:#fff;height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:sans-serif;text-align:center;padding:20px;">
40
+ <h1 style="font-size:4rem;font-weight:900;letter-spacing:-0.05em;margin:0;">ACCESS DENIED</h1>
41
+ <p style="opacity:0.5;max-width:400px;line-height:1.6;">Your SNAPPY license has been terminated. Please contact support@wicky.id</p>
42
+ </div>
43
+ `;
44
+ }
45
+ else if (data.status === 'suspended') {
46
+ __SECURITY_STATE__.isValid = false; // Trigger Poison Pill silently for suspended
47
+ }
48
+ else {
49
+ __SECURITY_STATE__.isValid = true;
50
+ }
51
+ }
52
+ else {
53
+ __SECURITY_STATE__.isValid = false; // Unverified = Poison Pill active
54
+ }
55
+ }
56
+ catch (err) {
57
+ __SECURITY_STATE__.isValid = false; // Network block = Poison Pill active
58
+ }
59
+ };
@@ -1 +1 @@
1
- const a0_0xec48e7=a0_0x5c8b;(function(_0x4a3b2a,_0x462704){const _0x248f98=a0_0x5c8b,_0x4483fc=_0x4a3b2a();while(!![]){try{const _0x550ccc=parseInt(_0x248f98(0xcd))/0x1*(-parseInt(_0x248f98(0xd4))/0x2)+-parseInt(_0x248f98(0xf6))/0x3*(parseInt(_0x248f98(0xf2))/0x4)+-parseInt(_0x248f98(0xd9))/0x5*(parseInt(_0x248f98(0x103))/0x6)+parseInt(_0x248f98(0x102))/0x7+-parseInt(_0x248f98(0x10b))/0x8*(-parseInt(_0x248f98(0xfd))/0x9)+parseInt(_0x248f98(0x10f))/0xa+parseInt(_0x248f98(0xda))/0xb;if(_0x550ccc===_0x462704)break;else _0x4483fc['push'](_0x4483fc['shift']());}catch(_0x4d98ec){_0x4483fc['push'](_0x4483fc['shift']());}}}(a0_0x182b,0x56688));function a0_0x182b(){const _0x45add7=['base64','from','0.1.0-build','5hdBPAE','5201306EQtpKt','now','filter','existsSync','innerHTML','❌\x20[SNAPPY\x20CORE\x20FATAL]\x20Structural\x20Integrity\x20Compromised:\x20Credit\x20tag\x20missing\x20or\x20commented\x20out\x20in\x20DesktopFooter.','(((.+)+)+)+$','⚠️\x20[SNAPPY\x20CORE]\x20License\x20server\x20unreachable:\x20','hostname','toUpperCase','branding','undefined','✅\x20[SNAPPY\x20CORE]\x20Engine\x20verified:\x20','suspended','search','.\x20Running\x20in\x20offline\x20fallback\x20mode.','utf-8','cwd','unknown-machine','enforcement','includes','getItem','Unknown\x20error','snappy-machine-id','2148sujgWi','slug','.snappy-machine-id','error','1569wpLBTp','c3JjL2NvbXBvbmVudHMvbGF5b3V0L3BhcnRzL01vYmlsZUZvb3Rlci50c3g=','join','c3JjL2NvbXBvbmVudHMvbGF5b3V0L3BhcnRzL0Rlc2t0b3BGb290ZXIudHN4','message','apply','/api/heartbeat','20628YAkpKx','❌\x20[SNAPPY\x20CORE\x20FATAL]\x20Structural\x20Integrity\x20Compromised:\x20Credit\x20tag\x20missing\x20or\x20commented\x20out\x20in\x20MobileFooter.','terminated','\x20mode.','127.0.0.1','4107747mpzOvo','3609858MwLDQP','❌\x20[SNAPPY\x20CORE\x20FATAL]\x20License\x20','trim','admin','log','isValid','test','application/json','1464RuCjQZ','POST','body','production','4072810TzdAgU','location','.\x20You\x20have\x20exceeded\x20your\x20Dev\x20Seat\x20limit.','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22background:#000;color:#fff;height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:sans-serif;text-align:center;padding:20px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<h1\x20style=\x22font-size:4rem;font-weight:900;letter-spacing:-0.05em;margin:0;\x22>ACCESS\x20DENIED</h1>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p\x20style=\x22opacity:0.5;max-width:400px;line-height:1.6;\x22>Your\x20SNAPPY\x20license\x20has\x20been\x20terminated.\x20Please\x20contact\x20support@wicky.id</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20','random',':\x20This\x20instance\x20has\x20been\x20remotely\x20deactivated.','SNAPPY_LICENSE_TOKEN','❌\x20[SNAPPY\x20CORE\x20FATAL]\x20License\x20Collision:\x20','warn','users','status','collision','https://snappycore.wicky.id','writeFileSync','readFileSync','constructor','substring','exit','0.1.0-runtime','json','login-tokens','localhost','br-','collections','3pzlfWa','⚠️\x20[SNAPPY\x20CORE]\x20Missing\x20SNAPPY_LICENSE_TOKEN.\x20Development\x20mode\x20active.','❌\x20[SNAPPY\x20CORE\x20FATAL]\x20License\x20Invalid:\x20','setItem','stringify','globals','❌\x20[SNAPPY\x20CORE\x20FATAL]\x20Missing\x20SNAPPY_LICENSE_TOKEN.\x20Production\x20builds\x20are\x20disabled\x20without\x20a\x20valid\x20license.','433308ETeBJC','toString'];a0_0x182b=function(){return _0x45add7;};return a0_0x182b();}const a0_0x4cc3a1=(function(){let _0x1822f6=!![];return function(_0x1efeae,_0xa0e00a){const _0xc08d24=_0x1822f6?function(){const _0x7c019f=a0_0x5c8b;if(_0xa0e00a){const _0x117c53=_0xa0e00a[_0x7c019f(0xfb)](_0x1efeae,arguments);return _0xa0e00a=null,_0x117c53;}}:function(){};return _0x1822f6=![],_0xc08d24;};}()),a0_0x49bdbc=a0_0x4cc3a1(this,function(){const _0x228563=a0_0x5c8b;return a0_0x49bdbc[_0x228563(0xd5)]()[_0x228563(0xe8)](_0x228563(0xe0))[_0x228563(0xd5)]()[_0x228563(0xc4)](a0_0x49bdbc)[_0x228563(0xe8)](_0x228563(0xe0));});a0_0x49bdbc();import a0_0xdc37ac from'fs';import a0_0xa4ed89 from'path';import{Users}from'../collections/Users';function a0_0x5c8b(_0x405ba4,_0x5569a7){_0x405ba4=_0x405ba4-0xb6;const _0x42ddc3=a0_0x182b();let _0x49bdbc=_0x42ddc3[_0x405ba4];return _0x49bdbc;}import{LoginTokens}from'../collections/LoginTokens';import{Branding}from'../globals/Branding';const API_PRODUCTION_URL=a0_0xec48e7(0xc1);export const __SECURITY_STATE__={'isValid':!![]};export const checkLicense=async()=>{const _0x322c15=a0_0xec48e7,_0x13109c=process.env.SNAPPY_LICENSE_TOKEN,_0x199fb5=process.env.SNAPPY_API_URL||API_PRODUCTION_URL,_0x1bcbac=process[_0x322c15(0xeb)](),_0x47efb3=a0_0xa4ed89[_0x322c15(0xf8)](_0x1bcbac,_0x322c15(0xf4));let _0x3ba11a;try{a0_0xdc37ac[_0x322c15(0xdd)](_0x47efb3)?_0x3ba11a=a0_0xdc37ac[_0x322c15(0xc3)](_0x47efb3,_0x322c15(0xea))[_0x322c15(0x105)]():(_0x3ba11a=Math[_0x322c15(0xb9)]()[_0x322c15(0xd5)](0x24)[_0x322c15(0xc5)](0x2)+Date[_0x322c15(0xdb)]()[_0x322c15(0xd5)](0x24),a0_0xdc37ac[_0x322c15(0xc2)](_0x47efb3,_0x3ba11a));}catch(_0x5bfd24){_0x3ba11a=_0x322c15(0xec);}const _0x3d7e66=process.env.VERCEL_URL||_0x322c15(0xca),_0x277f1d=_0x3d7e66[_0x322c15(0xee)](_0x322c15(0xca))||_0x3d7e66[_0x322c15(0xee)](_0x322c15(0x101));if(!_0x13109c){if(process.env.NODE_ENV===_0x322c15(0x10e))console[_0x322c15(0xf5)](_0x322c15(0xd3)),process[_0x322c15(0xc6)](0x1);else{console[_0x322c15(0xbd)](_0x322c15(0xce));return;}}try{const _0x2ed655=await fetch(_0x199fb5+_0x322c15(0xfc),{'method':_0x322c15(0x10c),'headers':{'Content-Type':_0x322c15(0x10a)},'body':JSON[_0x322c15(0xd1)]({'token':_0x13109c,'domain':_0x3d7e66,'machineId':_0x3ba11a,'isLocal':_0x277f1d,'version':_0x322c15(0xd8)})}),_0x2b6d10=await _0x2ed655[_0x322c15(0xc8)]();!_0x2b6d10['ok']&&(_0x2b6d10[_0x322c15(0xbf)]===_0x322c15(0xc0)?console[_0x322c15(0xf5)](_0x322c15(0xbc)+_0x2b6d10[_0x322c15(0xf5)]+_0x322c15(0xb7)):console[_0x322c15(0xf5)](_0x322c15(0xcf)+(_0x2b6d10[_0x322c15(0xf5)]||_0x322c15(0xf0))),process[_0x322c15(0xc6)](0x1)),(_0x2b6d10[_0x322c15(0xbf)]===_0x322c15(0xe7)||_0x2b6d10[_0x322c15(0xbf)]===_0x322c15(0xff))&&(console[_0x322c15(0xf5)](_0x322c15(0x104)+_0x2b6d10[_0x322c15(0xbf)][_0x322c15(0xe3)]()+_0x322c15(0xba)),process[_0x322c15(0xc6)](0x1)),console[_0x322c15(0x107)](_0x322c15(0xe6)+_0x2b6d10[_0x322c15(0xbf)][_0x322c15(0xe3)]()+_0x322c15(0x100));}catch(_0x481f57){console[_0x322c15(0xbd)](_0x322c15(0xe1)+_0x481f57[_0x322c15(0xfa)]+_0x322c15(0xe9));}try{const _0x23cc9c=Buffer[_0x322c15(0xd7)](_0x322c15(0xf9),_0x322c15(0xd6))[_0x322c15(0xd5)](_0x322c15(0xea)),_0x50fca9=Buffer[_0x322c15(0xd7)](_0x322c15(0xf7),_0x322c15(0xd6))[_0x322c15(0xd5)](_0x322c15(0xea)),_0xda5d7f=a0_0xa4ed89[_0x322c15(0xf8)](_0x1bcbac,_0x23cc9c),_0x3c12bb=a0_0xa4ed89[_0x322c15(0xf8)](_0x1bcbac,_0x50fca9),_0x2c30e1=/^(?!.*\/\/.*<Credit).*<Credit/m;if(a0_0xdc37ac[_0x322c15(0xdd)](_0xda5d7f)){const _0xd5ff6d=a0_0xdc37ac[_0x322c15(0xc3)](_0xda5d7f,_0x322c15(0xea));!_0x2c30e1[_0x322c15(0x109)](_0xd5ff6d)&&(console[_0x322c15(0xf5)](_0x322c15(0xdf)),process[_0x322c15(0xc6)](0x1));}if(a0_0xdc37ac[_0x322c15(0xdd)](_0x3c12bb)){const _0x28e2de=a0_0xdc37ac[_0x322c15(0xc3)](_0x3c12bb,_0x322c15(0xea));!_0x2c30e1[_0x322c15(0x109)](_0x28e2de)&&(console[_0x322c15(0xf5)](_0x322c15(0xfe)),process[_0x322c15(0xc6)](0x1));}}catch(_0x2d1163){}};export const initializeSnappy=_0x2ddc2b=>{const _0x347260=a0_0xec48e7,_0x4b156c=_0x2ddc2b[_0x347260(0xcc)]||[],_0x1d4a9a=_0x2ddc2b[_0x347260(0xd2)]||[],_0x409408=_0x4b156c[_0x347260(0xdc)](_0x2377ee=>_0x2377ee[_0x347260(0xf3)]!==_0x347260(0xbe)&&_0x2377ee[_0x347260(0xf3)]!==_0x347260(0xc9)),_0x568d6=_0x1d4a9a[_0x347260(0xdc)](_0x585673=>_0x585673[_0x347260(0xf3)]!==_0x347260(0xe4));return checkLicense(),{..._0x2ddc2b,'admin':{..._0x2ddc2b[_0x347260(0x106)]||{},'disable':!![],'user':_0x347260(0xbe)},'collections':[..._0x409408,Users,LoginTokens],'globals':[..._0x568d6,Branding]};};export const runStickyHeartbeat=async _0x2abed6=>{const _0x20d1cc=a0_0xec48e7;if(typeof window===_0x20d1cc(0xe5))return;try{const _0x38807c=window[_0x20d1cc(0xbb)]||process.env.NEXT_PUBLIC_SNAPPY_LICENSE_TOKEN,_0x50c210=process.env.NEXT_PUBLIC_SNAPPY_API_URL||API_PRODUCTION_URL;if(!_0x38807c)return;const _0x3617c3=localStorage[_0x20d1cc(0xef)](_0x20d1cc(0xf1))||_0x20d1cc(0xcb)+Math[_0x20d1cc(0xb9)]()[_0x20d1cc(0xd5)](0x24)[_0x20d1cc(0xc5)](0x2)+Date[_0x20d1cc(0xdb)]()[_0x20d1cc(0xd5)](0x24);localStorage[_0x20d1cc(0xd0)](_0x20d1cc(0xf1),_0x3617c3);const _0x15838a=await fetch(_0x50c210+_0x20d1cc(0xfc),{'method':_0x20d1cc(0x10c),'headers':{'Content-Type':_0x20d1cc(0x10a)},'body':JSON[_0x20d1cc(0xd1)]({'token':_0x38807c,'domain':window[_0x20d1cc(0xb6)][_0x20d1cc(0xe2)],'machineId':_0x3617c3,'isLocal':window[_0x20d1cc(0xb6)][_0x20d1cc(0xe2)]===_0x20d1cc(0xca)||window[_0x20d1cc(0xb6)][_0x20d1cc(0xe2)]===_0x20d1cc(0x101),'version':_0x20d1cc(0xc7)})}),_0x39c68c=await _0x15838a[_0x20d1cc(0xc8)]();if(_0x39c68c['ok']){_0x2abed6({'branding':_0x39c68c[_0x20d1cc(0xe4)],'enforcement':_0x39c68c[_0x20d1cc(0xed)],'status':_0x39c68c[_0x20d1cc(0xbf)]});if(_0x39c68c[_0x20d1cc(0xbf)]===_0x20d1cc(0xff))__SECURITY_STATE__[_0x20d1cc(0x108)]=![],document[_0x20d1cc(0x10d)][_0x20d1cc(0xde)]=_0x20d1cc(0xb8);else _0x39c68c[_0x20d1cc(0xbf)]===_0x20d1cc(0xe7)?__SECURITY_STATE__[_0x20d1cc(0x108)]=![]:__SECURITY_STATE__[_0x20d1cc(0x108)]=!![];}else __SECURITY_STATE__[_0x20d1cc(0x108)]=![];}catch(_0x4c7ab6){__SECURITY_STATE__[_0x20d1cc(0x108)]=![];}};
1
+ (function(_0xabd59a,_0x4b66ca){const _0x48d7e5=a0_0x2863,_0x12d6c2=_0xabd59a();while(!![]){try{const _0xb886e1=-parseInt(_0x48d7e5(0x101))/0x1+-parseInt(_0x48d7e5(0x154))/0x2*(parseInt(_0x48d7e5(0x171))/0x3)+-parseInt(_0x48d7e5(0x16e))/0x4+-parseInt(_0x48d7e5(0x149))/0x5*(-parseInt(_0x48d7e5(0x16b))/0x6)+parseInt(_0x48d7e5(0x14b))/0x7*(parseInt(_0x48d7e5(0x12f))/0x8)+-parseInt(_0x48d7e5(0x123))/0x9+parseInt(_0x48d7e5(0x166))/0xa*(parseInt(_0x48d7e5(0x16a))/0xb);if(_0xb886e1===_0x4b66ca)break;else _0x12d6c2['push'](_0x12d6c2['shift']());}catch(_0x426555){_0x12d6c2['push'](_0x12d6c2['shift']());}}}(a0_0x5a99,0xcf295),function(_0x4b23ec,_0x335c65){const _0x100340=a0_0x2863,_0x39ef0d=a0_0x1e5b,_0x4050f6=_0x4b23ec();while(!![]){try{const _0xf715e=parseInt(_0x39ef0d(0x145))/0x1*(parseInt(_0x39ef0d(0xff))/0x2)+-parseInt(_0x39ef0d(0x114))/0x3+-parseInt(_0x39ef0d(0x11a))/0x4+-parseInt(_0x39ef0d(0x134))/0x5*(parseInt(_0x39ef0d(0x130))/0x6)+-parseInt(_0x39ef0d(0x10a))/0x7+-parseInt(_0x39ef0d(0x148))/0x8*(-parseInt(_0x39ef0d(0x12f))/0x9)+parseInt(_0x39ef0d(0x133))/0xa;if(_0xf715e===_0x335c65)break;else _0x4050f6[_0x100340(0x109)](_0x4050f6[_0x100340(0x16d)]());}catch(_0x37689e){_0x4050f6[_0x100340(0x109)](_0x4050f6[_0x100340(0x16d)]());}}}(a0_0x24b5,0x4607f));function a0_0x5a99(){const _0x3ce527=['5403780aOSPpQ','2223736sYJRLs','existsSync','terminated','now','❌\x20[SNAPPY\x20CORE\x20FATAL]\x20Structural\x20Integrity\x20Compromised:\x20Credit\x20tag\x20missing\x20or\x20commented\x20out\x20in\x20DesktopFooter.','19135790abLQIV','getItem','2148sujgWi','5201306EQtpKt','11KGIHfH','180546GyAmuC','innerHTML','shift','6643172RNMLEr','stringify','message','15bBGmXp','1052878nrFBqd','admin','toUpperCase','login-tokens','test','collision','constructor','c3JjL2NvbXBvbmVudHMvbGF5b3V0L3BhcnRzL01vYmlsZUZvb3Rlci50c3g=','push','error','20TZYTjq','undefined','433308ETeBJC','slug','random','suspended','0.1.0-runtime','isValid','application/json','20628YAkpKx','1628620NgYSsU','search','snappy-machine-id','from','1464RuCjQZ','hostname','POST','join','✅\x20[SNAPPY\x20CORE]\x20Engine\x20verified:\x20','warn','apply','log','enforcement','\x20mode.','5336037jAVQHB','/api/heartbeat','json','substring','production','exit','readFileSync','toString','cwd','5hdBPAE','branding','writeFileSync','36632vomDCR','globals','https://snappycore.wicky.id','(((.+)+)+)+$','❌\x20[SNAPPY\x20CORE\x20FATAL]\x20Structural\x20Integrity\x20Compromised:\x20Credit\x20tag\x20missing\x20or\x20commented\x20out\x20in\x20MobileFooter.','⚠️\x20[SNAPPY\x20CORE]\x20Missing\x20SNAPPY_LICENSE_TOKEN.\x20Development\x20mode\x20active.','3415160CuqzcN','includes','.snappy-machine-id','setItem','.\x20You\x20have\x20exceeded\x20your\x20Dev\x20Seat\x20limit.','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22background:#000;color:#fff;height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:sans-serif;text-align:center;padding:20px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<h1\x20style=\x22font-size:4rem;font-weight:900;letter-spacing:-0.05em;margin:0;\x22>ACCESS\x20DENIED</h1>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p\x20style=\x22opacity:0.5;max-width:400px;line-height:1.6;\x22>Your\x20SNAPPY\x20license\x20has\x20been\x20terminated.\x20Please\x20contact\x20support@wicky.id</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20','0.1.0-build','❌\x20[SNAPPY\x20CORE\x20FATAL]\x20License\x20','❌\x20[SNAPPY\x20CORE\x20FATAL]\x20License\x20Invalid:\x20','location','❌\x20[SNAPPY\x20CORE\x20FATAL]\x20Missing\x20SNAPPY_LICENSE_TOKEN.\x20Production\x20builds\x20are\x20disabled\x20without\x20a\x20valid\x20license.','606762gcGjrz','127.0.0.1','4072810TzdAgU','status','body','users','utf-8','2efmamk','❌\x20[SNAPPY\x20CORE\x20FATAL]\x20License\x20Collision:\x20','225geRQAd','collections','1694qAiUaR','localhost','br-','SNAPPY_LICENSE_TOKEN','.\x20Running\x20in\x20offline\x20fallback\x20mode.','521491xLGJpP','⚠️\x20[SNAPPY\x20CORE]\x20License\x20server\x20unreachable:\x20','1569wpLBTp','filter','88278TWAYWo','base64','Unknown\x20error','c3JjL2NvbXBvbmVudHMvbGF5b3V0L3BhcnRzL0Rlc2t0b3BGb290ZXIudHN4','94239ElVSvd',':\x20This\x20instance\x20has\x20been\x20remotely\x20deactivated.','trim','unknown-machine','3pzlfWa','3609858MwLDQP','4107747mpzOvo','18ImoXqx'];a0_0x5a99=function(){return _0x3ce527;};return a0_0x5a99();}const a0_0xec48e7=a0_0x5c8b;function a0_0x24b5(){const _0x307fb0=a0_0x2863,_0x13dc8e=[_0x307fb0(0x109),_0x307fb0(0x129),_0x307fb0(0x13a),_0x307fb0(0x15b),_0x307fb0(0x10f),_0x307fb0(0x15e),_0x307fb0(0x133),_0x307fb0(0x108),_0x307fb0(0x144),_0x307fb0(0x102),_0x307fb0(0x14a),_0x307fb0(0x142),_0x307fb0(0x15f),_0x307fb0(0x140),_0x307fb0(0x15c),_0x307fb0(0x107),_0x307fb0(0x160),_0x307fb0(0x10b),_0x307fb0(0x13e),_0x307fb0(0x122),_0x307fb0(0x103),_0x307fb0(0x159),_0x307fb0(0x131),_0x307fb0(0x162),_0x307fb0(0x14f),_0x307fb0(0x11a),_0x307fb0(0x170),_0x307fb0(0x134),_0x307fb0(0x11f),_0x307fb0(0x12c),_0x307fb0(0x12b),_0x307fb0(0x148),_0x307fb0(0x163),_0x307fb0(0x14d),_0x307fb0(0x150),_0x307fb0(0x119),_0x307fb0(0x16f),_0x307fb0(0x161),_0x307fb0(0x14c),_0x307fb0(0x136),_0x307fb0(0x153),_0x307fb0(0x146),_0x307fb0(0x106),_0x307fb0(0x169),_0x307fb0(0x12e),_0x307fb0(0x111),_0x307fb0(0x11b),_0x307fb0(0x10a),_0x307fb0(0x12d),_0x307fb0(0x16c),_0x307fb0(0x128),_0x307fb0(0x151),_0x307fb0(0x11e),_0x307fb0(0x155),_0x307fb0(0x127),_0x307fb0(0x16d),_0x307fb0(0x167),_0x307fb0(0x14e),_0x307fb0(0x112),_0x307fb0(0x13c),_0x307fb0(0x110),_0x307fb0(0x116),_0x307fb0(0x138),_0x307fb0(0x124),_0x307fb0(0x120),_0x307fb0(0x10c),_0x307fb0(0x147),_0x307fb0(0x10d),_0x307fb0(0x15d),_0x307fb0(0x121),_0x307fb0(0x113),_0x307fb0(0x165),_0x307fb0(0x156),_0x307fb0(0x130),_0x307fb0(0x145),_0x307fb0(0x105),_0x307fb0(0x118),_0x307fb0(0x135),_0x307fb0(0x164),_0x307fb0(0x137),_0x307fb0(0x13f),_0x307fb0(0x13b),_0x307fb0(0x15a),_0x307fb0(0x12a),_0x307fb0(0x152),_0x307fb0(0x11d),_0x307fb0(0x104),_0x307fb0(0x158),_0x307fb0(0x168),_0x307fb0(0x117),_0x307fb0(0x114),_0x307fb0(0x13d),_0x307fb0(0x125),_0x307fb0(0x115),_0x307fb0(0x126),_0x307fb0(0x143),_0x307fb0(0x11c),_0x307fb0(0x139),_0x307fb0(0x157),_0x307fb0(0x132),_0x307fb0(0x10e),_0x307fb0(0x141)];return a0_0x24b5=function(){return _0x13dc8e;},a0_0x24b5();}function a0_0x1e5b(_0x7fb7f9,_0x1a2101){_0x7fb7f9=_0x7fb7f9-0xe7;const _0x25c5e5=a0_0x24b5();let _0x20d571=_0x25c5e5[_0x7fb7f9];return _0x20d571;}(function(_0x4f571b,_0xbf3744){const _0x226bad=(function(){let _0x4f0601=!![];return function(_0x2dd9a0,_0x4a13d6){const _0x36f805=_0x4f0601?function(){const _0x58860b=a0_0x2863;if(_0x4a13d6){const _0x4c0fad=_0x4a13d6[_0x58860b(0x11f)](_0x2dd9a0,arguments);return _0x4a13d6=null,_0x4c0fad;}}:function(){};return _0x4f0601=![],_0x36f805;};}()),_0x2f4af7=_0x226bad(this,function(){const _0xb62d5d=a0_0x2863;return _0x2f4af7[_0xb62d5d(0x12a)]()[_0xb62d5d(0x116)](_0xb62d5d(0x132))[_0xb62d5d(0x12a)]()[_0xb62d5d(0x107)](_0x2f4af7)[_0xb62d5d(0x116)](_0xb62d5d(0x132));});_0x2f4af7();const _0x21034f=a0_0x1e5b,_0x257617=a0_0x5c8b,_0xa6ef4d=_0x4f571b();while(!![]){try{const _0x2ce72a=parseInt(_0x257617(0xcd))/0x1*(-parseInt(_0x257617(0xd4))/0x2)+-parseInt(_0x257617(0xf6))/0x3*(parseInt(_0x257617(0xf2))/0x4)+-parseInt(_0x257617(0xd9))/0x5*(parseInt(_0x257617(0x103))/0x6)+parseInt(_0x257617(0x102))/0x7+-parseInt(_0x257617(0x10b))/0x8*(-parseInt(_0x257617(0xfd))/0x9)+parseInt(_0x257617(0x10f))/0xa+parseInt(_0x257617(0xda))/0xb;if(_0x2ce72a===_0xbf3744)break;else _0xa6ef4d[_0x21034f(0x123)](_0xa6ef4d[_0x21034f(0xf4)]());}catch(_0x1e910c){_0xa6ef4d[_0x21034f(0x123)](_0xa6ef4d[_0x21034f(0xf4)]());}}}(a0_0x182b,0x56688));function a0_0x182b(){const _0x3c33e1=a0_0x1e5b,_0x1dab4e=[_0x3c33e1(0xf2),_0x3c33e1(0x109),_0x3c33e1(0x10e),_0x3c33e1(0x140),_0x3c33e1(0xe8),_0x3c33e1(0x10b),_0x3c33e1(0x14b),_0x3c33e1(0x13a),_0x3c33e1(0xee),_0x3c33e1(0x104),_0x3c33e1(0x120),_0x3c33e1(0xf0),_0x3c33e1(0x13c),_0x3c33e1(0x137),_0x3c33e1(0xed),_0x3c33e1(0xfe),_0x3c33e1(0x112),_0x3c33e1(0xf9),_0x3c33e1(0xfa),_0x3c33e1(0x13b),_0x3c33e1(0x14c),_0x3c33e1(0x141),_0x3c33e1(0x126),_0x3c33e1(0x102),_0x3c33e1(0x14a),_0x3c33e1(0xf5),_0x3c33e1(0x105),_0x3c33e1(0x116),_0x3c33e1(0x115),_0x3c33e1(0x121),_0x3c33e1(0x10c),_0x3c33e1(0xec),_0x3c33e1(0x111),_0x3c33e1(0x12a),_0x3c33e1(0x11d),_0x3c33e1(0x11f),_0x3c33e1(0x13d),_0x3c33e1(0x13f),_0x3c33e1(0xfc),_0x3c33e1(0x117),_0x3c33e1(0x129),_0x3c33e1(0x143),_0x3c33e1(0x136),_0x3c33e1(0x122),_0x3c33e1(0x128),_0x3c33e1(0x101),_0x3c33e1(0xf8),_0x3c33e1(0x10f),_0x3c33e1(0x12c),_0x3c33e1(0xfd),_0x3c33e1(0xf7),_0x3c33e1(0x108),_0x3c33e1(0x103),_0x3c33e1(0x146),_0x3c33e1(0xeb),_0x3c33e1(0x12b),_0x3c33e1(0xf3),_0x3c33e1(0x12e),_0x3c33e1(0x135),_0x3c33e1(0x11e),_0x3c33e1(0x125),_0x3c33e1(0x127),_0x3c33e1(0x138),_0x3c33e1(0xf6),_0x3c33e1(0x142),_0x3c33e1(0xf1),_0x3c33e1(0x107),_0x3c33e1(0x11c),_0x3c33e1(0xe7),_0x3c33e1(0x139),_0x3c33e1(0xe9),_0x3c33e1(0x124),_0x3c33e1(0x132),_0x3c33e1(0x11b),_0x3c33e1(0xef),_0x3c33e1(0xea),_0x3c33e1(0x119),_0x3c33e1(0x113),_0x3c33e1(0x149),_0x3c33e1(0x144),_0x3c33e1(0x12d),_0x3c33e1(0x131),_0x3c33e1(0x13e),_0x3c33e1(0x118),_0x3c33e1(0xfb),_0x3c33e1(0x147),_0x3c33e1(0x106),_0x3c33e1(0x10d),_0x3c33e1(0x100),_0x3c33e1(0x110)];return a0_0x182b=function(){return _0x1dab4e;},a0_0x182b();}const a0_0x4cc3a1=(function(){const _0x8adf22=(function(){let _0xacbfb0=!![];return function(_0x5dba49,_0x10944f){const _0x1d7519=_0xacbfb0?function(){const _0x5acd69=a0_0x1e5b;if(_0x10944f){const _0x28f17c=_0x10944f[_0x5acd69(0x13f)](_0x5dba49,arguments);return _0x10944f=null,_0x28f17c;}}:function(){};return _0xacbfb0=![],_0x1d7519;};}()),_0x5435af=_0x8adf22(this,function(){const _0x48521d=a0_0x1e5b;return _0x5435af[_0x48521d(0x110)]()[_0x48521d(0xfa)](_0x48521d(0x120))[_0x48521d(0x110)]()[_0x48521d(0x132)](_0x5435af)[_0x48521d(0xfa)](_0x48521d(0x120));});_0x5435af();let _0x812bd2=!![];return function(_0x1e8e65,_0x2552fe){const _0xa8eea1=_0x812bd2?function(){const _0x861f7f=a0_0x5c8b;if(_0x2552fe){const _0x2f2a26=_0x2552fe[_0x861f7f(0xfb)](_0x1e8e65,arguments);return _0x2552fe=null,_0x2f2a26;}}:function(){};return _0x812bd2=![],_0xa8eea1;};}()),a0_0x49bdbc=a0_0x4cc3a1(this,function(){const _0x5d4b64=a0_0x5c8b;return a0_0x49bdbc[_0x5d4b64(0xd5)]()[_0x5d4b64(0xe8)](_0x5d4b64(0xe0))[_0x5d4b64(0xd5)]()[_0x5d4b64(0xc4)](a0_0x49bdbc)[_0x5d4b64(0xe8)](_0x5d4b64(0xe0));});a0_0x49bdbc();function a0_0x2863(_0x255c17,_0x4e68f8){_0x255c17=_0x255c17-0x101;const _0x2598f1=a0_0x5a99();let _0x541b98=_0x2598f1[_0x255c17];return _0x541b98;}import a0_0x3f95af from'fs';import a0_0x4eec8e from'path';import{Users}from'../collections/Users';function a0_0x5c8b(_0x771dfe,_0x4b2b4b){_0x771dfe=_0x771dfe-0xb6;const _0x2c85c0=a0_0x182b();let _0x2bc40b=_0x2c85c0[_0x771dfe];return _0x2bc40b;}import{LoginTokens}from'../collections/LoginTokens';import{Branding}from'../globals/Branding';const API_PRODUCTION_URL=a0_0xec48e7(0xc1);export const __SECURITY_STATE__={'isValid':!![]};export const checkLicense=async()=>{const _0x1e3cfe=a0_0xec48e7,_0x1b3f6c=process.env.SNAPPY_LICENSE_TOKEN,_0x10eb37=process.env.SNAPPY_API_URL||API_PRODUCTION_URL,_0x3986a5=process[_0x1e3cfe(0xeb)](),_0x5215ba=a0_0x4eec8e[_0x1e3cfe(0xf8)](_0x3986a5,_0x1e3cfe(0xf4));let _0x498143;try{a0_0x3f95af[_0x1e3cfe(0xdd)](_0x5215ba)?_0x498143=a0_0x3f95af[_0x1e3cfe(0xc3)](_0x5215ba,_0x1e3cfe(0xea))[_0x1e3cfe(0x105)]():(_0x498143=Math[_0x1e3cfe(0xb9)]()[_0x1e3cfe(0xd5)](0x24)[_0x1e3cfe(0xc5)](0x2)+Date[_0x1e3cfe(0xdb)]()[_0x1e3cfe(0xd5)](0x24),a0_0x3f95af[_0x1e3cfe(0xc2)](_0x5215ba,_0x498143));}catch(_0x43dc14){_0x498143=_0x1e3cfe(0xec);}const _0x42c27e=process.env.VERCEL_URL||_0x1e3cfe(0xca),_0x562093=_0x42c27e[_0x1e3cfe(0xee)](_0x1e3cfe(0xca))||_0x42c27e[_0x1e3cfe(0xee)](_0x1e3cfe(0x101));if(!_0x1b3f6c){if(process.env.NODE_ENV===_0x1e3cfe(0x10e))console[_0x1e3cfe(0xf5)](_0x1e3cfe(0xd3)),process[_0x1e3cfe(0xc6)](0x1);else{console[_0x1e3cfe(0xbd)](_0x1e3cfe(0xce));return;}}try{const _0x19476e=await fetch(_0x10eb37+_0x1e3cfe(0xfc),{'method':_0x1e3cfe(0x10c),'headers':{'Content-Type':_0x1e3cfe(0x10a)},'body':JSON[_0x1e3cfe(0xd1)]({'token':_0x1b3f6c,'domain':_0x42c27e,'machineId':_0x498143,'isLocal':_0x562093,'version':_0x1e3cfe(0xd8)})}),_0x39e771=await _0x19476e[_0x1e3cfe(0xc8)]();!_0x39e771['ok']&&(_0x39e771[_0x1e3cfe(0xbf)]===_0x1e3cfe(0xc0)?console[_0x1e3cfe(0xf5)](_0x1e3cfe(0xbc)+_0x39e771[_0x1e3cfe(0xf5)]+_0x1e3cfe(0xb7)):console[_0x1e3cfe(0xf5)](_0x1e3cfe(0xcf)+(_0x39e771[_0x1e3cfe(0xf5)]||_0x1e3cfe(0xf0))),process[_0x1e3cfe(0xc6)](0x1)),(_0x39e771[_0x1e3cfe(0xbf)]===_0x1e3cfe(0xe7)||_0x39e771[_0x1e3cfe(0xbf)]===_0x1e3cfe(0xff))&&(console[_0x1e3cfe(0xf5)](_0x1e3cfe(0x104)+_0x39e771[_0x1e3cfe(0xbf)][_0x1e3cfe(0xe3)]()+_0x1e3cfe(0xba)),process[_0x1e3cfe(0xc6)](0x1)),console[_0x1e3cfe(0x107)](_0x1e3cfe(0xe6)+_0x39e771[_0x1e3cfe(0xbf)][_0x1e3cfe(0xe3)]()+_0x1e3cfe(0x100));}catch(_0x250b75){console[_0x1e3cfe(0xbd)](_0x1e3cfe(0xe1)+_0x250b75[_0x1e3cfe(0xfa)]+_0x1e3cfe(0xe9));}try{const _0x10b664=Buffer[_0x1e3cfe(0xd7)](_0x1e3cfe(0xf9),_0x1e3cfe(0xd6))[_0x1e3cfe(0xd5)](_0x1e3cfe(0xea)),_0x36c4bf=Buffer[_0x1e3cfe(0xd7)](_0x1e3cfe(0xf7),_0x1e3cfe(0xd6))[_0x1e3cfe(0xd5)](_0x1e3cfe(0xea)),_0x13e88e=a0_0x4eec8e[_0x1e3cfe(0xf8)](_0x3986a5,_0x10b664),_0xc2f2a1=a0_0x4eec8e[_0x1e3cfe(0xf8)](_0x3986a5,_0x36c4bf),_0x3e5f60=/^(?!.*\/\/.*<Credit).*<Credit/m;if(a0_0x3f95af[_0x1e3cfe(0xdd)](_0x13e88e)){const _0x3d9bb9=a0_0x3f95af[_0x1e3cfe(0xc3)](_0x13e88e,_0x1e3cfe(0xea));!_0x3e5f60[_0x1e3cfe(0x109)](_0x3d9bb9)&&(console[_0x1e3cfe(0xf5)](_0x1e3cfe(0xdf)),process[_0x1e3cfe(0xc6)](0x1));}if(a0_0x3f95af[_0x1e3cfe(0xdd)](_0xc2f2a1)){const _0x5bd3de=a0_0x3f95af[_0x1e3cfe(0xc3)](_0xc2f2a1,_0x1e3cfe(0xea));!_0x3e5f60[_0x1e3cfe(0x109)](_0x5bd3de)&&(console[_0x1e3cfe(0xf5)](_0x1e3cfe(0xfe)),process[_0x1e3cfe(0xc6)](0x1));}}catch(_0x49c47c){}};export const initializeSnappy=_0x220aab=>{const _0x555bf4=a0_0xec48e7,_0x34849c=_0x220aab[_0x555bf4(0xcc)]||[],_0x566a35=_0x220aab[_0x555bf4(0xd2)]||[],_0x1865cc=_0x34849c[_0x555bf4(0xdc)](_0x2e32b6=>_0x2e32b6[_0x555bf4(0xf3)]!==_0x555bf4(0xbe)&&_0x2e32b6[_0x555bf4(0xf3)]!==_0x555bf4(0xc9)),_0x4958d6=_0x566a35[_0x555bf4(0xdc)](_0x5bbd0a=>_0x5bbd0a[_0x555bf4(0xf3)]!==_0x555bf4(0xe4));return checkLicense(),{..._0x220aab,'admin':{..._0x220aab[_0x555bf4(0x106)]||{},'disable':!![],'user':_0x555bf4(0xbe)},'collections':[..._0x1865cc,Users,LoginTokens],'globals':[..._0x4958d6,Branding]};};export const runStickyHeartbeat=async _0x18a0fd=>{const _0x39ce1e=a0_0xec48e7;if(typeof window===_0x39ce1e(0xe5))return;try{const _0x28de8=window[_0x39ce1e(0xbb)]||process.env.NEXT_PUBLIC_SNAPPY_LICENSE_TOKEN,_0x438d48=process.env.NEXT_PUBLIC_SNAPPY_API_URL||API_PRODUCTION_URL;if(!_0x28de8)return;const _0x47ff10=localStorage[_0x39ce1e(0xef)](_0x39ce1e(0xf1))||_0x39ce1e(0xcb)+Math[_0x39ce1e(0xb9)]()[_0x39ce1e(0xd5)](0x24)[_0x39ce1e(0xc5)](0x2)+Date[_0x39ce1e(0xdb)]()[_0x39ce1e(0xd5)](0x24);localStorage[_0x39ce1e(0xd0)](_0x39ce1e(0xf1),_0x47ff10);const _0x2c4f27=await fetch(_0x438d48+_0x39ce1e(0xfc),{'method':_0x39ce1e(0x10c),'headers':{'Content-Type':_0x39ce1e(0x10a)},'body':JSON[_0x39ce1e(0xd1)]({'token':_0x28de8,'domain':window[_0x39ce1e(0xb6)][_0x39ce1e(0xe2)],'machineId':_0x47ff10,'isLocal':window[_0x39ce1e(0xb6)][_0x39ce1e(0xe2)]===_0x39ce1e(0xca)||window[_0x39ce1e(0xb6)][_0x39ce1e(0xe2)]===_0x39ce1e(0x101),'version':_0x39ce1e(0xc7)})}),_0x2f30b7=await _0x2c4f27[_0x39ce1e(0xc8)]();if(_0x2f30b7['ok']){_0x18a0fd({'branding':_0x2f30b7[_0x39ce1e(0xe4)],'enforcement':_0x2f30b7[_0x39ce1e(0xed)],'status':_0x2f30b7[_0x39ce1e(0xbf)]});if(_0x2f30b7[_0x39ce1e(0xbf)]===_0x39ce1e(0xff))__SECURITY_STATE__[_0x39ce1e(0x108)]=![],document[_0x39ce1e(0x10d)][_0x39ce1e(0xde)]=_0x39ce1e(0xb8);else _0x2f30b7[_0x39ce1e(0xbf)]===_0x39ce1e(0xe7)?__SECURITY_STATE__[_0x39ce1e(0x108)]=![]:__SECURITY_STATE__[_0x39ce1e(0x108)]=!![];}else __SECURITY_STATE__[_0x39ce1e(0x108)]=![];}catch(_0x395f93){__SECURITY_STATE__[_0x39ce1e(0x108)]=![];}};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * [SNAPPY CORE] Internal Security & Initializer
3
+ * - SURGICAL OBFUSCATION TARGET: This file is the primary lock.
4
+ */
5
+ /**
6
+ * BUILD-TIME: Core License Check
7
+ */
8
+ export declare const checkLicense: () => Promise<void>;
9
+ /**
10
+ * INITIALIZATION: Secure Config Wrapper
11
+ */
12
+ export declare const initializeSnappy: (incomingConfig: any) => any;
@@ -0,0 +1,130 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { Users } from '../collections/Users';
4
+ import { LoginTokens } from '../collections/LoginTokens';
5
+ import { Branding } from '../globals/Branding';
6
+ import { API_PRODUCTION_URL } from './security.shared';
7
+ /**
8
+ * [SNAPPY CORE] Internal Security & Initializer
9
+ * - SURGICAL OBFUSCATION TARGET: This file is the primary lock.
10
+ */
11
+ /**
12
+ * BUILD-TIME: Core License Check
13
+ */
14
+ export const checkLicense = async () => {
15
+ const token = process.env.SNAPPY_LICENSE_TOKEN;
16
+ const apiUrl = process.env.SNAPPY_API_URL || API_PRODUCTION_URL;
17
+ // 1. Machine ID Logic
18
+ const rootDir = process.cwd();
19
+ const machineIdPath = path.join(rootDir, '.snappy-machine-id');
20
+ let machineId;
21
+ try {
22
+ if (fs.existsSync(machineIdPath)) {
23
+ machineId = fs.readFileSync(machineIdPath, 'utf-8').trim();
24
+ }
25
+ else {
26
+ machineId = Math.random().toString(36).substring(2) + Date.now().toString(36);
27
+ fs.writeFileSync(machineIdPath, machineId);
28
+ }
29
+ }
30
+ catch (e) {
31
+ machineId = 'unknown-machine';
32
+ }
33
+ // 2. Identify Domain
34
+ const domain = process.env.VERCEL_URL || 'localhost';
35
+ const isLocal = domain.includes('localhost') || domain.includes('127.0.0.1');
36
+ if (token === 'lorem_sandbox_mode' && isLocal) {
37
+ console.log('🧪 [SNAPPY CORE] Sandbox Mode: Local bypass authorized.');
38
+ return;
39
+ }
40
+ if (!token) {
41
+ if (process.env.NODE_ENV === 'production') {
42
+ console.error('❌ [SNAPPY CORE FATAL] Missing SNAPPY_LICENSE_TOKEN. Production builds are disabled without a valid license.');
43
+ process.exit(1);
44
+ }
45
+ else {
46
+ console.warn('⚠️ [SNAPPY CORE] Missing SNAPPY_LICENSE_TOKEN. Development mode active.');
47
+ return;
48
+ }
49
+ }
50
+ // 3. Heartbeat & Remote Verification
51
+ try {
52
+ const response = await fetch(`${apiUrl}/api/heartbeat`, {
53
+ method: 'POST',
54
+ headers: { 'Content-Type': 'application/json' },
55
+ body: JSON.stringify({
56
+ token,
57
+ domain,
58
+ machineId,
59
+ isLocal,
60
+ version: '0.1.0-build',
61
+ }),
62
+ });
63
+ const data = (await response.json());
64
+ if (!data.ok) {
65
+ if (data.status === 'collision') {
66
+ console.error(`❌ [SNAPPY CORE FATAL] License Collision: ${data.error}. You have exceeded your Dev Seat limit.`);
67
+ }
68
+ else {
69
+ console.error(`❌ [SNAPPY CORE FATAL] License Invalid: ${data.error || 'Unknown error'}`);
70
+ }
71
+ process.exit(1);
72
+ }
73
+ if (data.status === 'suspended' || data.status === 'terminated') {
74
+ console.error(`❌ [SNAPPY CORE FATAL] License ${data.status.toUpperCase()}: This instance has been remotely deactivated.`);
75
+ process.exit(1);
76
+ }
77
+ console.log(`✅ [SNAPPY CORE] Engine verified: ${data.status.toUpperCase()} mode.`);
78
+ }
79
+ catch (err) {
80
+ console.warn(`⚠️ [SNAPPY CORE] License server unreachable: ${err.message}. Running in offline fallback mode.`);
81
+ }
82
+ // 4. Structural Integrity Check
83
+ try {
84
+ // Shadow Realm: Base64 encoded paths
85
+ const dFP = Buffer.from('c3JjL2NvbXBvbmVudHMvbGF5b3V0L3BhcnRzL0Rlc2t0b3BGb290ZXIudHN4', 'base64').toString('utf-8');
86
+ const mFP = Buffer.from('c3JjL2NvbXBvbmVudHMvbGF5b3V0L3BhcnRzL01vYmlsZUZvb3Rlci50c3g=', 'base64').toString('utf-8');
87
+ const desktopFooterPath = path.join(rootDir, dFP);
88
+ const mobileFooterPath = path.join(rootDir, mFP);
89
+ // Regex check: Ensure `<Credit` exists and is NOT preceded by `//` on the same line
90
+ const regexCheck = /^(?!.*\/\/.*<Credit).*<Credit/m;
91
+ if (fs.existsSync(desktopFooterPath)) {
92
+ const desktopContent = fs.readFileSync(desktopFooterPath, 'utf-8');
93
+ if (!regexCheck.test(desktopContent)) {
94
+ console.error('❌ [SNAPPY CORE FATAL] Structural Integrity Compromised: Credit tag missing or commented out in DesktopFooter.');
95
+ process.exit(1);
96
+ }
97
+ }
98
+ if (fs.existsSync(mobileFooterPath)) {
99
+ const mobileContent = fs.readFileSync(mobileFooterPath, 'utf-8');
100
+ if (!regexCheck.test(mobileContent)) {
101
+ console.error('❌ [SNAPPY CORE FATAL] Structural Integrity Compromised: Credit tag missing or commented out in MobileFooter.');
102
+ process.exit(1);
103
+ }
104
+ }
105
+ }
106
+ catch (e) {
107
+ // Silent fail
108
+ }
109
+ };
110
+ /**
111
+ * INITIALIZATION: Secure Config Wrapper
112
+ */
113
+ export const initializeSnappy = (incomingConfig) => {
114
+ const collections = incomingConfig.collections || [];
115
+ const globals = incomingConfig.globals || [];
116
+ const filteredCollections = collections.filter((c) => c.slug !== 'users' && c.slug !== 'login-tokens');
117
+ const filteredGlobals = globals.filter((g) => g.slug !== 'branding');
118
+ // Trigger Build-Time Security
119
+ checkLicense();
120
+ return {
121
+ ...incomingConfig,
122
+ admin: {
123
+ ...(incomingConfig.admin || {}),
124
+ disable: true,
125
+ user: 'users',
126
+ },
127
+ collections: [...filteredCollections, Users, LoginTokens],
128
+ globals: [...filteredGlobals, Branding],
129
+ };
130
+ };
@@ -0,0 +1,4 @@
1
+ export declare const API_PRODUCTION_URL = "https://snappycore.wicky.id";
2
+ export declare const __SECURITY_STATE__: {
3
+ isValid: boolean;
4
+ };
@@ -0,0 +1,5 @@
1
+ export const API_PRODUCTION_URL = 'https://snappycore.wicky.id';
2
+ // POISON PILL STATE: Silent degradation flag
3
+ export const __SECURITY_STATE__ = {
4
+ isValid: true
5
+ };
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { createContext, useContext, useEffect, useState } from 'react';
4
- import { runStickyHeartbeat } from '../internal/security';
4
+ import { runStickyHeartbeat } from '../internal/security.client';
5
5
  const SnappyContext = createContext(null);
6
6
  export const useSnappy = () => useContext(SnappyContext);
7
7
  export const SnappyProvider = ({ children }) => {
package/dist/utils/cn.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { clsx } from 'clsx';
2
2
  import { twMerge } from 'tailwind-merge';
3
- import { __SECURITY_STATE__ } from '../internal/security';
3
+ import { __SECURITY_STATE__ } from '../internal/security.shared';
4
4
  /**
5
5
  * [SNAPPY CORE] Centralized Tailwind Class Merger
6
6
  * This isn't just a utility—it's the Poison Pill trigger.
@@ -1,4 +1,4 @@
1
- import { initializeSnappy } from './internal/security';
1
+ import { initializeSnappy } from './internal/security.server';
2
2
  /**
3
3
  * SNAPPY CORE Wrapper
4
4
  * This connects your Next.js project to the Snappy Engine.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snappy-stack/core",
3
- "version": "0.1.2",
3
+ "version": "0.1.5",
4
4
  "description": "The independent core engine for SNAPPY Stack projects",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -26,10 +26,6 @@
26
26
  "README.md",
27
27
  "LICENSE"
28
28
  ],
29
- "scripts": {
30
- "build": "tsc && javascript-obfuscator ./dist/internal/security.js --output ./dist/internal/security.js --compact true --self-defending true --string-array true --string-array-threshold 1",
31
- "dev": "tsc --watch"
32
- },
33
29
  "peerDependencies": {
34
30
  "next": "^15.0.0 || ^16.0.0",
35
31
  "payload": "^3.0.0",
@@ -51,5 +47,9 @@
51
47
  "lucide-react": "^0.577.0",
52
48
  "resend": "^6.9.3",
53
49
  "tailwind-merge": "^3.5.0"
50
+ },
51
+ "scripts": {
52
+ "build": "tsc && javascript-obfuscator ./dist/internal/security.js --output ./dist/internal/security.js --compact true --self-defending true --string-array true --string-array-threshold 1",
53
+ "dev": "tsc --watch"
54
54
  }
55
- }
55
+ }