prosicht 1.4.0 → 1.5.0
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/README.md +3 -1
- package/lib/publish.js +15 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,10 +30,12 @@ Sunum klasörlerinde `update` yalnızca çekirdek dosyaları (`index.html`, `css
|
|
|
30
30
|
```bash
|
|
31
31
|
npx prosicht publish
|
|
32
32
|
```
|
|
33
|
-
1. deck.prosicht.com'da hesap açın ve **Yeni
|
|
33
|
+
1. deck.prosicht.com'da hesap açın ve **Yeni ekle** ile, klasörünüzle aynı türü (**Sunum** ya da **Blog yazısı**) seçerek 32 karakterlik bir key alın.
|
|
34
34
|
2. Sunum veya blog klasöründe `npx prosicht publish` çalıştırın: **Sunum** / **Blog** (klasörden tespit edilip önceden seçilir) → adres (varsayılan `deck.prosicht.com`) → key.
|
|
35
35
|
3. Link terminalde verilir. Key ve adres isterseniz `.prosicht/publish.json` içine kaydedilir (git dışı); sonraki yayınlar sormaz.
|
|
36
36
|
|
|
37
|
+
Tür yüklemeyle birlikte gönderilir (`manifest.kind`); sunucu ayrıca dosyalardan da anlar (`js/post.js` → blog, `js/scenes.js` → sunum). Hiç yayınlanmamış bir kayıt yüklenen türü alır. Daha önce sunum olarak yayınlanmış bir kaydın keyiyle blog yayınlanamaz (ya da tersi): CLI bunu açıkça söyler; panelden doğru türde yeni bir kayıt açın.
|
|
38
|
+
|
|
37
39
|
Yalnızca `index.html`, `css/`, `js/` ve `assets/` yüklenir (en fazla 50 MB, dosya başına 25 MB, 500 dosya). `/` ile başlayan yollar için uyarı verilir. Kayıtlı key panelde yenilendiyse CLI yenisini sorar.
|
|
38
40
|
|
|
39
41
|
Seçenekler: `--key <key>`, `--host <url>`, `-y` (soruları atla; tür klasörden tespit edilir).
|
package/lib/publish.js
CHANGED
|
@@ -75,9 +75,10 @@ async function chooseKey(saved, flag) {
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
// Sunucu türü dosyalardan da anlar; kind yine de gönderilir (panelde rozet, MCP'de doğru kit)
|
|
79
|
+
async function upload(host, key, files, title, kind) {
|
|
79
80
|
const form = new FormData();
|
|
80
|
-
form.append('manifest', JSON.stringify({ title, files: files.map((f) => ({ path: f.path, size: f.size })) }));
|
|
81
|
+
form.append('manifest', JSON.stringify({ title, kind, files: files.map((f) => ({ path: f.path, size: f.size })) }));
|
|
81
82
|
for (const f of files) {
|
|
82
83
|
const type = MIME_TYPES[path.extname(f.path).toLowerCase()];
|
|
83
84
|
form.append('files', new Blob([fs.readFileSync(f.abs)], { type }), path.basename(f.path));
|
|
@@ -93,8 +94,18 @@ async function upload(host, key, files, title) {
|
|
|
93
94
|
return { status: response.status, body };
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
const NOUN = { presentation: 'sunum', blog: 'blog yazisi' };
|
|
98
|
+
const DATIVE = { presentation: 'sunuma', blog: 'blog yazisina' };
|
|
99
|
+
const PANEL_CHOICE = { presentation: 'Sunum', blog: 'Blog yazisi' };
|
|
100
|
+
|
|
96
101
|
function explain(status, body) {
|
|
97
102
|
if (status === 401) fail('Key gecersiz veya yenilenmis. Panelden guncel keyi alin.');
|
|
103
|
+
// key, daha önce başka türde yayınlanmış bir içeriğe ait
|
|
104
|
+
if (status === 409 && DATIVE[body.deckKind] && NOUN[body.kind]) {
|
|
105
|
+
fail(`Bu key bir ${DATIVE[body.deckKind]} ait; bu klasordeki icerik bir ${NOUN[body.kind]}.`, [
|
|
106
|
+
`Panelde "Yeni ekle" ile ${PANEL_CHOICE[body.kind]} secip yeni bir key alin ve --key ile verin.`
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
98
109
|
if (status === 413) fail('Dosyalar boyut sinirini asiyor (en fazla 50 MB).');
|
|
99
110
|
if (status === 400 || status === 422) fail(body.error || 'Dosyalar reddedildi.', body.details || []);
|
|
100
111
|
fail(`Sunucu hatasi (HTTP ${status})${body.error ? `: ${body.error}` : ''}`);
|
|
@@ -141,7 +152,7 @@ async function publish(options = {}) {
|
|
|
141
152
|
const send = async () => {
|
|
142
153
|
console.log(`\n[Pro Sicht] ${files.length} dosya (${formatBytes(total)}) yukleniyor...`);
|
|
143
154
|
try {
|
|
144
|
-
return await upload(host, key, files, title);
|
|
155
|
+
return await upload(host, key, files, title, kind);
|
|
145
156
|
} catch (error) {
|
|
146
157
|
return fail(`${host} adresine ulasilamadi: ${error.cause?.code || error.message}`);
|
|
147
158
|
}
|
|
@@ -157,7 +168,7 @@ async function publish(options = {}) {
|
|
|
157
168
|
if (result.status !== 200 || !result.body.url) explain(result.status, result.body);
|
|
158
169
|
|
|
159
170
|
const { url, privacy, version } = result.body;
|
|
160
|
-
console.log(`Yayinlandi (surum ${version}): ${url}`);
|
|
171
|
+
console.log(`Yayinlandi (${label}, surum ${version}): ${url}`);
|
|
161
172
|
if (privacy === 'private') {
|
|
162
173
|
console.log('Gizlilik: yalnizca siz gorebilirsiniz. Paylasmak icin panelden "Baglantiya sahip herkes" secin.');
|
|
163
174
|
} else {
|