@gallop.software/studio 2.3.73 → 2.3.75
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/dist/client/index.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
12
12
|
}
|
|
13
13
|
</style>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-Cf8-zcDF.js"></script>
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
17
17
|
<div id="root"></div>
|
package/dist/server/index.js
CHANGED
|
@@ -3903,6 +3903,24 @@ async function handleGenerateFavicon(request) {
|
|
|
3903
3903
|
// src/handlers/featured-image.ts
|
|
3904
3904
|
import puppeteer from "puppeteer";
|
|
3905
3905
|
import fs10 from "fs/promises";
|
|
3906
|
+
import sharp6 from "sharp";
|
|
3907
|
+
function parseEnvFile(content) {
|
|
3908
|
+
const result = {};
|
|
3909
|
+
for (const line of content.split("\n")) {
|
|
3910
|
+
const trimmed = line.trim();
|
|
3911
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
3912
|
+
const eqIndex = trimmed.indexOf("=");
|
|
3913
|
+
if (eqIndex > 0) {
|
|
3914
|
+
const key = trimmed.slice(0, eqIndex).trim();
|
|
3915
|
+
let value = trimmed.slice(eqIndex + 1).trim();
|
|
3916
|
+
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
3917
|
+
value = value.slice(1, -1);
|
|
3918
|
+
}
|
|
3919
|
+
result[key] = value;
|
|
3920
|
+
}
|
|
3921
|
+
}
|
|
3922
|
+
return result;
|
|
3923
|
+
}
|
|
3906
3924
|
async function handleGenerateFeaturedImage(request) {
|
|
3907
3925
|
const encoder = new TextEncoder();
|
|
3908
3926
|
let customUrl;
|
|
@@ -3935,7 +3953,7 @@ async function handleGenerateFeaturedImage(request) {
|
|
|
3935
3953
|
const relativePath = `public/${projectName}.jpg`;
|
|
3936
3954
|
sendEvent({
|
|
3937
3955
|
type: "start",
|
|
3938
|
-
total:
|
|
3956
|
+
total: 4,
|
|
3939
3957
|
projectName,
|
|
3940
3958
|
url: homepageUrl,
|
|
3941
3959
|
output: relativePath
|
|
@@ -3943,8 +3961,8 @@ async function handleGenerateFeaturedImage(request) {
|
|
|
3943
3961
|
sendEvent({
|
|
3944
3962
|
type: "progress",
|
|
3945
3963
|
current: 1,
|
|
3946
|
-
total:
|
|
3947
|
-
percent:
|
|
3964
|
+
total: 4,
|
|
3965
|
+
percent: 25,
|
|
3948
3966
|
message: "Launching browser..."
|
|
3949
3967
|
});
|
|
3950
3968
|
const browser = await puppeteer.launch({
|
|
@@ -3955,8 +3973,8 @@ async function handleGenerateFeaturedImage(request) {
|
|
|
3955
3973
|
sendEvent({
|
|
3956
3974
|
type: "progress",
|
|
3957
3975
|
current: 2,
|
|
3958
|
-
total:
|
|
3959
|
-
percent:
|
|
3976
|
+
total: 4,
|
|
3977
|
+
percent: 50,
|
|
3960
3978
|
message: `Navigating to ${homepageUrl}...`
|
|
3961
3979
|
});
|
|
3962
3980
|
const page = await browser.newPage();
|
|
@@ -3974,8 +3992,8 @@ async function handleGenerateFeaturedImage(request) {
|
|
|
3974
3992
|
sendEvent({
|
|
3975
3993
|
type: "progress",
|
|
3976
3994
|
current: 3,
|
|
3977
|
-
total:
|
|
3978
|
-
percent:
|
|
3995
|
+
total: 4,
|
|
3996
|
+
percent: 75,
|
|
3979
3997
|
message: "Taking screenshot..."
|
|
3980
3998
|
});
|
|
3981
3999
|
await page.screenshot({
|
|
@@ -3983,6 +4001,24 @@ async function handleGenerateFeaturedImage(request) {
|
|
|
3983
4001
|
type: "jpeg",
|
|
3984
4002
|
quality: 90
|
|
3985
4003
|
});
|
|
4004
|
+
sendEvent({
|
|
4005
|
+
type: "progress",
|
|
4006
|
+
current: 4,
|
|
4007
|
+
total: 4,
|
|
4008
|
+
percent: 95,
|
|
4009
|
+
message: "Updating metadata..."
|
|
4010
|
+
});
|
|
4011
|
+
const imageBuffer = await fs10.readFile(outputPath);
|
|
4012
|
+
const metadata = await sharp6(imageBuffer).metadata();
|
|
4013
|
+
const width = metadata.width || 0;
|
|
4014
|
+
const height = metadata.height || 0;
|
|
4015
|
+
const meta = await loadMeta();
|
|
4016
|
+
const metaKey = `/${projectName}.jpg`;
|
|
4017
|
+
setMetaEntry(meta, metaKey, {
|
|
4018
|
+
o: { w: width, h: height },
|
|
4019
|
+
f: { w: width, h: height }
|
|
4020
|
+
});
|
|
4021
|
+
await saveMeta(meta);
|
|
3986
4022
|
sendEvent({
|
|
3987
4023
|
type: "complete",
|
|
3988
4024
|
processed: 1,
|
|
@@ -4016,20 +4052,33 @@ async function handleGenerateFeaturedImage(request) {
|
|
|
4016
4052
|
async function handleGetFeaturedImageOptions() {
|
|
4017
4053
|
try {
|
|
4018
4054
|
const packageJsonPath2 = getWorkspacePath("package.json");
|
|
4055
|
+
const envLocalPath = getWorkspacePath(".env.local");
|
|
4056
|
+
const envProductionPath = getWorkspacePath(".env.production");
|
|
4019
4057
|
let projectName = "featured-image";
|
|
4020
|
-
let
|
|
4021
|
-
|
|
4058
|
+
let devUrl = null;
|
|
4059
|
+
let productionUrl = null;
|
|
4022
4060
|
try {
|
|
4023
4061
|
const packageJsonContent = await fs10.readFile(packageJsonPath2, "utf8");
|
|
4024
4062
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
4025
4063
|
projectName = packageJson2.name || "featured-image";
|
|
4026
|
-
|
|
4064
|
+
} catch {
|
|
4065
|
+
}
|
|
4066
|
+
try {
|
|
4067
|
+
const envLocalContent = await fs10.readFile(envLocalPath, "utf8");
|
|
4068
|
+
const envLocal = parseEnvFile(envLocalContent);
|
|
4069
|
+
devUrl = envLocal.NEXT_PUBLIC_PRODUCTION_URL || null;
|
|
4070
|
+
} catch {
|
|
4071
|
+
}
|
|
4072
|
+
try {
|
|
4073
|
+
const envProductionContent = await fs10.readFile(envProductionPath, "utf8");
|
|
4074
|
+
const envProduction = parseEnvFile(envProductionContent);
|
|
4075
|
+
productionUrl = envProduction.NEXT_PUBLIC_PRODUCTION_URL || null;
|
|
4027
4076
|
} catch {
|
|
4028
4077
|
}
|
|
4029
4078
|
return jsonResponse({
|
|
4030
4079
|
projectName,
|
|
4031
4080
|
devUrl,
|
|
4032
|
-
|
|
4081
|
+
productionUrl
|
|
4033
4082
|
});
|
|
4034
4083
|
} catch (error) {
|
|
4035
4084
|
console.error("Get featured image options error:", error);
|
|
@@ -4110,9 +4159,12 @@ async function startServer(options) {
|
|
|
4110
4159
|
}
|
|
4111
4160
|
const app = express();
|
|
4112
4161
|
process.env.STUDIO_WORKSPACE = workspace;
|
|
4113
|
-
const
|
|
4114
|
-
if (existsSync(
|
|
4115
|
-
loadEnv({ path:
|
|
4162
|
+
const envLocalPath = join(workspace, ".env.local");
|
|
4163
|
+
if (existsSync(envLocalPath)) {
|
|
4164
|
+
loadEnv({ path: envLocalPath, quiet: true });
|
|
4165
|
+
}
|
|
4166
|
+
if (!process.env.STUDIO_DEV_SITE_URL && process.env.NEXT_PUBLIC_PRODUCTION_URL) {
|
|
4167
|
+
process.env.STUDIO_DEV_SITE_URL = process.env.NEXT_PUBLIC_PRODUCTION_URL;
|
|
4116
4168
|
}
|
|
4117
4169
|
app.use((req, res, next) => {
|
|
4118
4170
|
if (req.path === "/api/studio/upload") {
|