pinme 2.0.0-beta.5 → 2.0.0-beta.7

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.
Files changed (3) hide show
  1. package/README.md +14 -14
  2. package/dist/index.js +81 -185
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <a href="https://pinme.eth.limo/">
2
+ <a href="https://pinme.dev/">
3
3
  <img src="https://2egc5b44.pinit.eth.limo/" height="92">
4
4
  <h3 align="center">PinMe</h3>
5
5
  </a>
@@ -13,7 +13,7 @@
13
13
 
14
14
  # PinMe
15
15
 
16
- [PinMe](https://pinme.eth.limo/) is a zero-config frontend deployment tool.
16
+ [PinMe](https://pinme.dev/) is a zero-config frontend deployment tool.
17
17
  No servers. No accounts. No setup.
18
18
 
19
19
  Build a static site, generate a page with AI, export your frontend, or import CAR files — then deploy instantly with a single command.
@@ -23,7 +23,7 @@ PinMe publishes your site as verifiable content, making silent tampering and acc
23
23
  You don’t manage servers, regions, or uptime.
24
24
  PinMe handles availability and persistence for you.
25
25
 
26
- Website: [https://pinme.eth.limo/](https://pinme.eth.limo/)
26
+ Website: [https://pinme.dev/](https://pinme.dev/)
27
27
 
28
28
  ---
29
29
 
@@ -79,7 +79,7 @@ pinme upload dist
79
79
  pinme upload build
80
80
  ```
81
81
 
82
- That's it! You'll get a preview URL like `https://pinme.eth.limo/#/preview/*`
82
+ That's it! You'll get a preview URL like `https://pinme.dev/#/preview/*`
83
83
 
84
84
  ---
85
85
 
@@ -130,7 +130,7 @@ This section provides AI-specific instructions for deploying websites using PinM
130
130
  ```
131
131
 
132
132
  6. **Return Result**
133
- - Only return final preview page URL: `https://pinme.eth.limo/#/preview/*`
133
+ - Only return final preview page URL: `https://pinme.dev/#/preview/*`
134
134
  - Do not output additional logs or intermediate steps
135
135
 
136
136
  #### Prohibited Operations
@@ -161,7 +161,7 @@ For easy AI tool parsing:
161
161
  "total_directory": "1GB"
162
162
  },
163
163
  "output": "preview_url",
164
- "preview_url_format": "https://pinme.eth.limo/#/preview/*",
164
+ "preview_url_format": "https://pinme.dev/#/preview/*",
165
165
  "fixed_domain_format": "https://*.pinit.eth.limo",
166
166
  "other_commands": {
167
167
  "version": "pinme --version",
@@ -188,7 +188,7 @@ For easy AI tool parsing:
188
188
  > 2. Check if pinme is installed, install if not
189
189
  > 3. Identify the static file directory for the website to deploy
190
190
  > 4. Execute deployment command
191
- > 5. Return preview page link: `https://pinme.eth.limo/#/preview/*`
191
+ > 5. Return preview page link: `https://pinme.dev/#/preview/*`
192
192
 
193
193
  ---
194
194
 
@@ -409,7 +409,7 @@ pinme bind ./dist --domain my-site --dns
409
409
  - DNS domain: `https://<your-domain>`
410
410
 
411
411
  **DNS Setup:**
412
- After successful DNS domain binding, visit the [DNS Configuration Guide](https://pinme.eth.limo/#/docs?id=custom-domain) to complete DNS setup.
412
+ After successful DNS domain binding, visit the [DNS Configuration Guide](https://pinme.dev/#/docs?id=custom-domain) to complete DNS setup.
413
413
 
414
414
  ### `upload`
415
415
 
@@ -535,7 +535,7 @@ Set AppKey for authentication and automatically merge anonymous upload history t
535
535
  pinme set-appkey [AppKey]
536
536
  ```
537
537
 
538
- **Note:** Fixed domain binding requires AppKey and Plus membership. Get your AppKey from [PinMe website](https://pinme.eth.limo/).
538
+ **Note:** Fixed domain binding requires AppKey and Plus membership. Get your AppKey from [PinMe website](https://pinme.dev/).
539
539
 
540
540
  ### `show-appkey` / `appkey`
541
541
 
@@ -574,7 +574,7 @@ Domain binding (both Pinme subdomains and custom DNS domains) requires VIP membe
574
574
  **Before using domain binding:**
575
575
 
576
576
  1. **Upgrade to VIP**
577
- - Visit [PinMe website](https://pinme.eth.limo/) to upgrade
577
+ - Visit [PinMe website](https://pinme.dev/) to upgrade
578
578
 
579
579
  2. **Set AppKey**
580
580
  ```bash
@@ -592,7 +592,7 @@ Domain binding (both Pinme subdomains and custom DNS domains) requires VIP membe
592
592
 
593
593
  ### Checking VIP Status
594
594
 
595
- If you attempt to bind a domain without VIP, you'll see an error message. You can check your VIP status on the [PinMe website](https://pinme.eth.limo/).
595
+ If you attempt to bind a domain without VIP, you'll see an error message. You can check your VIP status on the [PinMe website](https://pinme.dev/).
596
596
 
597
597
  ---
598
598
 
@@ -649,7 +649,7 @@ Uploaded files are stored on the IPFS network and accessible through the Glitter
649
649
 
650
650
  **After successful upload, you receive:**
651
651
  1. IPFS content hash
652
- 2. Preview page URL: `https://pinme.eth.limo/#/preview/*`
652
+ 2. Preview page URL: `https://pinme.dev/#/preview/*`
653
653
  3. Fixed domain option: `https://*.pinit.eth.limo`
654
654
 
655
655
  ### Log Locations
@@ -662,7 +662,7 @@ Uploaded files are stored on the IPFS network and accessible through the Glitter
662
662
  ## PinMe Platform Features
663
663
 
664
664
  ### Preview Page
665
- - Access uploaded website via preview link: `https://pinme.eth.limo/#/preview/*`
665
+ - Access uploaded website via preview link: `https://pinme.dev/#/preview/*`
666
666
  - Get fixed domain: `https://*.pinit.eth.limo`
667
667
 
668
668
  ### Login and Management
@@ -832,7 +832,7 @@ If you have questions or suggestions, please contact us through:
832
832
 
833
833
  - GitHub Issues: [https://github.com/glitternetwork/pinme/issues](https://github.com/glitternetwork/pinme/issues)
834
834
  - Email: [pinme@glitterprotocol.io](mailto:pinme@glitterprotocol.io)
835
- - Website: [https://pinme.eth.limo/](https://pinme.eth.limo/)
835
+ - Website: [https://pinme.dev/](https://pinme.dev/)
836
836
 
837
837
  ---
838
838
 
package/dist/index.js CHANGED
@@ -96,8 +96,8 @@ var require_package = __commonJS({
96
96
  // node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/lib/main.js
97
97
  var require_main = __commonJS({
98
98
  "node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/lib/main.js"(exports2, module2) {
99
- var fs17 = require("fs");
100
- var path18 = require("path");
99
+ var fs16 = require("fs");
100
+ var path17 = require("path");
101
101
  var os5 = require("os");
102
102
  var crypto3 = require("crypto");
103
103
  var packageJson = require_package();
@@ -200,7 +200,7 @@ var require_main = __commonJS({
200
200
  if (options && options.path && options.path.length > 0) {
201
201
  if (Array.isArray(options.path)) {
202
202
  for (const filepath of options.path) {
203
- if (fs17.existsSync(filepath)) {
203
+ if (fs16.existsSync(filepath)) {
204
204
  possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
205
205
  }
206
206
  }
@@ -208,15 +208,15 @@ var require_main = __commonJS({
208
208
  possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
209
209
  }
210
210
  } else {
211
- possibleVaultPath = path18.resolve(process.cwd(), ".env.vault");
211
+ possibleVaultPath = path17.resolve(process.cwd(), ".env.vault");
212
212
  }
213
- if (fs17.existsSync(possibleVaultPath)) {
213
+ if (fs16.existsSync(possibleVaultPath)) {
214
214
  return possibleVaultPath;
215
215
  }
216
216
  return null;
217
217
  }
218
218
  function _resolveHome(envPath) {
219
- return envPath[0] === "~" ? path18.join(os5.homedir(), envPath.slice(1)) : envPath;
219
+ return envPath[0] === "~" ? path17.join(os5.homedir(), envPath.slice(1)) : envPath;
220
220
  }
221
221
  function _configVault(options) {
222
222
  const debug = Boolean(options && options.debug);
@@ -232,7 +232,7 @@ var require_main = __commonJS({
232
232
  return { parsed };
233
233
  }
234
234
  function configDotenv(options) {
235
- const dotenvPath = path18.resolve(process.cwd(), ".env");
235
+ const dotenvPath = path17.resolve(process.cwd(), ".env");
236
236
  let encoding = "utf8";
237
237
  const debug = Boolean(options && options.debug);
238
238
  if (options && options.encoding) {
@@ -255,13 +255,13 @@ var require_main = __commonJS({
255
255
  }
256
256
  let lastError;
257
257
  const parsedAll = {};
258
- for (const path19 of optionPaths) {
258
+ for (const path18 of optionPaths) {
259
259
  try {
260
- const parsed = DotenvModule.parse(fs17.readFileSync(path19, { encoding }));
260
+ const parsed = DotenvModule.parse(fs16.readFileSync(path18, { encoding }));
261
261
  DotenvModule.populate(parsedAll, parsed, options);
262
262
  } catch (e) {
263
263
  if (debug) {
264
- _debug(`Failed to load ${path19} ${e.message}`);
264
+ _debug(`Failed to load ${path18} ${e.message}`);
265
265
  }
266
266
  lastError = e;
267
267
  }
@@ -1519,11 +1519,11 @@ function checkNodeVersion() {
1519
1519
 
1520
1520
  // bin/index.ts
1521
1521
  var import_commander = require("commander");
1522
- var import_chalk23 = __toESM(require("chalk"));
1522
+ var import_chalk22 = __toESM(require("chalk"));
1523
1523
  var import_figlet5 = __toESM(require("figlet"));
1524
1524
 
1525
1525
  // package.json
1526
- var version = "2.0.0-beta.5";
1526
+ var version = "2.0.0-beta.7";
1527
1527
 
1528
1528
  // bin/upload.ts
1529
1529
  var import_path7 = __toESM(require("path"));
@@ -1968,9 +1968,9 @@ function isVisitable(thing) {
1968
1968
  function removeBrackets(key) {
1969
1969
  return utils_default.endsWith(key, "[]") ? key.slice(0, -2) : key;
1970
1970
  }
1971
- function renderKey(path18, key, dots) {
1972
- if (!path18) return key;
1973
- return path18.concat(key).map(function each(token, i) {
1971
+ function renderKey(path17, key, dots) {
1972
+ if (!path17) return key;
1973
+ return path17.concat(key).map(function each(token, i) {
1974
1974
  token = removeBrackets(token);
1975
1975
  return !dots && i ? "[" + token + "]" : token;
1976
1976
  }).join(dots ? "." : "");
@@ -2015,9 +2015,9 @@ function toFormData(obj, formData, options) {
2015
2015
  }
2016
2016
  return value;
2017
2017
  }
2018
- function defaultVisitor(value, key, path18) {
2018
+ function defaultVisitor(value, key, path17) {
2019
2019
  let arr = value;
2020
- if (value && !path18 && typeof value === "object") {
2020
+ if (value && !path17 && typeof value === "object") {
2021
2021
  if (utils_default.endsWith(key, "{}")) {
2022
2022
  key = metaTokens ? key : key.slice(0, -2);
2023
2023
  value = JSON.stringify(value);
@@ -2036,7 +2036,7 @@ function toFormData(obj, formData, options) {
2036
2036
  if (isVisitable(value)) {
2037
2037
  return true;
2038
2038
  }
2039
- formData.append(renderKey(path18, key, dots), convertValue(value));
2039
+ formData.append(renderKey(path17, key, dots), convertValue(value));
2040
2040
  return false;
2041
2041
  }
2042
2042
  const stack = [];
@@ -2045,10 +2045,10 @@ function toFormData(obj, formData, options) {
2045
2045
  convertValue,
2046
2046
  isVisitable
2047
2047
  });
2048
- function build(value, path18) {
2048
+ function build(value, path17) {
2049
2049
  if (utils_default.isUndefined(value)) return;
2050
2050
  if (stack.indexOf(value) !== -1) {
2051
- throw Error("Circular reference detected in " + path18.join("."));
2051
+ throw Error("Circular reference detected in " + path17.join("."));
2052
2052
  }
2053
2053
  stack.push(value);
2054
2054
  utils_default.forEach(value, function each(el, key) {
@@ -2056,11 +2056,11 @@ function toFormData(obj, formData, options) {
2056
2056
  formData,
2057
2057
  el,
2058
2058
  utils_default.isString(key) ? key.trim() : key,
2059
- path18,
2059
+ path17,
2060
2060
  exposedHelpers
2061
2061
  );
2062
2062
  if (result === true) {
2063
- build(el, path18 ? path18.concat(key) : [key]);
2063
+ build(el, path17 ? path17.concat(key) : [key]);
2064
2064
  }
2065
2065
  });
2066
2066
  stack.pop();
@@ -2221,7 +2221,7 @@ var node_default = {
2221
2221
  // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/toURLEncodedForm.js
2222
2222
  function toURLEncodedForm(data, options) {
2223
2223
  return toFormData_default(data, new node_default.classes.URLSearchParams(), Object.assign({
2224
- visitor: function(value, key, path18, helpers) {
2224
+ visitor: function(value, key, path17, helpers) {
2225
2225
  if (node_default.isNode && utils_default.isBuffer(value)) {
2226
2226
  this.append(key, value.toString("base64"));
2227
2227
  return false;
@@ -2250,10 +2250,10 @@ function arrayToObject(arr) {
2250
2250
  return obj;
2251
2251
  }
2252
2252
  function formDataToJSON(formData) {
2253
- function buildPath(path18, value, target, index) {
2254
- let name = path18[index++];
2253
+ function buildPath(path17, value, target, index) {
2254
+ let name = path17[index++];
2255
2255
  const isNumericKey = Number.isFinite(+name);
2256
- const isLast = index >= path18.length;
2256
+ const isLast = index >= path17.length;
2257
2257
  name = !name && utils_default.isArray(target) ? target.length : name;
2258
2258
  if (isLast) {
2259
2259
  if (utils_default.hasOwnProp(target, name)) {
@@ -2266,7 +2266,7 @@ function formDataToJSON(formData) {
2266
2266
  if (!target[name] || !utils_default.isObject(target[name])) {
2267
2267
  target[name] = [];
2268
2268
  }
2269
- const result = buildPath(path18, value, target[name], index);
2269
+ const result = buildPath(path17, value, target[name], index);
2270
2270
  if (result && utils_default.isArray(target[name])) {
2271
2271
  target[name] = arrayToObject(target[name]);
2272
2272
  }
@@ -3328,9 +3328,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
3328
3328
  auth = urlUsername + ":" + urlPassword;
3329
3329
  }
3330
3330
  auth && headers.delete("authorization");
3331
- let path18;
3331
+ let path17;
3332
3332
  try {
3333
- path18 = buildURL(
3333
+ path17 = buildURL(
3334
3334
  parsed.pathname + parsed.search,
3335
3335
  config.params,
3336
3336
  config.paramsSerializer
@@ -3348,7 +3348,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
3348
3348
  false
3349
3349
  );
3350
3350
  const options = {
3351
- path: path18,
3351
+ path: path17,
3352
3352
  method,
3353
3353
  headers: headers.toJSON(),
3354
3354
  agents: { http: config.httpAgent, https: config.httpsAgent },
@@ -3567,14 +3567,14 @@ var cookies_default = node_default.isStandardBrowserEnv ? (
3567
3567
  // Standard browser envs support document.cookie
3568
3568
  /* @__PURE__ */ function standardBrowserEnv() {
3569
3569
  return {
3570
- write: function write(name, value, expires, path18, domain, secure) {
3570
+ write: function write(name, value, expires, path17, domain, secure) {
3571
3571
  const cookie = [];
3572
3572
  cookie.push(name + "=" + encodeURIComponent(value));
3573
3573
  if (utils_default.isNumber(expires)) {
3574
3574
  cookie.push("expires=" + new Date(expires).toGMTString());
3575
3575
  }
3576
- if (utils_default.isString(path18)) {
3577
- cookie.push("path=" + path18);
3576
+ if (utils_default.isString(path17)) {
3577
+ cookie.push("path=" + path17);
3578
3578
  }
3579
3579
  if (utils_default.isString(domain)) {
3580
3580
  cookie.push("domain=" + domain);
@@ -5957,7 +5957,7 @@ async function bindDomain(domain, contentHash, isDns, authConfig) {
5957
5957
  }
5958
5958
  console.log(import_chalk5.default.green(`DNS bind success: ${displayDomain}`));
5959
5959
  console.log(import_chalk5.default.white(`Visit: https://${displayDomain}`));
5960
- console.log(import_chalk5.default.cyan("\n\u{1F4DA} DNS Setup Guide: https://pinme.eth.limo/#/docs?id=custom-domain"));
5960
+ console.log(import_chalk5.default.cyan("\n\u{1F4DA} DNS Setup Guide: https://pinme.dev/#/docs?id=custom-domain"));
5961
5961
  } else {
5962
5962
  console.log(import_chalk5.default.blue("Binding Pinme subdomain..."));
5963
5963
  const ok = await bindPinmeDomain(displayDomain, contentHash);
@@ -7039,7 +7039,7 @@ async function bindCmd() {
7039
7039
  }
7040
7040
  console.log(import_chalk14.default.green(`DNS bind success: ${displayDomain}`));
7041
7041
  console.log(import_chalk14.default.white(`Visit: https://${displayDomain}`));
7042
- console.log(import_chalk14.default.cyan("\n\u{1F4DA} DNS Setup Guide: https://pinme.eth.limo/#/docs?id=custom-domain"));
7042
+ console.log(import_chalk14.default.cyan("\n\u{1F4DA} DNS Setup Guide: https://pinme.dev/#/docs?id=custom-domain"));
7043
7043
  } else {
7044
7044
  console.log(import_chalk14.default.blue("Binding Pinme subdomain..."));
7045
7045
  const ok = await bindPinmeDomain(displayDomain, up.contentHash);
@@ -7066,7 +7066,7 @@ var import_chalk15 = __toESM(require("chalk"));
7066
7066
  var ENV_URLS = {
7067
7067
  dev: "http://localhost:5173",
7068
7068
  test: "http://test-pinme.pinit.eth.limo",
7069
- prod: "https://pinme.eth.limo"
7069
+ prod: "https://pinme.dev"
7070
7070
  };
7071
7071
  async function loginCmd(options = {}) {
7072
7072
  try {
@@ -7110,10 +7110,10 @@ var import_fs_extra6 = __toESM(require("fs-extra"));
7110
7110
  var import_path11 = __toESM(require("path"));
7111
7111
  var import_inquirer8 = __toESM(require("inquirer"));
7112
7112
  var import_child_process2 = require("child_process");
7113
- var TEMPLATE_DIR = import_path11.default.join(__dirname, "../template");
7114
7113
  var PROJECT_DIR = process.cwd();
7115
7114
  var API_BASE = "https://pinme.dev/api/v4";
7116
- var TEMPLATE_REPO = "https://github.com/glitternetwork/pinme-worker-template.git";
7115
+ var TEMPLATE_REPO = "glitternetwork/pinme-worker-template";
7116
+ var TEMPLATE_ZIP_URL = `https://github.com/${TEMPLATE_REPO}/archive/refs/heads/main.zip`;
7117
7117
  async function createCmd(options) {
7118
7118
  var _a, _b, _c, _d, _e, _f;
7119
7119
  try {
@@ -7189,19 +7189,42 @@ Directory "${projectName}" already exists.`));
7189
7189
  const errorMsg = ((_d = (_c = (_b = error.response) == null ? void 0 : _b.data) == null ? void 0 : _c.data) == null ? void 0 : _d.error) || ((_f = (_e = error.response) == null ? void 0 : _e.data) == null ? void 0 : _f.msg) || error.message || "Failed to create worker";
7190
7190
  throw new Error(errorMsg);
7191
7191
  }
7192
- console.log(import_chalk16.default.blue("\n2. Cloning template from repository..."));
7192
+ console.log(import_chalk16.default.blue("\n2. Downloading template from repository..."));
7193
+ const zipPath = import_path11.default.join(PROJECT_DIR, "template.zip");
7194
+ let downloadSuccess = false;
7195
+ for (let attempt = 1; attempt <= 3 && !downloadSuccess; attempt++) {
7196
+ try {
7197
+ console.log(import_chalk16.default.gray(` Download attempt ${attempt}/3...`));
7198
+ (0, import_child_process2.execSync)(`curl -L --retry 3 --retry-delay 2 -o "${zipPath}" "${TEMPLATE_ZIP_URL}"`, {
7199
+ stdio: "inherit"
7200
+ });
7201
+ if (!import_fs_extra6.default.existsSync(zipPath) || import_fs_extra6.default.statSync(zipPath).size < 100) {
7202
+ throw new Error("Downloaded file is too small or empty");
7203
+ }
7204
+ downloadSuccess = true;
7205
+ } catch (downloadError) {
7206
+ console.log(import_chalk16.default.yellow(` Attempt ${attempt} failed: ${downloadError.message}`));
7207
+ if (import_fs_extra6.default.existsSync(zipPath)) {
7208
+ import_fs_extra6.default.removeSync(zipPath);
7209
+ }
7210
+ if (attempt === 3) {
7211
+ throw new Error(`Failed to download template after 3 attempts: ${downloadError.message}`);
7212
+ }
7213
+ }
7214
+ }
7193
7215
  try {
7194
- (0, import_child_process2.execSync)(`git clone --depth 1 ${TEMPLATE_REPO} ${targetDir}`, {
7216
+ (0, import_child_process2.execSync)(`unzip -o "${zipPath}" -d "${PROJECT_DIR}"`, {
7195
7217
  stdio: "inherit"
7196
7218
  });
7197
- console.log(import_chalk16.default.green(` Template cloned to: ${targetDir}`));
7198
- const gitDir = import_path11.default.join(targetDir, ".git");
7199
- if (import_fs_extra6.default.existsSync(gitDir)) {
7200
- import_fs_extra6.default.removeSync(gitDir);
7201
- console.log(import_chalk16.default.gray(" .git directory removed"));
7219
+ const subDir = import_path11.default.join(PROJECT_DIR, "pinme-worker-template-main");
7220
+ if (import_fs_extra6.default.existsSync(subDir)) {
7221
+ import_fs_extra6.default.copySync(subDir, targetDir);
7222
+ import_fs_extra6.default.removeSync(subDir);
7202
7223
  }
7224
+ import_fs_extra6.default.removeSync(zipPath);
7225
+ console.log(import_chalk16.default.green(` Template downloaded to: ${targetDir}`));
7203
7226
  } catch (error) {
7204
- throw new Error(`Failed to clone template: ${error.message}`);
7227
+ throw new Error(`Failed to extract template: ${error.message}`);
7205
7228
  }
7206
7229
  console.log(import_chalk16.default.blue("\n3. Updating configuration..."));
7207
7230
  const configPath = import_path11.default.join(targetDir, "pinme.toml");
@@ -7210,29 +7233,6 @@ Directory "${projectName}" already exists.`));
7210
7233
  /project_name = ".*"/,
7211
7234
  `project_name = "${workerData.project_name}"`
7212
7235
  );
7213
- updatedConfig = updatedConfig.replace(
7214
- /^VITE_WORKER_URL = ".*"$/m,
7215
- `VITE_WORKER_URL = "${workerData.api_domain}"`
7216
- );
7217
- updatedConfig = updatedConfig.replace(
7218
- /# database_id = ".*"/,
7219
- `database_id = "${workerData.uuid}"`
7220
- );
7221
- if (workerData.api_key) {
7222
- console.log(import_chalk16.default.gray(` API Key: ${workerData.api_key.slice(0, 8)}...`));
7223
- updatedConfig = updatedConfig.replace(
7224
- /^# api_key = ".*"$/m,
7225
- `api_key = "${workerData.api_key}"`
7226
- );
7227
- if (!updatedConfig.includes(`api_key = "${workerData.api_key}"`)) {
7228
- updatedConfig = updatedConfig.replace(
7229
- /^api_key = ".*"$/m,
7230
- `api_key = "${workerData.api_key}"`
7231
- );
7232
- }
7233
- } else {
7234
- console.log(import_chalk16.default.yellow(" Warning: No API Key returned from API"));
7235
- }
7236
7236
  import_fs_extra6.default.writeFileSync(configPath, updatedConfig);
7237
7237
  console.log(import_chalk16.default.green(` Updated pinme.toml`));
7238
7238
  console.log(import_chalk16.default.gray(` metadata: ${workerData.metadata}`));
@@ -7246,15 +7246,21 @@ Directory "${projectName}" already exists.`));
7246
7246
  );
7247
7247
  console.log(import_chalk16.default.green(` Saved metadata.json`));
7248
7248
  }
7249
+ const wranglerPath = import_path11.default.join(backendDir, "wrangler.toml");
7250
+ if (import_fs_extra6.default.existsSync(wranglerPath) && workerData.api_key) {
7251
+ let wranglerContent = import_fs_extra6.default.readFileSync(wranglerPath, "utf-8");
7252
+ wranglerContent = wranglerContent.replace(
7253
+ /^name = ".*"$/m,
7254
+ `name = "${workerData.project_name}"`
7255
+ );
7256
+ import_fs_extra6.default.writeFileSync(wranglerPath, wranglerContent);
7257
+ console.log(import_chalk16.default.green(` Updated backend/wrangler.toml API_KEY`));
7258
+ }
7249
7259
  const envExamplePath = import_path11.default.join(targetDir, "frontend", ".env.example");
7250
7260
  const envPath = import_path11.default.join(targetDir, "frontend", ".env");
7251
7261
  if (import_fs_extra6.default.existsSync(envExamplePath)) {
7252
7262
  let envContent = import_fs_extra6.default.readFileSync(envExamplePath, "utf-8");
7253
7263
  envContent = envContent.replace(/your-project/g, workerData.project_name);
7254
- envContent = envContent.replace(
7255
- /^VITE_WORKER_URL=.*$/m,
7256
- `VITE_WORKER_URL=${workerData.api_domain}`
7257
- );
7258
7264
  envContent = envContent.replace(
7259
7265
  /^VITE_API_URL=.*$/m,
7260
7266
  `VITE_API_URL=${workerData.api_domain}`
@@ -8002,123 +8008,14 @@ Project: ${data.data.project_name}`));
8002
8008
  }
8003
8009
  }
8004
8010
 
8005
- // bin/sendEmail.ts
8006
- var import_chalk22 = __toESM(require("chalk"));
8007
- var import_inquirer10 = __toESM(require("inquirer"));
8008
- var import_fs_extra12 = __toESM(require("fs-extra"));
8009
- var import_path17 = __toESM(require("path"));
8010
- var PROJECT_DIR6 = process.cwd();
8011
- var API_BASE6 = "https://pinme.dev/api/v4";
8012
- async function sendEmailCmd(options) {
8013
- var _a, _b;
8014
- try {
8015
- console.log(import_chalk22.default.blue("Sending email...\n"));
8016
- let apiKey = options.apiKey;
8017
- if (!apiKey) {
8018
- const configPath = import_path17.default.join(PROJECT_DIR6, "pinme.toml");
8019
- if (import_fs_extra12.default.existsSync(configPath)) {
8020
- const config = import_fs_extra12.default.readFileSync(configPath, "utf-8");
8021
- const apiKeyMatch = config.match(/api_key\s*=\s*"([^"]+)"/);
8022
- if (apiKeyMatch) {
8023
- apiKey = apiKeyMatch[1];
8024
- }
8025
- }
8026
- }
8027
- let to = options.to;
8028
- let subject = options.subject;
8029
- let html = options.html;
8030
- if (!to || !subject || !html) {
8031
- const answers = await import_inquirer10.default.prompt([
8032
- {
8033
- type: "input",
8034
- name: "to",
8035
- message: "To (email address):",
8036
- validate: (input) => {
8037
- if (!input.trim()) return "Email address is required";
8038
- if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(input)) {
8039
- return "Please enter a valid email address";
8040
- }
8041
- return true;
8042
- }
8043
- },
8044
- {
8045
- type: "input",
8046
- name: "subject",
8047
- message: "Subject:",
8048
- validate: (input) => {
8049
- if (!input.trim()) return "Subject is required";
8050
- return true;
8051
- }
8052
- },
8053
- {
8054
- type: "editor",
8055
- name: "html",
8056
- message: "HTML content (will open in editor):",
8057
- default: "<p>Hello!</p>",
8058
- validate: (input) => {
8059
- if (!input.trim()) return "HTML content is required";
8060
- return true;
8061
- }
8062
- }
8063
- ]);
8064
- to = answers.to;
8065
- subject = answers.subject;
8066
- html = answers.html;
8067
- }
8068
- if (!apiKey) {
8069
- const keyAnswer = await import_inquirer10.default.prompt([
8070
- {
8071
- type: "input",
8072
- name: "apiKey",
8073
- message: "API Key (from project config or create_worker response):",
8074
- validate: (input) => {
8075
- if (!input.trim()) return "API Key is required";
8076
- return true;
8077
- }
8078
- }
8079
- ]);
8080
- apiKey = keyAnswer.apiKey;
8081
- }
8082
- console.log(import_chalk22.default.blue("Sending email..."));
8083
- const apiUrl = `${API_BASE6}/send_email`;
8084
- console.log(import_chalk22.default.gray(`API URL: ${apiUrl}`));
8085
- const response = await axios_default.post(apiUrl, {
8086
- to,
8087
- subject,
8088
- html
8089
- }, {
8090
- headers: {
8091
- "X-API-Key": apiKey,
8092
- "Content-Type": "application/json"
8093
- }
8094
- });
8095
- const data = response.data;
8096
- if (data.code === 200) {
8097
- console.log(import_chalk22.default.green("\n\u2705 Email sent successfully!"));
8098
- console.log(import_chalk22.default.gray(`
8099
- To: ${to}`));
8100
- console.log(import_chalk22.default.gray(`Subject: ${subject}`));
8101
- } else {
8102
- const errorMsg = (data == null ? void 0 : data.msg) || "Failed to send email";
8103
- throw new Error(errorMsg);
8104
- }
8105
- process.exit(0);
8106
- } catch (error) {
8107
- const errorMsg = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.msg) || error.message || "Failed to send email";
8108
- console.error(import_chalk22.default.red(`
8109
- \u274C Error: ${errorMsg}`));
8110
- process.exit(1);
8111
- }
8112
- }
8113
-
8114
8011
  // bin/index.ts
8115
8012
  import_dotenv.default.config();
8116
8013
  checkNodeVersion();
8117
8014
  function showBanner() {
8118
8015
  console.log(
8119
- import_chalk23.default.cyan(import_figlet5.default.textSync("Pinme", { horizontalLayout: "full" }))
8016
+ import_chalk22.default.cyan(import_figlet5.default.textSync("Pinme", { horizontalLayout: "full" }))
8120
8017
  );
8121
- console.log(import_chalk23.default.cyan("A command-line tool for uploading files to IPFS\n"));
8018
+ console.log(import_chalk22.default.cyan("A command-line tool for uploading files to IPFS\n"));
8122
8019
  }
8123
8020
  var program = new import_commander.Command();
8124
8021
  program.name("pinme").version(version).option("-v, --version", "output the current version");
@@ -8142,7 +8039,6 @@ program.command("update-db").description("Execute database migration").action(()
8142
8039
  program.command("update-worker").description("Execute worker migration").action(() => updateWorkerCmd());
8143
8040
  program.command("update-web").description("Deploy frontend to IPFS").action((options) => updateWebCmd(options));
8144
8041
  program.command("delete").description("Delete a project (Worker, domain, D1 database)").argument("[name]", "Project name").option("-f, --force", "Skip confirmation").action((name, options) => deleteCmd({ name, force: options == null ? void 0 : options.force }));
8145
- program.command("send-email").description("Send email via PinMe API").option("-t, --to <email>", "Recipient email address").option("-s, --subject <subject>", "Email subject").option("-h, --html <content>", "HTML content").option("--text <content>", "Plain text content (alternative to --html)").option("-k, --api-key <key>", "API Key (or from pinme.toml)").action((options) => sendEmailCmd(options));
8146
8042
  program.command("domain").description("Alias for 'my-domains' command").action(() => myDomainsCmd());
8147
8043
  program.command("list").description("show upload history").option(
8148
8044
  "-l, --limit <number>",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinme",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },