@gallop.software/studio 2.3.73 → 2.3.74

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.
@@ -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-CrSFA6TY.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-C8syz-vT.js"></script>
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
@@ -3903,6 +3903,23 @@ 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
+ function parseEnvFile(content) {
3907
+ const result = {};
3908
+ for (const line of content.split("\n")) {
3909
+ const trimmed = line.trim();
3910
+ if (!trimmed || trimmed.startsWith("#")) continue;
3911
+ const eqIndex = trimmed.indexOf("=");
3912
+ if (eqIndex > 0) {
3913
+ const key = trimmed.slice(0, eqIndex).trim();
3914
+ let value = trimmed.slice(eqIndex + 1).trim();
3915
+ if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
3916
+ value = value.slice(1, -1);
3917
+ }
3918
+ result[key] = value;
3919
+ }
3920
+ }
3921
+ return result;
3922
+ }
3906
3923
  async function handleGenerateFeaturedImage(request) {
3907
3924
  const encoder = new TextEncoder();
3908
3925
  let customUrl;
@@ -4016,20 +4033,33 @@ async function handleGenerateFeaturedImage(request) {
4016
4033
  async function handleGetFeaturedImageOptions() {
4017
4034
  try {
4018
4035
  const packageJsonPath2 = getWorkspacePath("package.json");
4036
+ const envLocalPath = getWorkspacePath(".env.local");
4037
+ const envProductionPath = getWorkspacePath(".env.production");
4019
4038
  let projectName = "featured-image";
4020
- let homepageUrl = null;
4021
- const devUrl = process.env.STUDIO_DEV_SITE_URL || null;
4039
+ let devUrl = null;
4040
+ let productionUrl = null;
4022
4041
  try {
4023
4042
  const packageJsonContent = await fs10.readFile(packageJsonPath2, "utf8");
4024
4043
  const packageJson2 = JSON.parse(packageJsonContent);
4025
4044
  projectName = packageJson2.name || "featured-image";
4026
- homepageUrl = packageJson2.homepage || null;
4045
+ } catch {
4046
+ }
4047
+ try {
4048
+ const envLocalContent = await fs10.readFile(envLocalPath, "utf8");
4049
+ const envLocal = parseEnvFile(envLocalContent);
4050
+ devUrl = envLocal.NEXT_PUBLIC_PRODUCTION_URL || null;
4051
+ } catch {
4052
+ }
4053
+ try {
4054
+ const envProductionContent = await fs10.readFile(envProductionPath, "utf8");
4055
+ const envProduction = parseEnvFile(envProductionContent);
4056
+ productionUrl = envProduction.NEXT_PUBLIC_PRODUCTION_URL || null;
4027
4057
  } catch {
4028
4058
  }
4029
4059
  return jsonResponse({
4030
4060
  projectName,
4031
4061
  devUrl,
4032
- homepageUrl
4062
+ productionUrl
4033
4063
  });
4034
4064
  } catch (error) {
4035
4065
  console.error("Get featured image options error:", error);
@@ -4110,9 +4140,12 @@ async function startServer(options) {
4110
4140
  }
4111
4141
  const app = express();
4112
4142
  process.env.STUDIO_WORKSPACE = workspace;
4113
- const envStudioPath = join(workspace, ".env.studio");
4114
- if (existsSync(envStudioPath)) {
4115
- loadEnv({ path: envStudioPath, quiet: true });
4143
+ const envLocalPath = join(workspace, ".env.local");
4144
+ if (existsSync(envLocalPath)) {
4145
+ loadEnv({ path: envLocalPath, quiet: true });
4146
+ }
4147
+ if (!process.env.STUDIO_DEV_SITE_URL && process.env.NEXT_PUBLIC_PRODUCTION_URL) {
4148
+ process.env.STUDIO_DEV_SITE_URL = process.env.NEXT_PUBLIC_PRODUCTION_URL;
4116
4149
  }
4117
4150
  app.use((req, res, next) => {
4118
4151
  if (req.path === "/api/studio/upload") {