create-fuzionx 0.1.45 → 0.1.47

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.
package/fx.js CHANGED
@@ -49,10 +49,10 @@ if (existsSync(localBin) || existsSync(localCli)) {
49
49
  fx — FuzionX CLI
50
50
 
51
51
  프로젝트 생성:
52
- fx new <name> 새 프로젝트 스캐폴딩
52
+ fx new <name> --type=ssr|spa 새 프로젝트 스캐폴딩
53
53
 
54
54
  프로젝트 내 명령어 (@fuzionx/framework 필요):
55
- fx make:app --type=ssr|spa Create app (fixed name: app/ssr or app/spa)
55
+ fx make:app --type=ssr|spa [--name=<appName>] Create app
56
56
  fx make:controller <Name> --app= Create controller (app-specific)
57
57
  fx make:service <Name> --app= Create service (app-specific)
58
58
  fx make:model <Name> Create model (database/models)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fuzionx",
3
- "version": "0.1.45",
3
+ "version": "0.1.47",
4
4
  "description": "Create a new FuzionX application — npx create-fuzionx my-app",
5
5
  "type": "module",
6
6
  "bin": {
@@ -132,7 +132,7 @@ bridge:
132
132
 
133
133
  # ── ASP 암호화 ──
134
134
  asp:
135
- enabled: true
135
+ enabled: false
136
136
  master_secret: "${ASP_SECRET:change-me-in-production}"
137
137
  header_signal: Ruxy-Enc-Mode
138
138
 
@@ -157,6 +157,8 @@ app:
157
157
  name: '{{name}}'
158
158
  environment: development # development | production
159
159
 
160
+ # fuzionx 서버가 앞단이고 암/복호화를 하는 경우 bridge에서는 암/복호화를 하면 안된다. 이중 암/복호화가 된다. wasm이 암호화한 걸 이미 fuzionx가 서버가 복호화를 했기에 bridge에서는 결국 오류
161
+ # bridge.asp.enabled가 true이면 bridge 서버에서 패킷도 암/복호화를 하지만 아래 asp.enabled만 true인 경우에는 wasm에서만 암/복호화를 처리하게 해야 한다.
160
162
  asp:
161
163
  enabled: false
162
164
 
@@ -9,8 +9,8 @@
9
9
  "test": "vitest run"
10
10
  },
11
11
  "dependencies": {
12
- "@fuzionx/framework": "^0.1.45",
13
- "@fuzionx/client": "^0.1.45",
12
+ "@fuzionx/framework": "^0.1.47",
13
+ "@fuzionx/client": "^0.1.47",
14
14
  "joi": "^18.1.1"
15
15
  },
16
16
  "devDependencies": {
@@ -28,8 +28,7 @@ export default class HomeController extends Controller {
28
28
  const bridge = this.app._bridge;
29
29
 
30
30
  // ASP config에서 masterSecret 가져오기
31
- const aspConfig = JSON.parse(bridge.getAspConfig());
32
- const masterSecret = aspConfig.masterSecret || '';
31
+ const aspConfig = JSON.parse(bridge.getAspConfig());
33
32
 
34
33
  // 세션에서 유저 조회 (인증 안 되어 있으면 null)
35
34
  let user = null;
@@ -50,17 +49,16 @@ export default class HomeController extends Controller {
50
49
  locales: this.app?.i18n?.locales?.() || [],
51
50
  translations: ctx.t.all(),
52
51
  isDev,
53
- asp: { headerSignal: aspConfig.headerSignal || 'Ruxy-Enc-Mode' },
52
+ asp: { headerSignal: aspConfig.headerSignal || 'Ruxy-Enc-Mode', masterSecret: aspConfig.masterSecret },
54
53
  app: { name: this.config.get('app.name'), theme: this.config.get('app.themes.default') },
55
54
  };
56
55
 
57
56
  // 암호화 (bridge crypto_encrypt_custom — WASM decrypt_custom과 호환)
58
- const encryptedPayload = bridge.cryptoEncryptCustom(clientSecret, JSON.stringify(payload));
59
- const encryptedSecret = bridge.cryptoEncryptCustom(clientSecret, masterSecret);
60
-
57
+ const encryptedPayload = bridge.cryptoEncryptCustom(clientSecret, JSON.stringify(payload));
58
+
61
59
  ctx.render('home', {
62
- __fx__: encryptedPayload,
63
- __fx_secret__: encryptedSecret,
60
+ __fx__: encryptedPayload,
61
+ __fx__enabled: aspConfig.enabled || this.config.get('app.asp').enabled,
64
62
  client_secret: clientSecret,
65
63
  isDev,
66
64
  });
@@ -4,7 +4,7 @@
4
4
  "description": "Vue.js 3 SPA + Tera SSR 하이브리드. WASM 암호화 통신.",
5
5
  "features": ["auth", "board", "i18n", "asp", "wasm"],
6
6
  "dependencies": {
7
- "@fuzionx/client": "^0.1.45"
7
+ "@fuzionx/client": "^0.1.47"
8
8
  },
9
9
  "devDependencies": {},
10
10
  "spaDevDependencies": {
@@ -17,6 +17,6 @@
17
17
  <script>
18
18
  window.__FX_CLIENT_SECRET__ = "{{ client_secret | safe }}";
19
19
  window.__FX__ = "{{ __fx__ | safe }}";
20
- window.__FX_SECRET__ = "{{ __fx_secret__ | safe }}";
20
+ window.__FX__ENC_ENABLED = {{ __fx__enabled | safe }}
21
21
  </script>
22
22
  {% endblock %}
@@ -59,12 +59,12 @@ export function useApi() {
59
59
  // WASM client 메서드 사용 — 자동 ASP 암/복호화
60
60
  let res;
61
61
  switch (method) {
62
- case 'GET': res = _aspClient.get(url); break;
63
- case 'POST': res = _aspClient.post(url, bodyObj); break;
64
- case 'PUT': res = _aspClient.put(url, bodyObj); break;
65
- case 'PATCH': res = _aspClient.patch(url, bodyObj); break;
66
- case 'DELETE': res = _aspClient.delete(url); break;
67
- default: res = _aspClient.get(url); break;
62
+ case 'GET': res = _aspClient.get(url, window.__FX__ENC_ENABLED); break;
63
+ case 'POST': res = _aspClient.post(url, bodyObj, window.__FX__ENC_ENABLED); break;
64
+ case 'PUT': res = _aspClient.put(url, bodyObj, window.__FX__ENC_ENABLED); break;
65
+ case 'PATCH': res = _aspClient.patch(url, bodyObj, window.__FX__ENC_ENABLED); break;
66
+ case 'DELETE': res = _aspClient.delete(url, window.__FX__ENC_ENABLED); break;
67
+ default: res = _aspClient.get(url, window.__FX__ENC_ENABLED); break;
68
68
  }
69
69
 
70
70
  if (res.status === 401) {
@@ -41,10 +41,8 @@ router.beforeEach((to) => {
41
41
  async function bootstrap() {
42
42
  const clientSecret = window.__FX_CLIENT_SECRET__;
43
43
  const encPayload = window.__FX__;
44
- const encSecret = window.__FX_SECRET__;
45
-
46
- let fxConfig = {};
47
44
  let masterSecret = '';
45
+ let fxConfig = {};
48
46
 
49
47
  // WASM 초기화 Promise를 useApi에 등록 (aspFetch가 대기할 수 있도록)
50
48
  const wasmInit = (async () => {
@@ -58,7 +56,7 @@ async function bootstrap() {
58
56
  const configJson = client.decrypt_custom(clientSecret, encPayload);
59
57
  fxConfig = JSON.parse(configJson);
60
58
 
61
- masterSecret = client.decrypt_custom(clientSecret, encSecret);
59
+ masterSecret = fxConfig.asp.masterSecret;
62
60
 
63
61
  // ASP 활성 클라이언트
64
62
  const headerSignal = fxConfig.asp?.headerSignal || 'Ruxy-Enc-Mode';
@@ -200,20 +200,10 @@ async function connectWS() {
200
200
 
201
201
  // masterSecret는 main.js에서 inject('masterSecret')로 제공됨
202
202
  const masterSecret = injectedMasterSecret || '';
203
- const aspEnabled = !!masterSecret; // masterSecret이 있으면 ASP 활성
204
-
205
- // 🔍 디버그 로그 — ASP 암호화 변수 확인
206
- console.log('[Chat] ASP Debug:', {
207
- masterSecret: masterSecret ? `${masterSecret.substring(0, 8)}...` : '(empty)',
208
- aspEnabled,
209
- fxConfigAsp: fxConfig.asp,
210
- injectedMasterSecret: injectedMasterSecret ? `${injectedMasterSecret.substring(0, 8)}...` : '(empty)',
211
- hasFuzionXSocket: !!window.FuzionXSocket,
212
- });
213
-
214
- ws = new window.FuzionXSocket(url, masterSecret, aspEnabled);
203
+
204
+ ws = new window.FuzionXSocket(url, masterSecret, window.__FX_ENC_ENABLED__);
215
205
 
216
- ws.on('connect', () => { setStatus('connected', aspEnabled ? 'connected (ASP 🔐)' : 'connected'); });
206
+ ws.on('connect', () => { setStatus('connected', window.__FX_ENC_ENABLED__ ? 'connected (ASP 🔐)' : 'connected'); });
217
207
 
218
208
  ws.on('message', (raw) => { console.log('[Chat] raw:', JSON.stringify(raw)); });
219
209
 
@@ -91,17 +91,17 @@
91
91
  }
92
92
 
93
93
  switch (method) {
94
- case 'GET': return window._aspClient.get(url);
95
- case 'POST': return window._aspClient.post(url, bodyObj);
96
- case 'PUT': return window._aspClient.put(url, bodyObj);
97
- case 'PATCH': return window._aspClient.patch(url, bodyObj);
98
- case 'DELETE': return window._aspClient.delete(url);
99
- default: return window._aspClient.get(url);
94
+ case 'GET': return window._aspClient.get(url, window.__FX__ENC_ENABLED);
95
+ case 'POST': return window._aspClient.post(url, bodyObj, window.__FX__ENC_ENABLED);
96
+ case 'PUT': return window._aspClient.put(url, bodyObj, window.__FX__ENC_ENABLED);
97
+ case 'PATCH': return window._aspClient.patch(url, bodyObj, window.__FX__ENC_ENABLED);
98
+ case 'DELETE': return window._aspClient.delete(url, window.__FX__ENC_ENABLED);
99
+ default: return window._aspClient.get(url, window.__FX__ENC_ENABLED);
100
100
  }
101
101
  };
102
102
 
103
103
  // 글로벌 노출
104
104
  window.FxClient = { init, initPublic };
105
- window.aspEnabled = false;
105
+ window.aspEnabled = window.__FX__ENC_ENABLED;
106
106
  window._aspReady = Promise.resolve();
107
107
  })();
@@ -11,6 +11,9 @@
11
11
  <link rel="stylesheet" href="/public/css/landing.css">
12
12
  <link rel="stylesheet" href="/public/css/fx-ui.css">
13
13
  {% block head %}{% endblock %}
14
+ <script>
15
+ window.__FX__ENC_ENABLED = {{ config.bridge.asp.enabled | default(value=false) }} || {{ config.app.asp.enabled | default(value=false) }}
16
+ </script>
14
17
  </head>
15
18
  <body>
16
19
  <div class="orb orb-1"></div>
@@ -121,7 +121,7 @@ async function connectWS() {
121
121
  }
122
122
  }
123
123
 
124
- ws = new window.FuzionXSocket(url, '{{ config.bridge.asp.master_secret | default(value="") }}', {{ config.bridge.asp.enabled | default(value="false") }});
124
+ ws = new window.FuzionXSocket(url, '{{ config.bridge.asp.master_secret | default(value="") }}', {{ config.bridge.asp.enabled | default(value="false") }} || {{ config.app.asp.enabled | default(value="false") }});
125
125
 
126
126
  ws.on('connect', () => {
127
127
  setStatus('connected', window.aspEnabled ? 'connected (ASP 🔐)' : 'connected');