viagen 0.0.25 → 0.0.26
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,7 +79,7 @@ npx viagen sandbox stop <sandboxId>
|
|
|
79
79
|
viagen({
|
|
80
80
|
position: 'bottom-right', // toggle button position
|
|
81
81
|
model: 'sonnet', // claude model
|
|
82
|
-
panelWidth:
|
|
82
|
+
panelWidth: 375, // chat panel width in px
|
|
83
83
|
overlay: true, // fix button on error overlay
|
|
84
84
|
ui: true, // inject chat panel into pages
|
|
85
85
|
sandboxFiles: [...], // copy files manually into sandbox
|
package/dist/index.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ interface ViagenOptions {
|
|
|
64
64
|
position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
65
65
|
/** Claude model to use. Default: 'sonnet' */
|
|
66
66
|
model?: string;
|
|
67
|
-
/** Chat panel width in px. Default:
|
|
67
|
+
/** Chat panel width in px. Default: 375 */
|
|
68
68
|
panelWidth?: number;
|
|
69
69
|
/** Show "Fix This Error" button on Vite error overlay. Default: true */
|
|
70
70
|
overlay?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1121,6 +1121,9 @@ function buildUiHtml(opts) {
|
|
|
1121
1121
|
text-align: center;
|
|
1122
1122
|
margin-top: 40%;
|
|
1123
1123
|
}
|
|
1124
|
+
@media (max-width: 768px) {
|
|
1125
|
+
#popout-btn { display: none !important; }
|
|
1126
|
+
}
|
|
1124
1127
|
</style>
|
|
1125
1128
|
</head>
|
|
1126
1129
|
<body>
|
|
@@ -2181,18 +2184,6 @@ function parseCookies(header) {
|
|
|
2181
2184
|
}
|
|
2182
2185
|
function createAuthMiddleware(token) {
|
|
2183
2186
|
return function authMiddleware(req, res, next) {
|
|
2184
|
-
if (req.headers.cookie) {
|
|
2185
|
-
const cookies = parseCookies(req.headers.cookie);
|
|
2186
|
-
if (cookies["viagen_session"] === token) {
|
|
2187
|
-
next();
|
|
2188
|
-
return;
|
|
2189
|
-
}
|
|
2190
|
-
}
|
|
2191
|
-
const auth = req.headers.authorization;
|
|
2192
|
-
if (auth && auth === `Bearer ${token}`) {
|
|
2193
|
-
next();
|
|
2194
|
-
return;
|
|
2195
|
-
}
|
|
2196
2187
|
const url = new URL(req.url ?? "/", `http://${req.headers.host ?? "localhost"}`);
|
|
2197
2188
|
const pathMatch = url.pathname.match(/^(.*)\/t\/([^/]+)$/);
|
|
2198
2189
|
if (pathMatch && pathMatch[2] === token) {
|
|
@@ -2218,6 +2209,18 @@ function createAuthMiddleware(token) {
|
|
|
2218
2209
|
res.end();
|
|
2219
2210
|
return;
|
|
2220
2211
|
}
|
|
2212
|
+
if (req.headers.cookie) {
|
|
2213
|
+
const cookies = parseCookies(req.headers.cookie);
|
|
2214
|
+
if (cookies["viagen_session"] === token) {
|
|
2215
|
+
next();
|
|
2216
|
+
return;
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
const auth = req.headers.authorization;
|
|
2220
|
+
if (auth && auth === `Bearer ${token}`) {
|
|
2221
|
+
next();
|
|
2222
|
+
return;
|
|
2223
|
+
}
|
|
2221
2224
|
res.statusCode = 401;
|
|
2222
2225
|
res.setHeader("Content-Type", "application/json");
|
|
2223
2226
|
res.end(JSON.stringify({ error: "Unauthorized" }));
|
|
@@ -2808,7 +2811,7 @@ function viagen(options) {
|
|
|
2808
2811
|
const opts = {
|
|
2809
2812
|
position: options?.position ?? "bottom-right",
|
|
2810
2813
|
model: options?.model ?? "sonnet",
|
|
2811
|
-
panelWidth: options?.panelWidth ??
|
|
2814
|
+
panelWidth: options?.panelWidth ?? 375,
|
|
2812
2815
|
overlay: options?.overlay ?? true,
|
|
2813
2816
|
ui: options?.ui ?? true
|
|
2814
2817
|
};
|