Compare commits
4
Commits
005880eff3
...
1e75730353
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e75730353 | ||
|
|
71bfa19161 | ||
|
|
6669db0c61 | ||
|
|
95532d398e |
No files matched your search
@@ -20,7 +20,7 @@ import {
|
||||
listDeletedProjects, restoreFromHistory, readHistory, duplicateProject, genWorkshopId,
|
||||
} from './workshop-storage';
|
||||
import { searchDanawa } from '../../tools/danawa';
|
||||
import { renderStlPng, dropStlToFloor, convertAsciiStlToBinary } from '../../tools/stl-cad-core';
|
||||
import { renderStlPng, dropStlToFloor, convertAsciiStlToBinary, runOpenscad } from '../../tools/stl-cad-core';
|
||||
import { scanScadModules, unassignedParts } from './workshop-assembly';
|
||||
import { renderAssemblyManual, readManifest, resolveScadPath, currentAssemblyHash, assemblyOutDir, ASSEMBLY_DIR_NAME, draftAssembly } from '../../tools/workshop-assembly-render';
|
||||
import { clearHistory } from '../session';
|
||||
@@ -246,7 +246,7 @@ export function registerWorkshopRoutes(
|
||||
const projectId = String(req.query.projectId || '');
|
||||
const relPath = String(req.query.relPath || '');
|
||||
const segments = relPath.split('/').filter(Boolean);
|
||||
if (!/^[a-zA-Z0-9_-]+$/.test(projectId) || !segments.length || segments.some(s => s === '..' || s === '.') || !/\.stl$/i.test(relPath)) {
|
||||
if (!/^[a-zA-Z0-9_-]+$/.test(projectId) || !segments.length || segments.some(s => s === '..' || s === '.') || !/\.(stl|scad)$/i.test(relPath)) {
|
||||
return res.status(400).json({ error: 'invalid' });
|
||||
}
|
||||
const workspace = getUserWorkspace(session.username);
|
||||
@@ -255,7 +255,10 @@ export function registerWorkshopRoutes(
|
||||
if (!isPathInsideDir(dir, stlPath) || !fs.existsSync(stlPath)) return res.status(404).json({ error: 'not found' });
|
||||
const st = fs.statSync(stlPath);
|
||||
if (st.size > 40 * 1024 * 1024) return res.status(404).json({ error: 'too large' });
|
||||
const key = crypto.createHash('sha1').update(`${projectId}/${relPath}/${st.mtimeMs}/${st.size}`).digest('hex').slice(0, 24);
|
||||
const isScad = /\.scad$/i.test(relPath);
|
||||
// size=large → 클릭해서 여는 큰 미리보기(900px). 기본은 카드 썸네일(320px).
|
||||
const px = req.query.size === 'large' ? 900 : 320;
|
||||
const key = crypto.createHash('sha1').update(`${projectId}/${relPath}/${st.mtimeMs}/${st.size}/${px}`).digest('hex').slice(0, 24);
|
||||
const cacheDir = path.join(workspace, '.smallclaw', 'workshop-thumbs');
|
||||
const png = path.join(cacheDir, `${key}.png`);
|
||||
const failMark = `${png}.fail`;
|
||||
@@ -267,7 +270,12 @@ export function registerWorkshopRoutes(
|
||||
fs.mkdirSync(cacheDir, { recursive: true });
|
||||
const job = thumbQueue.then(async () => {
|
||||
if (fs.existsSync(png)) return true;
|
||||
const r = await renderStlPng(stlPath, 'iso', png, 320).catch(() => ({ ok: false as const, detail: 'exception' }));
|
||||
// .scad는 STL을 거치지 않고 OpenSCAD가 바로 렌더한다(use/include는 파일 위치 기준으로 풀린다).
|
||||
const r = isScad
|
||||
? await runOpenscad(['-o', png, `--imgsize=${px},${px}`, '--colorscheme=Tomorrow', '--autocenter', '--viewall', stlPath], 90_000)
|
||||
.then(x => (x.ok && fs.existsSync(png) && fs.statSync(png).size > 100 ? x : { ok: false as const, detail: x.ok ? 'empty' : x.detail }))
|
||||
.catch(() => ({ ok: false as const, detail: 'exception' }))
|
||||
: await renderStlPng(stlPath, 'iso', png, px).catch(() => ({ ok: false as const, detail: 'exception' }));
|
||||
if (!r.ok) { try { fs.writeFileSync(failMark, ''); } catch { /* noop */ } return false; }
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -174,11 +174,24 @@ export function readStlBBox(filePath: string): StlBBox {
|
||||
if (buf.length < 84) throw new Error('STL 파일이 너무 작거나 손상되었습니다.');
|
||||
const triangleCount = buf.readUInt32LE(80);
|
||||
const expectedSize = 84 + triangleCount * 50;
|
||||
if (buf.length !== expectedSize) {
|
||||
throw new Error('ASCII STL이거나 손상된 바이너리 STL로 보입니다 — 바이너리 STL만 지원합니다.');
|
||||
}
|
||||
const min: [number, number, number] = [Infinity, Infinity, Infinity];
|
||||
const max: [number, number, number] = [-Infinity, -Infinity, -Infinity];
|
||||
if (buf.length !== expectedSize) {
|
||||
// OpenSCAD 내보내기·스크립트가 쓴 ASCII STL — 썸네일/렌더는 바운딩박스만 있으면 되므로 텍스트로 읽는다.
|
||||
if (buf.subarray(0, 5).toString('latin1').toLowerCase() === 'solid') {
|
||||
const re = /vertex\s+(\S+)\s+(\S+)\s+(\S+)/g;
|
||||
const txt = buf.toString('latin1');
|
||||
let m: RegExpExecArray | null, nv = 0;
|
||||
while ((m = re.exec(txt)) !== null) {
|
||||
const v = [Number(m[1]), Number(m[2]), Number(m[3])];
|
||||
if (v.some(x => !Number.isFinite(x))) continue;
|
||||
nv++;
|
||||
for (let k = 0; k < 3; k++) { if (v[k] < min[k]) min[k] = v[k]; if (v[k] > max[k]) max[k] = v[k]; }
|
||||
}
|
||||
if (nv >= 3) return { min, max, triangleCount: Math.floor(nv / 3) };
|
||||
}
|
||||
throw new Error('손상된 STL로 보입니다 — 바이너리/ASCII STL로 읽을 수 없습니다.');
|
||||
}
|
||||
let offset = 84;
|
||||
for (let i = 0; i < triangleCount; i++) {
|
||||
offset += 12; // 법선벡터(3 floats) 스킵
|
||||
|
||||
@@ -181,6 +181,26 @@ const $=id=>document.getElementById(id);
|
||||
const esc=s=>String(s??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
||||
let ptypes=[], tsel=new Set(), lastInfo=null, shown=[], journals=[], sel=new Set(), offset=0, total=0, busy=false, pending=false, baseQ='', subs=[];
|
||||
|
||||
const ST_KEY='dj-state';
|
||||
let chatLog=[];
|
||||
function saveState(){
|
||||
try{ localStorage.setItem(ST_KEY,JSON.stringify({q:baseQ,subs,sort:$('sort').value,yr:$('yr').value,pinned,chat:chatLog.slice(-60)})); }catch(e){}
|
||||
}
|
||||
function loadState(){
|
||||
let st=null; try{ st=JSON.parse(localStorage.getItem(ST_KEY)||'null'); }catch(e){}
|
||||
if(!st||typeof st!=='object') return;
|
||||
baseQ=typeof st.q==='string'?st.q:''; $('q').value=baseQ;
|
||||
subs=Array.isArray(st.subs)?st.subs.filter(x=>typeof x==='string'):[]; renderSubs();
|
||||
if(st.sort==='date'||st.sort==='relevance') $('sort').value=st.sort;
|
||||
if(typeof st.yr==='string') $('yr').value=st.yr;
|
||||
if(Array.isArray(st.pinned)) pinned=st.pinned.filter(a=>a&&a.pmid);
|
||||
pinned.forEach(a=>{ if(!(a.pmid in absCache)) fetch('/api/dental-journals/abstract?pmid='+a.pmid,{credentials:'include',headers:authH()}).then(r=>r.json()).then(d=>{ absCache[a.pmid]=d.abstract||''; }).catch(()=>{}); });
|
||||
if(typeof renderPins==='function') renderPins();
|
||||
if(Array.isArray(st.chat)&&st.chat.length){
|
||||
chatLog=st.chat.filter(m=>m&&(m.k==='user'||m.k==='ai')&&typeof m.t==='string');
|
||||
$('msgs').innerHTML=''; chatLog.forEach(m=>addMsg(m.k,m.t,true));
|
||||
}
|
||||
}
|
||||
async function init(){
|
||||
loadBudget();
|
||||
try{
|
||||
@@ -198,6 +218,7 @@ async function init(){
|
||||
try{ localStorage.setItem('dj-known',JSON.stringify(ids)); }catch(e){}
|
||||
if(Array.isArray(saved)) saveSel();
|
||||
try{ const t=JSON.parse(localStorage.getItem('dj-types')||'[]'); if(Array.isArray(t)) tsel=new Set(t.filter(x=>ptypes.some(p=>p.id===x))); }catch(e){}
|
||||
loadState();
|
||||
renderChips(); renderTypes();
|
||||
doSearch(true);
|
||||
}
|
||||
@@ -240,6 +261,7 @@ function renderSubs(){
|
||||
|
||||
async function doSearch(reset){
|
||||
if(reset){ offset=0; total=0; shown=[]; $('results').innerHTML=''; $('more').style.display='none'; clsClearFilter(); if(typeof clsRefreshCounts==='function') clsRefreshCounts(); }
|
||||
saveState();
|
||||
if(!sel.size){ $('status').textContent='검색할 저널을 하나 이상 켜 주세요.'; return; }
|
||||
if(sel.has('pubmed') && !baseQ && !subs.length){ $('status').textContent='PubMed 전체는 검색어가 필요합니다. 검색어를 입력하거나 PubMed 카드를 꺼 주세요.'; return; }
|
||||
if(busy){ if(reset) pending=true; return; } busy=true;
|
||||
@@ -318,7 +340,7 @@ function findPaper(pmid){ return shown.find(x=>x.pmid===pmid)||pinned.find(x=>x.
|
||||
async function pinPaper(pmid){
|
||||
const a=findPaper(pmid); if(!a) return;
|
||||
if(!pinned.some(x=>x.pmid===pmid)){ if(pinned.length>=maxPins()) pinned.shift(); pinned.push(a); }
|
||||
renderPins();
|
||||
renderPins(); saveState();
|
||||
if(window.innerWidth<=1000 && !document.body.classList.contains('chat-open')) toggleChat();
|
||||
$('cin').focus();
|
||||
if(!(pmid in absCache)){
|
||||
@@ -326,7 +348,7 @@ async function pinPaper(pmid){
|
||||
catch(e){ absCache[pmid]=''; }
|
||||
}
|
||||
}
|
||||
function unpin(pmid){ pinned=pinned.filter(x=>x.pmid!==pmid); renderPins(); }
|
||||
function unpin(pmid){ pinned=pinned.filter(x=>x.pmid!==pmid); renderPins(); saveState(); }
|
||||
function renderPins(){
|
||||
if(typeof clsRefreshCounts==='function') clsRefreshCounts();
|
||||
const el=$('pins');
|
||||
@@ -607,15 +629,17 @@ function md(src){
|
||||
if(list) out.push(`</${list}>`);
|
||||
return out.join('');
|
||||
}
|
||||
function addMsg(kind,text){
|
||||
function addMsg(kind,text,restored){
|
||||
const d=document.createElement('div'); d.className='m '+kind;
|
||||
if(kind==='ai') d.innerHTML=md(text); else d.textContent=text;
|
||||
if(!restored&&(kind==='user')){ chatLog.push({k:'user',t:text}); saveState(); }
|
||||
$('msgs').appendChild(d); $('msgs').scrollTop=$('msgs').scrollHeight; return d;
|
||||
}
|
||||
async function newChat(){
|
||||
if(chatCtl) chatCtl.abort();
|
||||
try{ await fetch('/api/chat/sessions/'+encodeURIComponent(sid),{method:'DELETE',credentials:'include',headers:authH()}); }catch(e){}
|
||||
sid='dj_'+Math.random().toString(36).slice(2,12); try{ localStorage.setItem(SID_KEY,sid); }catch(e){}
|
||||
chatLog=[]; saveState();
|
||||
$('msgs').innerHTML='<div class="m hint">새 대화를 시작했습니다.</div>';
|
||||
}
|
||||
$('cin')&&$('cin').addEventListener('keydown',e=>{ if(e.key==='Enter'&&!e.shiftKey&&!e.isComposing){ e.preventDefault(); sendChat(); } });
|
||||
@@ -648,7 +672,7 @@ async function sendChat(){
|
||||
if(!buf) bubble.innerHTML='<span style="color:var(--muted)">(응답 없음)</span>';
|
||||
}catch(e){
|
||||
if(e.name!=='AbortError') bubble.innerHTML='<span style="color:var(--red)">오류: '+esc(e.message)+'</span>';
|
||||
}finally{ chatBusy=false; chatCtl=null; $('csend').disabled=false; }
|
||||
}finally{ if(buf){ chatLog.push({k:'ai',t:buf}); saveState(); } chatBusy=false; chatCtl=null; $('csend').disabled=false; }
|
||||
}
|
||||
loadModels();
|
||||
init();
|
||||
|
||||
+10
-5
@@ -67,24 +67,29 @@
|
||||
window.cameraClose = closeCamera;
|
||||
window.cameraIsOn = function () { return !!stream; };
|
||||
|
||||
function captureBlob() {
|
||||
// hiRes: 파일로 보관할 때(작업실 사진 폴더)는 채팅 입력용 다운스케일보다 크게·높은 화질로 찍는다
|
||||
function captureBlob(hiRes) {
|
||||
var video = $('camera-video');
|
||||
if (!stream || !video || !video.videoWidth) return Promise.resolve(null);
|
||||
var w = video.videoWidth, h = video.videoHeight;
|
||||
var scale = Math.min(1, MAX_SIDE / Math.max(w, h));
|
||||
var scale = Math.min(1, (hiRes ? 1920 : MAX_SIDE) / Math.max(w, h));
|
||||
var cw = Math.round(w * scale), ch = Math.round(h * scale);
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = cw; canvas.height = ch;
|
||||
canvas.getContext('2d').drawImage(video, 0, 0, cw, ch);
|
||||
return new Promise(function (resolve) { canvas.toBlob(resolve, 'image/jpeg', JPEG_QUALITY); });
|
||||
return new Promise(function (resolve) { canvas.toBlob(resolve, 'image/jpeg', hiRes ? 0.9 : JPEG_QUALITY); });
|
||||
}
|
||||
|
||||
window.cameraCaptureBlob = function () { return captureBlob(); };
|
||||
window.cameraCaptureBlob = function (hiRes) { return captureBlob(hiRes); };
|
||||
|
||||
// 현재 프레임을 서버에 올리고 채팅용 마크다운을 돌려준다. 실패하면 '' (메시지는 그대로 전송된다).
|
||||
// 페이지가 window.cameraFrameSaver(blob) → 이미지 마크다운('' 이면 실패)을 정의하면 그쪽에 맡긴다
|
||||
// (작업실: 프로젝트 사진 폴더에 바로 저장). 없으면 기존처럼 임시 업로드.
|
||||
async function uploadFrame() {
|
||||
var blob = await captureBlob();
|
||||
var saver = typeof window.cameraFrameSaver === 'function' ? window.cameraFrameSaver : null;
|
||||
var blob = await captureBlob(!!saver);
|
||||
if (!blob) return '';
|
||||
if (saver) return await saver(blob, CAMERA_ALT);
|
||||
var form = new FormData();
|
||||
form.append('image', blob, 'camera-' + Date.now() + '.jpg');
|
||||
var res = await fetch('/api/upload/image', { method: 'POST', headers: authHdr(), body: form });
|
||||
|
||||
@@ -267,12 +267,27 @@ function attachPhoto(relPath){
|
||||
autoResize(inp);inp.focus();
|
||||
document.getElementById('attach-pop').classList.remove('open');
|
||||
}
|
||||
// 채팅 중 찍힌 카메라 프레임(자동 첨부·📸 촬영)은 임시 업로드 대신 이 프로젝트의 사진/ 폴더에 바로 저장한다.
|
||||
// camera.js가 이 함수를 쓴다 — 돌려주는 마크다운의 /api/files/ 경로가 곧 프로젝트 폴더의 파일이다.
|
||||
window.cameraFrameSaver=async function(blob,alt){
|
||||
const proj=currentProject();
|
||||
if(!proj)return '';
|
||||
const d=new Date(),p2=n=>String(n).padStart(2,'0');
|
||||
const name='camera-'+d.getFullYear()+p2(d.getMonth()+1)+p2(d.getDate())+'-'+p2(d.getHours())+p2(d.getMinutes())+p2(d.getSeconds())+'.jpg';
|
||||
const fd=new FormData();fd.append('file',blob,name);
|
||||
const r=await fetch('/api/workshop/upload?projectId='+encodeURIComponent(proj.id)+'&folder='+encodeURIComponent('사진'),{method:'POST',headers:authH(),body:fd});
|
||||
const j=await r.json().catch(()=>({}));
|
||||
if(!r.ok||!j.url)throw new Error(j.error||'사진 저장 실패');
|
||||
const pane=document.getElementById('pane-files');
|
||||
if(pane&&pane.classList.contains('active'))loadFiles();
|
||||
return '';
|
||||
};
|
||||
// 카메라 현재 화면을 이 프로젝트의 사진 폴더에 저장하고 채팅에 첨부한다 (수동 촬영 = 기록용).
|
||||
async function saveCameraShot(){
|
||||
const proj=currentProject();
|
||||
const pop=document.getElementById('attach-pop');
|
||||
if(!proj)return;
|
||||
const blob=await window.cameraCaptureBlob();
|
||||
const blob=await window.cameraCaptureBlob(true);
|
||||
if(!blob){pop.innerHTML='<div class="rb-empty">카메라 화면을 아직 읽을 수 없습니다.</div>';return;}
|
||||
pop.innerHTML='<div class="rb-empty">저장 중…</div>';
|
||||
try{
|
||||
|
||||
@@ -108,25 +108,27 @@ function renderFiles(){
|
||||
}
|
||||
|
||||
const STL_RE=/\.stl$/i;
|
||||
const SCAD_RE=/\.scad$/i;
|
||||
function stlThumbFail(img){
|
||||
const sp=document.createElement('span');sp.className='rb-file-icon';sp.textContent='🔧';
|
||||
const sp=document.createElement('span');sp.className='rb-file-icon';sp.textContent=img.dataset.fb||'🔧';
|
||||
img.replaceWith(sp);
|
||||
}
|
||||
function renderFileCard(file){
|
||||
const isStl=STL_RE.test(file.name);
|
||||
const isGcode=/\.gcode$/i.test(file.name);
|
||||
const isScad=SCAD_RE.test(file.name);
|
||||
const icon=isStl?'🔧':(isGcode?'🖨️':(FILE_ICONS[file.category]||FILE_ICONS.other));
|
||||
const proj=currentProject();
|
||||
// STL은 서버가 OpenSCAD로 렌더한 썸네일(캐시)을 쓴다 — ASCII STL/큰 파일/렌더 실패는 404라
|
||||
// onerror로 기존 🔧 아이콘으로 되돌아간다.
|
||||
const thumb=file.category==='photo'
|
||||
? `<img src="${escAttr(file.url)}" alt="${escAttr(file.name)}" loading="lazy">`
|
||||
: (isStl&&proj)
|
||||
? `<img class="stl-thumb" src="/api/workshop/thumb?projectId=${encodeURIComponent(proj.id)}&relPath=${encodeURIComponent(file.relPath)}&v=${encodeURIComponent(file.mtime||'')}" alt="" loading="lazy" onerror="stlThumbFail(this)">`
|
||||
: ((isStl||isScad)&&proj)
|
||||
? `<img class="stl-thumb" data-fb="${isScad?'📄':'🔧'}" src="/api/workshop/thumb?projectId=${encodeURIComponent(proj.id)}&relPath=${encodeURIComponent(file.relPath)}&v=${encodeURIComponent(file.mtime||'')}" alt="" loading="lazy" onerror="stlThumbFail(this)">`
|
||||
: `<span class="rb-file-icon">${icon}</span>`;
|
||||
// STL은 새탭 다운로드 대신 Three.js CAD 편집기 팝업으로 연다(작업실↔K2 CAD 플러그인 연동).
|
||||
// G-code는 텍스트로 열어 봐야 알아볼 수 없다 — 슬라이서 미리보기 모드로 연다(툴패스·시간·K2 업로드). 원본은 ⬇ 링크로.
|
||||
const openAttrs=isStl?`href="javascript:void(0)" onclick="openCadEditorForFile('${escJs(file.relPath)}')"`
|
||||
const openAttrs=isScad?`href="javascript:void(0)" onclick="openScadPreview('${escJs(file.relPath)}')"`:isStl?`href="javascript:void(0)" onclick="openCadEditorForFile('${escJs(file.relPath)}')"`
|
||||
:isGcode?`href="javascript:void(0)" onclick="openSlicerForGcode('${escJs(file.relPath)}')"`
|
||||
:`href="${escAttr(file.url)}" target="_blank" rel="noopener"`;
|
||||
// STL만 슬라이서로 보낼 다중선택 체크박스(09-22) — 여러 부품 STL을 한 판에 얹어 같이 슬라이싱.
|
||||
@@ -134,21 +136,38 @@ function renderFileCard(file){
|
||||
const selBox=isStl?`<input type="checkbox" class="rb-file-stl-sel" title="슬라이서로 보내기 선택" ${checked?'checked':''} onclick="event.stopPropagation()" onchange="toggleStlSelect('${escJs(file.relPath)}',this.checked)">`:'';
|
||||
// STL 전용 도면 버튼(09-25) — OpenSCAD 3면도(외곽 치수선) 새 탭 생성.
|
||||
const dlLink=isGcode?`<a class="rb-file-draw" href="${escAttr(file.url)}" download="${escAttr(file.name)}" onclick="event.stopPropagation()" title="G-code 원본 다운로드">⬇</a>`:'';
|
||||
const srcBtn=isScad?`<a class="rb-file-draw" href="${escAttr(file.url)}" target="_blank" rel="noopener" onclick="event.stopPropagation()" title="소스 코드 보기"></></a>`:'';
|
||||
const drawBtn=isStl?`<button class="rb-file-draw" onclick="openDrawingForFile('${escJs(file.relPath)}')" title="3면도 도면 생성">📐</button>`:'';
|
||||
return `<div class="rb-file-card${checked?' stl-selected':''}" data-rel="${escAttr(file.relPath)}">
|
||||
${selBox}
|
||||
<button class="rb-file-del" onclick="deleteFile('${escJs(file.relPath)}')" title="삭제">✕</button>
|
||||
${drawBtn}${dlLink}
|
||||
${drawBtn}${dlLink}${srcBtn}
|
||||
<a ${openAttrs}>
|
||||
<div class="rb-file-thumb">${thumb}</div>
|
||||
<div class="rb-file-info">
|
||||
<div class="rb-file-name" title="${escAttr(file.name)}">${escAttr(file.name)}</div>
|
||||
<div class="rb-file-size">${fmtFileSize(file.size)}${isStl?' · CAD 편집기에서 열기':''}${isGcode?' · 슬라이서에서 미리보기':''}</div>
|
||||
<div class="rb-file-size">${fmtFileSize(file.size)}${isStl?' · CAD 편집기에서 열기':''}${isGcode?' · 슬라이서에서 미리보기':''}${isScad?' · 렌더 미리보기':''}</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
// .scad 클릭 — 큰 렌더 이미지를 새 탭에서 연다(렌더는 서버가 OpenSCAD로, 첫 렌더는 수 초). 소스는 </> 버튼.
|
||||
async function openScadPreview(relPath){
|
||||
const proj=currentProject();if(!proj)return;
|
||||
const url='/api/workshop/thumb?projectId='+encodeURIComponent(proj.id)+'&relPath='+encodeURIComponent(relPath)+'&size=large';
|
||||
const w=window.open('','_blank');
|
||||
try{
|
||||
const r=await fetch(url,{headers:authH()});
|
||||
if(!r.ok)throw new Error(r.status===404?'렌더에 실패했습니다(코드 오류이거나 너무 오래 걸림). </> 버튼으로 소스를 확인하세요.':'서버 오류 '+r.status);
|
||||
const blobUrl=URL.createObjectURL(await r.blob());
|
||||
if(w)w.location.href=blobUrl;else window.open(blobUrl,'_blank');
|
||||
}catch(e){
|
||||
if(w)w.close();
|
||||
alert('미리보기 실패: '+e.message);
|
||||
}
|
||||
}
|
||||
|
||||
// 작업실 프로젝트 relPath → 워크스페이스 전체 기준 상대경로. K2 CAD/슬라이서 라우트
|
||||
// (/api/cad/file, /api/cad/list 등)는 findStlFiles()로 워크스페이스 전체를 훑으므로
|
||||
// 이 접두어(workshop/<projectId>/)만 붙이면 작업실 파일도 그대로 잡힌다.
|
||||
|
||||
Reference in new issue
Block a user