Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1a48647f0 | ||
|
|
a150ec62a2 | ||
|
|
4623bccc5f | ||
|
|
d03c092ec9 | ||
|
|
92ef8fb3f3 | ||
|
|
d0896e6746 |
No files matched your search
@@ -1,121 +0,0 @@
|
|||||||
---
|
|
||||||
name: plausible-analytics
|
|
||||||
description: Add Plausible Analytics tracking to the application, configured through AppConfig and environment variables.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Plausible Analytics
|
|
||||||
|
|
||||||
Add privacy-friendly analytics with [Plausible](https://plausible.io/) using the `@plausible-analytics/tracker` npm package. Configuration lives in `AppConfig` so it can be set via `VITE_` environment variables.
|
|
||||||
|
|
||||||
## 1. Install the package
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install @plausible-analytics/tracker
|
|
||||||
```
|
|
||||||
|
|
||||||
## 2. Add fields to `AppConfig`
|
|
||||||
|
|
||||||
In `src/contexts/AppContext.ts`, add two fields to the `AppConfig` interface:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export interface AppConfig {
|
|
||||||
// ...existing fields...
|
|
||||||
/** Plausible Analytics domain (empty string = disabled). */
|
|
||||||
plausibleDomain: string;
|
|
||||||
/** Plausible Analytics API endpoint (empty string = use default). */
|
|
||||||
plausibleEndpoint: string;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## 3. Update the Zod schema in `AppProvider.tsx`
|
|
||||||
|
|
||||||
Add the new fields to the `AppConfigSchema`:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
const AppConfigSchema = z.object({
|
|
||||||
// ...existing fields...
|
|
||||||
plausibleDomain: z.string(),
|
|
||||||
plausibleEndpoint: z.string(),
|
|
||||||
}) satisfies z.ZodType<AppConfig>;
|
|
||||||
```
|
|
||||||
|
|
||||||
## 4. Create `PlausibleProvider`
|
|
||||||
|
|
||||||
Create `src/components/PlausibleProvider.tsx`:
|
|
||||||
|
|
||||||
```tsx
|
|
||||||
import { ReactNode, useEffect, useRef } from 'react';
|
|
||||||
import { useAppContext } from '@/hooks/useAppContext';
|
|
||||||
|
|
||||||
interface PlausibleProviderProps {
|
|
||||||
children: ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reactively initializes Plausible Analytics from AppConfig.
|
|
||||||
* Plausible's `init()` can only be called once, so we guard with a ref.
|
|
||||||
*/
|
|
||||||
export function PlausibleProvider({ children }: PlausibleProviderProps) {
|
|
||||||
const { config } = useAppContext();
|
|
||||||
const initializedRef = useRef(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (initializedRef.current || !config.plausibleDomain) return;
|
|
||||||
initializedRef.current = true;
|
|
||||||
|
|
||||||
import('@plausible-analytics/tracker').then(({ init }) => {
|
|
||||||
init({
|
|
||||||
domain: config.plausibleDomain,
|
|
||||||
...(config.plausibleEndpoint && { endpoint: config.plausibleEndpoint }),
|
|
||||||
});
|
|
||||||
}).catch(console.error);
|
|
||||||
}, [config.plausibleDomain, config.plausibleEndpoint]);
|
|
||||||
|
|
||||||
return <>{children}</>;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## 5. Wire into `App.tsx`
|
|
||||||
|
|
||||||
Import `PlausibleProvider` and add it inside `AppProvider` (it needs access to `useAppContext`):
|
|
||||||
|
|
||||||
```tsx
|
|
||||||
import { PlausibleProvider } from '@/components/PlausibleProvider';
|
|
||||||
|
|
||||||
// In the defaultConfig, add:
|
|
||||||
const defaultConfig: AppConfig = {
|
|
||||||
// ...existing fields...
|
|
||||||
plausibleDomain: import.meta.env.VITE_PLAUSIBLE_DOMAIN || '',
|
|
||||||
plausibleEndpoint: import.meta.env.VITE_PLAUSIBLE_ENDPOINT || '',
|
|
||||||
};
|
|
||||||
|
|
||||||
// In the JSX, wrap children of AppProvider:
|
|
||||||
<AppProvider storageKey="nostr:app-config" defaultConfig={defaultConfig}>
|
|
||||||
<PlausibleProvider>
|
|
||||||
{/* ...rest of providers... */}
|
|
||||||
</PlausibleProvider>
|
|
||||||
</AppProvider>
|
|
||||||
```
|
|
||||||
|
|
||||||
## 6. Update `TestApp.tsx`
|
|
||||||
|
|
||||||
Add the new fields to the test default config with empty strings (disabled):
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
const defaultConfig: AppConfig = {
|
|
||||||
// ...existing fields...
|
|
||||||
plausibleDomain: '',
|
|
||||||
plausibleEndpoint: '',
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
## 7. Configure via environment variables
|
|
||||||
|
|
||||||
Create or update `.env`:
|
|
||||||
|
|
||||||
```
|
|
||||||
VITE_PLAUSIBLE_DOMAIN="example.com"
|
|
||||||
VITE_PLAUSIBLE_ENDPOINT="https://plausible.example.com/api/event"
|
|
||||||
```
|
|
||||||
|
|
||||||
`VITE_PLAUSIBLE_ENDPOINT` is optional -- it defaults to Plausible Cloud's endpoint if omitted. Set it when using a self-hosted Plausible instance.
|
|
||||||
@@ -1,198 +0,0 @@
|
|||||||
---
|
|
||||||
name: release
|
|
||||||
description: Publish a new app release with versioning, changelog, and git tagging. Triggered by "publish a new release" or similar requests.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Release Skill
|
|
||||||
|
|
||||||
This skill guides you through publishing a new release of the app. It handles version bumping, changelog generation, and git tagging/pushing.
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
- **Version format**: Marketing version (X.Y.Z), starting from 9.9.1. **This is NOT semver.** Version numbers are chosen based on how the release looks to end users, not based on API compatibility or breaking changes. Think of it like an app store version -- the number reflects the perceived significance of the update to a regular user.
|
|
||||||
- **Version source of truth**: `package.json` `version` field
|
|
||||||
- **Changelog**: `CHANGELOG.md` in repo root, using [Keep a Changelog](https://keepachangelog.com/) format
|
|
||||||
- **Version bumping**:
|
|
||||||
- **Patch (Z)**: Most releases. Bug fixes, tweaks, internal improvements, anything a user wouldn't specifically notice or seek out.
|
|
||||||
- **Minor (Y)**: Releases with headline features -- things worth announcing. A user should be able to look at the minor bump and think "oh, something new happened."
|
|
||||||
- **Major (X)**: Only when the user explicitly requests it (milestones, rebrands, major redesigns)
|
|
||||||
- **CI trigger**: Pushing a version tag (`v9.9.0`) triggers the CI pipeline to build and create a GitLab release
|
|
||||||
|
|
||||||
## Release Procedure
|
|
||||||
|
|
||||||
Follow these steps in order. Do NOT skip any step.
|
|
||||||
|
|
||||||
### Step 1: Required Reading
|
|
||||||
|
|
||||||
Before writing any release notes, you MUST read these pages to understand the product context, voice, and values:
|
|
||||||
|
|
||||||
1. **https://soapbox.pub/** -- Soapbox company overview and product suite
|
|
||||||
2. **https://soapbox.pub/shakespeare/** -- Shakespeare product page
|
|
||||||
|
|
||||||
These pages define what Shakespeare is, how it's positioned, and the tone of voice to use. Changelog entries should reflect this identity: creative, empowering, user-focused, emphasizing building and self-expression. Avoid dry technical jargon -- write for people who use the app, not developers.
|
|
||||||
|
|
||||||
### Step 2: Pre-flight Checks
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Ensure working directory is clean
|
|
||||||
git status
|
|
||||||
|
|
||||||
# Ensure we're on main branch
|
|
||||||
git branch --show-current
|
|
||||||
|
|
||||||
# Run the full test suite
|
|
||||||
npm run test
|
|
||||||
```
|
|
||||||
|
|
||||||
- If the working directory has uncommitted changes, ask the user whether to commit them first or abort.
|
|
||||||
- If not on `main`, warn the user and ask whether to proceed.
|
|
||||||
- If tests fail, stop and fix the issues before continuing.
|
|
||||||
|
|
||||||
### Step 3: Determine What Changed
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Get the current version from package.json
|
|
||||||
node -p "require('./package.json').version"
|
|
||||||
|
|
||||||
# Get commits since the last version tag
|
|
||||||
git log v$(node -p "require('./package.json').version")..HEAD --oneline
|
|
||||||
```
|
|
||||||
|
|
||||||
- If there are no commits since the last tag, inform the user there is nothing to release and stop.
|
|
||||||
- Review the commit list to understand the scope of changes.
|
|
||||||
|
|
||||||
### Step 4: Decide the Version Bump
|
|
||||||
|
|
||||||
Analyze the commits from Step 3 and determine the appropriate bump level:
|
|
||||||
|
|
||||||
| Bump | When to use | Example |
|
|
||||||
|------|-------------|---------|
|
|
||||||
| **Patch** | Bug fixes, minor tweaks, dependency updates, small UI polish, internal tooling, developer-facing pages, CI/build changes, settings/admin screens | 9.9.0 -> 9.9.1 |
|
|
||||||
| **Minor** | Significant new product features that change how users interact with the app -- the kind of thing you'd highlight in an app store update or announce on social media (e.g., new template support, new AI features, new deployment options, major UI overhaul) | 9.9.1 -> 9.10.0 |
|
|
||||||
| **Major** | ONLY when the user explicitly instructs a major bump | 9.10.0 -> 10.0.0 |
|
|
||||||
|
|
||||||
**Default to patch** when in doubt. The bar for a minor bump is high -- ask yourself: "Would a regular user notice and care about this change?" If the answer is no, it's a patch. Internal pages (changelog, settings, about screens), infrastructure improvements, CI fixes, and developer tooling are always patch-level regardless of whether they technically add a new page or screen.
|
|
||||||
|
|
||||||
When bumping minor, reset patch to 0 (e.g., 9.9.3 -> 9.10.0).
|
|
||||||
When bumping major, reset minor and patch to 0 (e.g., 9.3.1 -> 10.0.0).
|
|
||||||
|
|
||||||
### Step 5: Write the Changelog Entry
|
|
||||||
|
|
||||||
Prepend a new section to `CHANGELOG.md` directly below the `# Changelog` heading.
|
|
||||||
|
|
||||||
**Format:**
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
## [X.Y.Z] - YYYY-MM-DD
|
|
||||||
|
|
||||||
### Added
|
|
||||||
- Description of new features
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
- Description of changes to existing features
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Description of bug fixes
|
|
||||||
|
|
||||||
### Removed
|
|
||||||
- Description of removed features
|
|
||||||
```
|
|
||||||
|
|
||||||
**Rules:**
|
|
||||||
- Only include categories that have entries (omit empty categories)
|
|
||||||
- Write **user-facing descriptions**, not raw commit messages
|
|
||||||
- Keep descriptions concise -- one line per change
|
|
||||||
- Group related commits into single entries where appropriate
|
|
||||||
- Use present tense ("Add dark mode toggle", not "Added dark mode toggle")
|
|
||||||
- Focus on what the user sees/experiences, not internal implementation details
|
|
||||||
- Use the current date in YYYY-MM-DD format
|
|
||||||
- **Collapse related work into one entry.** If a feature was added and then fixed/tweaked across multiple commits in the same release, present the finished result as a single "Added" entry. Never list something as "Added" and then also list fixes for that same thing -- the user sees the end product, not the development history.
|
|
||||||
- **Omit purely internal changes.** CI fixes, build pipeline tweaks, developer tooling, and infrastructure changes should be omitted from the changelog entirely unless they have a direct, visible impact on the user experience. The changelog is for users, not developers.
|
|
||||||
- **Compare the actual code between versions** to understand what really changed, rather than just reading commit messages. Commit messages may over- or under-represent the significance of changes.
|
|
||||||
|
|
||||||
### Step 6: Update Version in All Files
|
|
||||||
|
|
||||||
#### 6a. `package.json`
|
|
||||||
|
|
||||||
Update the `version` field:
|
|
||||||
|
|
||||||
```json
|
|
||||||
"version": "X.Y.Z"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 7: Copy Changelog to Public Directory
|
|
||||||
|
|
||||||
The changelog is served at runtime by the app from the `public/` directory. After updating `CHANGELOG.md`, copy it:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp CHANGELOG.md public/CHANGELOG.md
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 8: Pull Latest Changes
|
|
||||||
|
|
||||||
Before committing the release, pull the latest changes from the remote to ensure the release commit sits on top of the latest code. This **must** happen before committing and tagging.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git pull origin main
|
|
||||||
```
|
|
||||||
|
|
||||||
**CRITICAL**: Always use `git pull` (merge), NEVER `git pull --rebase`. Rebasing rewrites commit hashes, which would orphan any tag pointing to the original commit. Since version tags are often protected on the remote and cannot be deleted or updated, a broken tag cannot be easily fixed.
|
|
||||||
|
|
||||||
If there are merge conflicts with the pulled changes, resolve them before proceeding.
|
|
||||||
|
|
||||||
### Step 9: Commit the Release
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git add package.json CHANGELOG.md public/CHANGELOG.md
|
|
||||||
git commit -m "release: vX.Y.Z"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 10: Tag the Release
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git tag vX.Y.Z
|
|
||||||
```
|
|
||||||
|
|
||||||
The tag format is `v` followed by the version with no suffix. Examples: `v9.9.0`, `v9.10.0`, `v10.0.0`.
|
|
||||||
|
|
||||||
### Step 11: Push
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git push origin main vX.Y.Z
|
|
||||||
```
|
|
||||||
|
|
||||||
**CRITICAL**: Push only the specific tag being released. NEVER use `--tags` -- that pushes ALL local tags, including stale or deleted ones.
|
|
||||||
|
|
||||||
### Step 12: Confirm
|
|
||||||
|
|
||||||
After pushing, inform the user:
|
|
||||||
- The new version number
|
|
||||||
- A brief summary of what was released
|
|
||||||
- That CI will handle building and publishing the artifacts
|
|
||||||
|
|
||||||
## File Reference
|
|
||||||
|
|
||||||
| File | What to update | Notes |
|
|
||||||
|------|---------------|-------|
|
|
||||||
| `package.json` | `version` field | Source of truth for the version |
|
|
||||||
| `CHANGELOG.md` | Prepend new section | User-facing changelog |
|
|
||||||
| `public/CHANGELOG.md` | Copy from `CHANGELOG.md` | Served at runtime by the app |
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### "Nothing to release"
|
|
||||||
If `git log` shows no commits since the last tag, there genuinely is nothing to release.
|
|
||||||
|
|
||||||
### Tests fail
|
|
||||||
Fix the failing tests before proceeding. The release must not contain broken code.
|
|
||||||
|
|
||||||
### Wrong version bumped
|
|
||||||
If you tagged the wrong version and haven't pushed yet:
|
|
||||||
```bash
|
|
||||||
git tag -d vX.Y.Z # delete the local tag
|
|
||||||
git reset --soft HEAD~1 # undo the commit but keep changes staged
|
|
||||||
```
|
|
||||||
Then redo steps 4-10 with the correct version.
|
|
||||||
|
|
||||||
### Already pushed a bad release
|
|
||||||
This requires manual intervention. Inform the user and suggest they delete the tag and release from GitLab manually, then re-run the release process.
|
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
# Sentry
|
# Sentry
|
||||||
VITE_SENTRY_DSN="https://********************************@*****************.example.com/****************"
|
VITE_SENTRY_DSN="https://********************************@*****************.example.com/****************"
|
||||||
|
|
||||||
# Plausible Analytics
|
|
||||||
VITE_PLAUSIBLE_DOMAIN="example.com"
|
|
||||||
VITE_PLAUSIBLE_ENDPOINT="https://plausible.example.com/api/event"
|
|
||||||
|
|
||||||
# GitHub OAuth Configuration
|
# GitHub OAuth Configuration
|
||||||
VITE_GITHUB_OAUTH_CLIENT_ID="********************"
|
VITE_GITHUB_OAUTH_CLIENT_ID="********************"
|
||||||
VITE_GITHUB_OAUTH_CLIENT_SECRET="****************************************"
|
VITE_GITHUB_OAUTH_CLIENT_SECRET="****************************************"
|
||||||
|
|||||||
@@ -3,26 +3,13 @@ image: node:25
|
|||||||
default:
|
default:
|
||||||
interruptible: true
|
interruptible: true
|
||||||
timeout: 1 minute
|
timeout: 1 minute
|
||||||
cache:
|
|
||||||
key:
|
|
||||||
files:
|
|
||||||
- package-lock.json
|
|
||||||
paths:
|
|
||||||
- node_modules/
|
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
- deploy
|
- deploy
|
||||||
- build
|
|
||||||
- release
|
|
||||||
- publish
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG
|
|
||||||
when: never
|
|
||||||
- when: always
|
|
||||||
script:
|
script:
|
||||||
- npm run typecheck
|
- npm run typecheck
|
||||||
- npm run build
|
- npm run build
|
||||||
@@ -30,10 +17,6 @@ test:
|
|||||||
|
|
||||||
pages:
|
pages:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG
|
|
||||||
when: never
|
|
||||||
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
|
||||||
script:
|
script:
|
||||||
- npm run build
|
- npm run build
|
||||||
- rm -rf public
|
- rm -rf public
|
||||||
@@ -41,198 +24,6 @@ pages:
|
|||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
|
only:
|
||||||
deploy-nsite:
|
variables:
|
||||||
stage: deploy
|
- $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
|
||||||
timeout: 10 minutes
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG
|
|
||||||
when: never
|
|
||||||
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
|
||||||
variables:
|
|
||||||
NSYTE_VERSION: "v0.24.1"
|
|
||||||
script:
|
|
||||||
# Build the web app
|
|
||||||
- npm ci
|
|
||||||
- npm run build
|
|
||||||
- cp dist/index.html dist/404.html
|
|
||||||
|
|
||||||
# Remove sourcemaps to stay under nsite's 65KB manifest limit
|
|
||||||
- find dist -name '*.map' -delete
|
|
||||||
|
|
||||||
# Download nsyte binary
|
|
||||||
- curl -fsSL "https://github.com/sandwichfarm/nsyte/releases/download/${NSYTE_VERSION}/nsyte-linux" -o /usr/local/bin/nsyte
|
|
||||||
- chmod +x /usr/local/bin/nsyte
|
|
||||||
|
|
||||||
# Deploy to nsite via nsyte using the nbunksec credential
|
|
||||||
- >-
|
|
||||||
nsyte deploy ./dist
|
|
||||||
-i
|
|
||||||
--sec "$NSITE_NBUNKSEC"
|
|
||||||
--name shakespeare
|
|
||||||
--relays "wss://relay.ditto.pub,wss://relay.nsite.lol,wss://relay.dreamith.to,wss://relay.primal.net"
|
|
||||||
--servers "https://blossom.primal.net,https://blossom.ditto.pub,https://blossom.dreamith.to"
|
|
||||||
--fallback "/index.html"
|
|
||||||
--publish-server-list
|
|
||||||
--use-fallback-relays
|
|
||||||
--use-fallback-servers
|
|
||||||
|
|
||||||
build-apk:
|
|
||||||
stage: build
|
|
||||||
image: eclipse-temurin:21-jdk
|
|
||||||
timeout: 15 minutes
|
|
||||||
needs: []
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
|
|
||||||
variables:
|
|
||||||
ANDROID_SDK_ROOT: /opt/android-sdk
|
|
||||||
ANDROID_HOME: /opt/android-sdk
|
|
||||||
before_script:
|
|
||||||
# Install system dependencies
|
|
||||||
- apt-get update -qq
|
|
||||||
- apt-get install -y -qq curl unzip > /dev/null
|
|
||||||
|
|
||||||
# Install Node.js 22
|
|
||||||
- curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
||||||
- apt-get install -y -qq nodejs > /dev/null
|
|
||||||
- node --version
|
|
||||||
- npm --version
|
|
||||||
|
|
||||||
# Install Android SDK command-line tools
|
|
||||||
- mkdir -p $ANDROID_SDK_ROOT/cmdline-tools
|
|
||||||
- curl -fsSL https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -o cmdline-tools.zip
|
|
||||||
- unzip -q cmdline-tools.zip -d $ANDROID_SDK_ROOT/cmdline-tools
|
|
||||||
- mv $ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools $ANDROID_SDK_ROOT/cmdline-tools/latest
|
|
||||||
- export PATH="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools:$PATH"
|
|
||||||
|
|
||||||
# Accept licenses and install SDK components
|
|
||||||
- printf 'y\ny\ny\ny\ny\ny\ny\n' | sdkmanager --licenses > /dev/null 2>&1 || true
|
|
||||||
- sdkmanager --install "platforms;android-36" "build-tools;36.0.0" "platform-tools" > /dev/null
|
|
||||||
|
|
||||||
# Write local.properties for Gradle
|
|
||||||
- echo "sdk.dir=$ANDROID_SDK_ROOT" > android/local.properties
|
|
||||||
|
|
||||||
# Decode signing keystore and migrate JKS -> PKCS12 for Gradle compatibility
|
|
||||||
- echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > android/app/my-upload-key.jks
|
|
||||||
- keytool -importkeystore
|
|
||||||
-srckeystore android/app/my-upload-key.jks
|
|
||||||
-destkeystore android/app/my-upload-key.keystore
|
|
||||||
-deststoretype pkcs12
|
|
||||||
-srcstorepass "$KEYSTORE_PASSWORD"
|
|
||||||
-deststorepass "$KEYSTORE_PASSWORD"
|
|
||||||
-srcalias upload
|
|
||||||
-destalias upload
|
|
||||||
-noprompt
|
|
||||||
- rm android/app/my-upload-key.jks
|
|
||||||
|
|
||||||
# Write key.properties from CI/CD variables
|
|
||||||
- |
|
|
||||||
cat > android/key.properties << EOF
|
|
||||||
storePassword=$KEYSTORE_PASSWORD
|
|
||||||
keyPassword=$KEY_PASSWORD
|
|
||||||
keyAlias=upload
|
|
||||||
storeFile=my-upload-key.keystore
|
|
||||||
EOF
|
|
||||||
script:
|
|
||||||
# Extract semver version from git tag (e.g., v9.9.2 -> 9.9.2)
|
|
||||||
- TAG="${CI_COMMIT_TAG#v}"
|
|
||||||
- VERSION_NAME="${TAG}"
|
|
||||||
- VERSION_CODE="${CI_PIPELINE_IID}"
|
|
||||||
- echo "Building version $VERSION_NAME (code $VERSION_CODE) from tag $CI_COMMIT_TAG"
|
|
||||||
|
|
||||||
# Stamp version into build.gradle
|
|
||||||
- sed -i "s/versionCode [0-9]*/versionCode ${VERSION_CODE}/" android/app/build.gradle
|
|
||||||
- sed -i "s/versionName \"[^\"]*\"/versionName \"${VERSION_NAME}\"/" android/app/build.gradle
|
|
||||||
|
|
||||||
# Build web assets
|
|
||||||
- npm ci
|
|
||||||
- npx vite build -l error
|
|
||||||
- cp dist/index.html dist/404.html
|
|
||||||
|
|
||||||
# Sync web assets to Capacitor Android project
|
|
||||||
- npx cap sync android
|
|
||||||
|
|
||||||
# Build signed release APK
|
|
||||||
- cd android && chmod +x gradlew && ./gradlew assembleRelease bundleRelease && cd ..
|
|
||||||
|
|
||||||
# Copy APK to a predictable artifact path
|
|
||||||
- mkdir -p artifacts
|
|
||||||
- cp android/app/build/outputs/apk/release/app-release.apk "artifacts/Shakespeare.apk"
|
|
||||||
- cp android/app/build/outputs/bundle/release/app-release.aab "artifacts/Shakespeare.aab"
|
|
||||||
- ls -lh artifacts/
|
|
||||||
|
|
||||||
# Upload to Generic Packages registry for a stable public download URL
|
|
||||||
- |
|
|
||||||
curl --fail --header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
|
|
||||||
--upload-file "artifacts/Shakespeare.apk" \
|
|
||||||
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/shakespeare/${CI_COMMIT_TAG}/Shakespeare-${CI_COMMIT_TAG}.apk"
|
|
||||||
- |
|
|
||||||
curl --fail --header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
|
|
||||||
--upload-file "artifacts/Shakespeare.aab" \
|
|
||||||
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/shakespeare/${CI_COMMIT_TAG}/Shakespeare-${CI_COMMIT_TAG}.aab"
|
|
||||||
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- artifacts/Shakespeare.apk
|
|
||||||
- artifacts/Shakespeare.aab
|
|
||||||
expire_in: 90 days
|
|
||||||
cache:
|
|
||||||
key: android-gradle
|
|
||||||
paths:
|
|
||||||
- android/.gradle/
|
|
||||||
- .gradle/
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
||||||
needs:
|
|
||||||
- build-apk
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
|
|
||||||
script:
|
|
||||||
- echo "Creating release for $CI_COMMIT_TAG"
|
|
||||||
# Extract the latest changelog section for the release description.
|
|
||||||
# Reads from "## [version]" to the next "## [" or end of file.
|
|
||||||
- |
|
|
||||||
VERSION="${CI_COMMIT_TAG#v}"
|
|
||||||
RELEASE_NOTES=$(awk "/^## \\[${VERSION}\\]/{found=1; next} /^## \\[/{if(found) exit} found{print}" CHANGELOG.md)
|
|
||||||
if [ -z "$RELEASE_NOTES" ]; then
|
|
||||||
RELEASE_NOTES="Shakespeare ${CI_COMMIT_TAG}"
|
|
||||||
fi
|
|
||||||
- echo "$RELEASE_NOTES" > release-notes.md
|
|
||||||
release:
|
|
||||||
tag_name: $CI_COMMIT_TAG
|
|
||||||
name: $CI_COMMIT_TAG
|
|
||||||
description: './release-notes.md'
|
|
||||||
assets:
|
|
||||||
links:
|
|
||||||
- name: Shakespeare-${CI_COMMIT_TAG}.apk
|
|
||||||
url: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/shakespeare/${CI_COMMIT_TAG}/Shakespeare-${CI_COMMIT_TAG}.apk
|
|
||||||
link_type: package
|
|
||||||
- name: Shakespeare-${CI_COMMIT_TAG}.aab
|
|
||||||
url: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/shakespeare/${CI_COMMIT_TAG}/Shakespeare-${CI_COMMIT_TAG}.aab
|
|
||||||
link_type: package
|
|
||||||
|
|
||||||
publish-zapstore:
|
|
||||||
stage: publish
|
|
||||||
image: golang:1.24
|
|
||||||
needs:
|
|
||||||
- build-apk
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
|
|
||||||
variables:
|
|
||||||
SIGN_WITH: $ZAPSTORE_BUNKER_URL
|
|
||||||
script:
|
|
||||||
- go install github.com/zapstore/zsp@latest
|
|
||||||
|
|
||||||
# Restore the persistent NIP-46 client key so the bunker recognizes us across CI runs.
|
|
||||||
# zsp stores client keys at ~/.config/zsp/bunker-keys/<bunker-pubkey>.key
|
|
||||||
- BUNKER_PUBKEY=$(echo "$ZAPSTORE_BUNKER_URL" | sed 's|bunker://||;s|?.*||')
|
|
||||||
- mkdir -p ~/.config/zsp/bunker-keys
|
|
||||||
- echo "$ZAPSTORE_CLIENT_KEY" > ~/.config/zsp/bunker-keys/${BUNKER_PUBKEY}.key
|
|
||||||
|
|
||||||
- APK_PATH="artifacts/Shakespeare.apk"
|
|
||||||
- VERSION="${CI_COMMIT_TAG#v}"
|
|
||||||
- sed -i "2i release_source:\ ./${APK_PATH}" zapstore.yaml
|
|
||||||
- sed -i "2i version:\ ${VERSION}" zapstore.yaml
|
|
||||||
- zsp publish --quiet --skip-preview zapstore.yaml
|
|
||||||
@@ -1,7 +1,3 @@
|
|||||||
# Agent Rules
|
|
||||||
|
|
||||||
- ALWAYS commit after you finish your turn. No exceptions. Don't ask for permission, just do it.
|
|
||||||
|
|
||||||
# Shakespeare - AI-Powered App Builder
|
# Shakespeare - AI-Powered App Builder
|
||||||
|
|
||||||
Shakespeare is a browser-based AI chat application that allows users to build custom web applications through natural language conversation. All operations including AI chat and Git operations are executed in client-side JavaScript, with API keys stored in browser storage. Simply describe what you want to build, and AI will help you create it.
|
Shakespeare is a browser-based AI chat application that allows users to build custom web applications through natural language conversation. All operations including AI chat and Git operations are executed in client-side JavaScript, with API keys stored in browser storage. Simply describe what you want to build, and AI will help you create it.
|
||||||
@@ -54,9 +50,6 @@ Shakespeare provides AI agents with specialized tools for project development (n
|
|||||||
- **NostrReadNipsIndexTool**: Read the full list of NIPs, kinds, and tags
|
- **NostrReadNipsIndexTool**: Read the full list of NIPs, kinds, and tags
|
||||||
- **NostrFetchEventTool**: Fetch Nostr events using NIP-19 identifiers
|
- **NostrFetchEventTool**: Fetch Nostr events using NIP-19 identifiers
|
||||||
- **NostrGenerateKindTool**: Generate unused Nostr event kind numbers
|
- **NostrGenerateKindTool**: Generate unused Nostr event kind numbers
|
||||||
- **NostrEncodeTool**: Encode hex values into NIP-19 bech32 entities (npub, note, nprofile, nevent, naddr)
|
|
||||||
- **NostrDecodeTool**: Decode NIP-19 bech32 entities into hex and structured data
|
|
||||||
- **BlossomUploadTool**: Upload files from the project to Blossom media hosting, returns a public URL
|
|
||||||
- **ReadConsoleMessagesTool**: Read console messages from project preview with filtering capabilities
|
- **ReadConsoleMessagesTool**: Read console messages from project preview with filtering capabilities
|
||||||
|
|
||||||
#### Shell Commands
|
#### Shell Commands
|
||||||
@@ -1099,7 +1092,7 @@ const defaultConfig: AppConfig = {
|
|||||||
relayMetadata: {
|
relayMetadata: {
|
||||||
relays: [
|
relays: [
|
||||||
{ url: 'wss://relay.ditto.pub', read: true, write: true },
|
{ url: 'wss://relay.ditto.pub', read: true, write: true },
|
||||||
{ url: 'wss://relay.primal.net', read: true, write: true },
|
{ url: 'wss://relay.nostr.band', read: true, write: true },
|
||||||
],
|
],
|
||||||
updatedAt: 0,
|
updatedAt: 0,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
## [9.10.3] - 2026-04-02
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Fix Android app showing default Capacitor splash screen and icon colors
|
|
||||||
|
|
||||||
## [9.10.2] - 2026-04-02
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Fix Android app showing default Capacitor icon instead of Shakespeare logo in app drawer
|
|
||||||
|
|
||||||
## [9.10.1] - 2026-04-02
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Replace default Capacitor vector drawable icons with Shakespeare logo
|
|
||||||
|
|
||||||
## [9.10.0] - 2026-04-02
|
|
||||||
|
|
||||||
### Added
|
|
||||||
- Android app powered by Capacitor with deep links, splash screen, and signed release builds
|
|
||||||
- CI pipeline for building APKs, publishing to GitLab releases, and distributing via Zapstore
|
|
||||||
- Nsite deployment for decentralized hosting via Nostr
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
- Make version number on mobile settings a clickable link to the changelog with build date
|
|
||||||
|
|
||||||
## [9.9.2] - 2026-04-02
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
- Simplify nsite deployment to always use named sites, removing the root site option
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Fix crash in "What's new" toast when used outside the router context
|
|
||||||
- Truncate long changelog excerpts in update notifications so they fit neatly in the toast
|
|
||||||
- Left-align changelog page content for better readability
|
|
||||||
|
|
||||||
## [9.9.1] - 2026-04-02
|
|
||||||
|
|
||||||
### Added
|
|
||||||
- Changelog page and versioning system with "What's new" toast notifications on updates
|
|
||||||
- Release skill for managing versioned releases with changelog generation and git tagging
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore
|
|
||||||
|
|
||||||
# Built application files
|
|
||||||
*.apk
|
|
||||||
*.aar
|
|
||||||
*.ap_
|
|
||||||
*.aab
|
|
||||||
|
|
||||||
# Files for the ART/Dalvik VM
|
|
||||||
*.dex
|
|
||||||
|
|
||||||
# Java class files
|
|
||||||
*.class
|
|
||||||
|
|
||||||
# Generated files
|
|
||||||
bin/
|
|
||||||
gen/
|
|
||||||
out/
|
|
||||||
# Uncomment the following line in case you need and you don't have the release build type files in your app
|
|
||||||
# release/
|
|
||||||
|
|
||||||
# Gradle files
|
|
||||||
.gradle/
|
|
||||||
build/
|
|
||||||
|
|
||||||
# Local configuration file (sdk path, etc)
|
|
||||||
local.properties
|
|
||||||
|
|
||||||
# Proguard folder generated by Eclipse
|
|
||||||
proguard/
|
|
||||||
|
|
||||||
# Log Files
|
|
||||||
*.log
|
|
||||||
|
|
||||||
# Android Studio Navigation editor temp files
|
|
||||||
.navigation/
|
|
||||||
|
|
||||||
# Android Studio captures folder
|
|
||||||
captures/
|
|
||||||
|
|
||||||
# IntelliJ
|
|
||||||
*.iml
|
|
||||||
.idea/workspace.xml
|
|
||||||
.idea/tasks.xml
|
|
||||||
.idea/gradle.xml
|
|
||||||
.idea/assetWizardSettings.xml
|
|
||||||
.idea/dictionaries
|
|
||||||
.idea/libraries
|
|
||||||
# Android Studio 3 in .gitignore file.
|
|
||||||
.idea/caches
|
|
||||||
.idea/modules.xml
|
|
||||||
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
|
|
||||||
.idea/navEditor.xml
|
|
||||||
|
|
||||||
# Keystore files
|
|
||||||
*.jks
|
|
||||||
*.keystore
|
|
||||||
key.properties
|
|
||||||
|
|
||||||
# External native build folder generated in Android Studio 2.2 and later
|
|
||||||
.externalNativeBuild
|
|
||||||
.cxx/
|
|
||||||
|
|
||||||
# Google Services (e.g. APIs or Firebase)
|
|
||||||
# google-services.json
|
|
||||||
|
|
||||||
# Freeline
|
|
||||||
freeline.py
|
|
||||||
freeline/
|
|
||||||
freeline_project_description.json
|
|
||||||
|
|
||||||
# fastlane
|
|
||||||
fastlane/report.xml
|
|
||||||
fastlane/Preview.html
|
|
||||||
fastlane/screenshots
|
|
||||||
fastlane/test_output
|
|
||||||
fastlane/readme.md
|
|
||||||
|
|
||||||
# Version control
|
|
||||||
vcs.xml
|
|
||||||
|
|
||||||
# lint
|
|
||||||
lint/intermediates/
|
|
||||||
lint/generated/
|
|
||||||
lint/outputs/
|
|
||||||
lint/tmp/
|
|
||||||
# lint/reports/
|
|
||||||
|
|
||||||
# Android Profiling
|
|
||||||
*.hprof
|
|
||||||
|
|
||||||
# Cordova plugins for Capacitor
|
|
||||||
capacitor-cordova-android-plugins
|
|
||||||
|
|
||||||
# Copied web assets
|
|
||||||
app/src/main/assets/public
|
|
||||||
|
|
||||||
# Generated Config files
|
|
||||||
app/src/main/assets/capacitor.config.json
|
|
||||||
app/src/main/assets/capacitor.plugins.json
|
|
||||||
app/src/main/res/xml/config.xml
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>android</name>
|
|
||||||
<comment>Project android created by Buildship.</comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
|
||||||
</natures>
|
|
||||||
<filteredResources>
|
|
||||||
<filter>
|
|
||||||
<id>1775119841750</id>
|
|
||||||
<name></name>
|
|
||||||
<type>30</type>
|
|
||||||
<matcher>
|
|
||||||
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
|
||||||
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
|
||||||
</matcher>
|
|
||||||
</filter>
|
|
||||||
</filteredResources>
|
|
||||||
</projectDescription>
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
arguments=--init-script /home/alex/.cache/opencode/bin/jdtls/config_linux/org.eclipse.osgi/58/0/.cp/gradle/init/init.gradle
|
|
||||||
auto.sync=false
|
|
||||||
build.scans.enabled=false
|
|
||||||
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
|
|
||||||
connection.project.dir=
|
|
||||||
eclipse.preferences.version=1
|
|
||||||
gradle.user.home=
|
|
||||||
java.home=/usr/lib/jvm/java-21-openjdk-amd64
|
|
||||||
jvm.arguments=
|
|
||||||
offline.mode=false
|
|
||||||
override.workspace.settings=true
|
|
||||||
show.console.view=true
|
|
||||||
show.executions.view=true
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21/"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
|
||||||
<classpathentry kind="output" path="bin/default"/>
|
|
||||||
</classpath>
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
/build/*
|
|
||||||
!/build/.npmkeep
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>app</name>
|
|
||||||
<comment>Project app created by Buildship.</comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
|
||||||
</natures>
|
|
||||||
<filteredResources>
|
|
||||||
<filter>
|
|
||||||
<id>1775119841776</id>
|
|
||||||
<name></name>
|
|
||||||
<type>30</type>
|
|
||||||
<matcher>
|
|
||||||
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
|
||||||
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
|
||||||
</matcher>
|
|
||||||
</filter>
|
|
||||||
</filteredResources>
|
|
||||||
</projectDescription>
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
connection.project.dir=..
|
|
||||||
eclipse.preferences.version=1
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
apply plugin: 'com.android.application'
|
|
||||||
|
|
||||||
def keystorePropertiesFile = rootProject.file("key.properties")
|
|
||||||
def keystoreProperties = new Properties()
|
|
||||||
if (keystorePropertiesFile.exists()) {
|
|
||||||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
namespace = "diy.shakespeare.app"
|
|
||||||
compileSdk = rootProject.ext.compileSdkVersion
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "diy.shakespeare.app"
|
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
||||||
versionCode 1
|
|
||||||
versionName "9.9.2"
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
aaptOptions {
|
|
||||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
|
||||||
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
|
|
||||||
ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
signingConfigs {
|
|
||||||
release {
|
|
||||||
if (keystorePropertiesFile.exists()) {
|
|
||||||
keyAlias keystoreProperties['keyAlias']
|
|
||||||
keyPassword keystoreProperties['keyPassword']
|
|
||||||
storeFile file(keystoreProperties['storeFile'])
|
|
||||||
storePassword keystoreProperties['storePassword']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
signingConfig signingConfigs.release
|
|
||||||
minifyEnabled true
|
|
||||||
shrinkResources true
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
flatDir{
|
|
||||||
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
|
||||||
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
||||||
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
|
|
||||||
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
|
|
||||||
implementation project(':capacitor-android')
|
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
|
||||||
testImplementation "junit:junit:$junitVersion"
|
|
||||||
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
||||||
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
||||||
implementation project(':capacitor-cordova-android-plugins')
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: 'capacitor.build.gradle'
|
|
||||||
|
|
||||||
try {
|
|
||||||
def servicesJSON = file('google-services.json')
|
|
||||||
if (servicesJSON.text) {
|
|
||||||
apply plugin: 'com.google.gms.google-services'
|
|
||||||
}
|
|
||||||
} catch(Exception e) {
|
|
||||||
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_21
|
|
||||||
targetCompatibility JavaVersion.VERSION_21
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
|
||||||
dependencies {
|
|
||||||
implementation project(':capacitor-app')
|
|
||||||
implementation project(':capacitor-status-bar')
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (hasProperty('postBuildExtras')) {
|
|
||||||
postBuildExtras()
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# Keep Capacitor classes (WebView JS bridge)
|
|
||||||
-keep class com.getcapacitor.** { *; }
|
|
||||||
-keep class diy.shakespeare.app.** { *; }
|
|
||||||
|
|
||||||
# Keep WebView JS interfaces
|
|
||||||
-keepclassmembers class * {
|
|
||||||
@android.webkit.JavascriptInterface <methods>;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Keep OkHttp (used by Capacitor)
|
|
||||||
-dontwarn okhttp3.**
|
|
||||||
-dontwarn okio.**
|
|
||||||
-keep class okhttp3.** { *; }
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package com.getcapacitor.myapp;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
import androidx.test.platform.app.InstrumentationRegistry;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instrumented test, which will execute on an Android device.
|
|
||||||
*
|
|
||||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
|
||||||
*/
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public class ExampleInstrumentedTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void useAppContext() throws Exception {
|
|
||||||
// Context of the app under test.
|
|
||||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
|
||||||
|
|
||||||
assertEquals("com.getcapacitor.app", appContext.getPackageName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@mipmap/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
|
||||||
android:supportsRtl="true"
|
|
||||||
android:theme="@style/AppTheme">
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation|density"
|
|
||||||
android:name=".MainActivity"
|
|
||||||
android:label="@string/title_activity_main"
|
|
||||||
android:theme="@style/AppTheme.NoActionBarLaunch"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:exported="true">
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<!-- Deep links: open shakespeare.diy URLs in the app -->
|
|
||||||
<intent-filter android:autoVerify="true">
|
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
|
||||||
<data android:scheme="https" android:host="shakespeare.diy" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<provider
|
|
||||||
android:name="androidx.core.content.FileProvider"
|
|
||||||
android:authorities="${applicationId}.fileprovider"
|
|
||||||
android:exported="false"
|
|
||||||
android:grantUriPermissions="true">
|
|
||||||
<meta-data
|
|
||||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
|
||||||
android:resource="@xml/file_paths"></meta-data>
|
|
||||||
</provider>
|
|
||||||
</application>
|
|
||||||
|
|
||||||
<!-- Permissions -->
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
||||||
</manifest>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package diy.shakespeare.app;
|
|
||||||
|
|
||||||
import com.getcapacitor.BridgeActivity;
|
|
||||||
|
|
||||||
public class MainActivity extends BridgeActivity {}
|
|
||||||
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 79 KiB |
@@ -1,82 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="108dp"
|
|
||||||
android:height="108dp"
|
|
||||||
android:viewportWidth="108"
|
|
||||||
android:viewportHeight="108">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Shakespeare theater masks logo from public/shakespeare.svg.
|
|
||||||
SVG viewBox is "0 0 128 128", with original colors preserved.
|
|
||||||
Scaled to ~55% and centered within the 108x108 viewport to fit
|
|
||||||
Android's adaptive icon safe zone (66% of 108dp).
|
|
||||||
-->
|
|
||||||
|
|
||||||
<group
|
|
||||||
android:translateX="24.3"
|
|
||||||
android:translateY="15.5"
|
|
||||||
android:scaleX="0.464"
|
|
||||||
android:scaleY="0.464">
|
|
||||||
|
|
||||||
<!-- Red beak right -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#F45125"
|
|
||||||
android:pathData="M110.28,61.32l2.63,8.84c0,0,7.24,-1.6,7.62,3.2c0.38,4.8,-6.77,8,-6.77,8l2.26,10.63 c0,0,7.9,-6.4,8,-15.61c0,0,0.66,-11.29,-6.11,-13.92C113.67,60.85,110.28,61.32,110.28,61.32z"/>
|
|
||||||
|
|
||||||
<!-- Red tail feathers -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#F45125"
|
|
||||||
android:pathData="M68.71,94.99c0,0,-11.1,-4.7,-16.46,1.98c-0.75,0.94,-1.41,1.88,-2.16,2.82 c-0.56,0.75,-1.13,1.5,-1.69,2.16c-0.47,0.56,-1.03,1.13,-1.69,1.5c-0.66,0.38,-1.32,0.66,-2.07,0.85c-0.94,0.19,-1.88,0.19,-2.82,0.09 c-1.32,-0.09,-2.63,-0.38,-3.95,-0.66c-0.47,-0.09,-0.85,-0.19,-1.22,-0.28c-0.09,0,-0.19,-0.09,-0.28,-0.09 s-0.19,-0.09,-0.28,-0.09c-0.38,0.09,0.19,0.75,0.38,0.94c0.28,0.28,0.56,0.66,0.85,0.94c0.85,0.75,1.69,1.5,2.73,1.98 c1.32,0.66,2.73,1.03,4.14,1.13c0.09,0,0.38,0,0.47,0.09c0.19,0.19,-0.28,0.47,-0.47,0.56c-0.28,0.19,-0.47,0.28,-0.75,0.38 c-0.85,0.38,-1.79,0.56,-2.63,0.75c-0.85,0.19,-1.69,0.28,-2.45,0.28c-0.47,0,-0.85,0.09,-1.22,0.09c-0.28,0,-0.56,-0.09,-0.85,0 s0.09,0.47,0.28,0.56c0.38,0.19,0.75,0.47,1.13,0.66c1.13,0.56,2.26,1.03,3.39,1.32c1.5,0.38,3.1,0.56,4.61,0.38 c1.32,-0.19,2.63,-0.56,3.86,-1.03c6.77,-3.1,6.21,-9.59,12.42,-10.16c4.61,-0.38,11.1,2.07,11.1,2.07L68.71,94.99z"/>
|
|
||||||
|
|
||||||
<!-- Red beak left -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#F45125"
|
|
||||||
android:pathData="M19.79,38.28c0,0,-12.13,1.98,-15.24,12.79C0.61,64.9,20.26,69.5,20.26,69.5l1.22,-9.41 c0,0,-13.07,-1.32,-12.32,-6.3c0.94,-6.21,11.85,-5.64,11.85,-5.64L19.79,38.28z"/>
|
|
||||||
|
|
||||||
<!-- Red wing detail -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#F45125"
|
|
||||||
android:pathData="M20.73,70.92c0,0,-1.88,0.56,-4.61,2.54c-1.88,1.32,-4.42,3.01,-6.87,5.93 c-1.22,1.41,-2.16,3.1,-2.82,4.89c-0.47,1.22,-0.66,2.45,-0.66,3.76c0,0.28,0,0.56,0,0.85c0,0.09,0,0.85,0.28,0.66 c0.09,-0.09,0.19,-0.38,0.28,-0.47c0.19,-0.47,0.47,-0.85,0.75,-1.22c0.85,-1.13,1.88,-2.16,3.01,-3.01c0.38,-0.28,0.75,-0.47,1.13,-0.66 c0.28,-0.28,0.75,-0.66,0.94,-0.28c0.09,0.19,-0.09,0.47,-0.19,0.66c-0.09,0.28,-0.19,0.66,-0.19,0.94c-0.38,1.5,-0.56,3.01,-0.75,4.51 c-0.09,0.85,-0.09,1.69,0,2.45c0,0.38,0.09,0.85,0.09,1.22c0,0.19,0.09,0.38,0.09,0.56c0,0.19,0.19,0.47,0.38,0.19 c0.09,-0.09,0.09,-0.19,0.19,-0.38c0.19,-0.28,0.28,-0.66,0.47,-0.94c0.47,-0.85,0.94,-1.69,1.5,-2.63c0.66,-1.13,1.41,-2.16,2.16,-3.1 c0.85,-1.13,1.88,-2.26,2.92,-3.2c1.13,-1.03,2.35,-2.07,3.67,-2.92c0.75,-0.47,1.6,-0.94,2.45,-1.32L20.73,70.92z"/>
|
|
||||||
|
|
||||||
<!-- Yellow body -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#FCC21B"
|
|
||||||
android:pathData="M116.4,79.29c-1.13,-5.55,-2.73,-11.01,-4.51,-16.46c-1.5,-4.61,-3.1,-9.31,-5.83,-13.36 c-1.22,-1.79,-3.01,-3.01,-5.27,-3.86c-4.33,-1.69,-9.97,-1.98,-13.73,-1.98c-5.64,0,-11.48,1.22,-16.74,3.67 c-1.88,5.64,-7.05,19.94,-14.86,26.34c0.47,2.63,1.03,5.36,1.79,8c1.32,4.61,3.01,9.22,4.61,13.83c1.5,4.42,3.29,8.84,6.58,12.23 c0.85,0.94,1.88,1.69,2.82,2.45c2.26,1.88,4.99,3.01,7.71,3.95c2.54,0.85,5.17,1.5,7.81,2.07c4.7,1.03,11.48,2.82,16.08,0.66 c2.54,-1.13,4.61,-2.92,6.3,-5.08c1.79,-2.26,3.2,-4.8,4.42,-7.43c1.88,-3.95,3.86,-8.37,4.14,-12.89 C117.99,87.38,117.24,83.24,116.4,79.29z"/>
|
|
||||||
|
|
||||||
<!-- Blue head -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#429ADF"
|
|
||||||
android:pathData="M77.64,33.57c-0.28,-1.03,-1.03,-2.07,-1.6,-3.01c-6.3,-11.01,-20.04,-16.27,-32.26,-15.52 c-3.76,0.28,-9.31,0.85,-13.54,2.73c-2.07,0.94,-3.86,2.35,-4.99,4.14c-2.54,4.23,-3.76,8.94,-5.08,13.64 C18.67,41,17.35,46.55,16.5,52.2c-0.75,4.89,-1.41,10.25,-0.09,15.14c1.03,3.86,3.29,9.22,5.74,12.32 c2.73,3.39,6.58,7.34,10.72,8.84c0.75,0.28,1.6,0.47,2.45,0.66c1.6,0.28,3.29,0.47,4.89,0.19c0.94,-0.19,1.98,-0.28,2.92,-0.56 c1.88,-0.47,3.67,-1.13,5.46,-1.79c7.52,-3.01,13.64,-7.43,17.68,-14.58c1.69,-3.1,3.1,-6.4,4.42,-9.69c0.09,-0.19,0.19,-0.38,0.19,-0.56 c1.98,-5.46,3.29,-11.19,4.61,-16.84c0.66,-2.73,1.41,-5.55,1.79,-8.37C77.55,35.92,77.92,34.7,77.64,33.57z"/>
|
|
||||||
|
|
||||||
<!-- Dark eye band -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#193D51"
|
|
||||||
android:pathData="M23.09,40.53c1.69,-3.1,5.74,-5.55,9.31,-5.08c0.56,0.09,1.22,0.19,1.79,0.47 c3.57,1.5,5.74,4.99,4.89,8.56c-0.19,0.75,-0.66,0.85,-1.22,0.38c-1.98,-1.69,-3.57,-3.01,-6.21,-3.67c-2.16,-0.56,-4.61,-0.28,-6.68,0.28 c-0.47,0.09,-1.22,0.56,-1.69,0.38C22.61,41.57,22.9,40.91,23.09,40.53z"/>
|
|
||||||
|
|
||||||
<!-- Dark mouth/chin -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#193D51"
|
|
||||||
android:pathData="M62.21,64.9c-1.03,1.6,-2.45,3.01,-3.86,4.33c-0.38,0.28,-0.66,0.66,-1.03,0.94 c-5.64,4.7,-13.26,7.05,-20.51,5.27c-1.98,-0.47,-4.14,-1.5,-5.74,-2.73c-1.22,-0.94,-2.45,-2.16,-3.48,-3.39c-1.88,-2.26,-3.29,-4.89,-4.23,-7.62 c-0.47,-1.41,-0.75,-2.73,-0.94,-4.23c0,-0.47,-0.66,-5.46,0.85,-4.8c0.38,0.19,0.66,0.47,0.94,0.75c0.28,0.38,0.47,0.75,0.75,1.03 c0.66,0.85,1.32,1.69,2.07,2.45c2.35,2.73,5.27,4.89,8.56,6.4c2.26,1.03,4.7,1.6,7.15,1.79c1.41,0.09,2.73,0.19,4.14,0.09 c5.08,-0.28,10.25,-1.79,14.86,-3.76c0.38,-0.19,0.85,-0.47,1.32,-0.47C64.66,61.04,62.5,64.52,62.21,64.9z"/>
|
|
||||||
|
|
||||||
<!-- Dark eye detail -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#193D51"
|
|
||||||
android:pathData="M67.58,51.16c0,0.47,-0.19,1.13,-0.75,1.03c-0.47,-0.09,-0.85,-0.94,-1.13,-1.22 c-1.32,-1.69,-3.86,-3.57,-6.4,-4.14c-3.01,-0.75,-5.27,0.56,-8.28,0.85c-0.85,0.09,-1.32,-0.28,-0.94,-1.03c1.6,-3.48,5.83,-6.21,10.25,-5.46 c0.75,0.09,1.41,0.28,2.07,0.56C66.26,43.36,67.86,47.59,67.58,51.16z"/>
|
|
||||||
|
|
||||||
<!-- Gold eye detail -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#9B7515"
|
|
||||||
android:pathData="M91.84,63.86c4.23,2.73,9.69,3.48,14.58,3.2c1.41,-0.09,2.26,0.09,1.88,1.69 c-0.75,3.29,-3.86,5.17,-6.87,5.83c-0.75,0.19,-1.5,0.19,-2.26,0.19c-1.41,-0.09,-2.82,-0.66,-4.04,-1.5c-2.63,-1.79,-4.61,-4.89,-5.17,-8 C89.68,63.67,90.25,62.83,91.84,63.86z"/>
|
|
||||||
|
|
||||||
<!-- Gold mouth detail -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#9B7515"
|
|
||||||
android:pathData="M65.22,80.79C64,79.57,64.66,79,65.98,78.25c4.51,-2.35,9.03,-5.93,11.38,-10.63 c0.85,-1.79,1.79,-1.41,2.45,0.28c1.13,3.1,1.03,6.87,-0.38,9.88c-0.66,1.41,-1.6,2.63,-2.82,3.57c-0.66,0.47,-1.32,0.75,-2.07,1.03 C71.43,83.33,67.58,83.24,65.22,80.79z"/>
|
|
||||||
|
|
||||||
<!-- Gold chin/jaw detail -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#9B7515"
|
|
||||||
android:pathData="M110,96.41c-0.38,0,-0.94,-0.38,-1.41,-0.66c-0.47,-0.28,-0.94,-0.66,-1.22,-0.85 c-1.13,-0.56,-2.45,-1.13,-3.67,-1.5c-3.76,-1.22,-7.9,-1.22,-11.57,0c-2.63,0.85,-5.17,2.45,-7.24,4.33c-2.26,2.16,-3.95,4.8,-6.11,7.05 c-0.28,0.28,-0.56,0.56,-0.85,0.75c-0.56,0.28,-1.13,-0.09,-1.32,-0.66c-0.94,-3.95,1.69,-9.5,3.67,-12.89c2.26,-3.76,5.55,-6.77,9.78,-8 c2.07,-0.66,4.33,-0.66,6.49,-0.38c6.3,0.94,12.79,5.93,14.02,11.66C110.56,95.75,110.47,96.5,110,96.41z"/>
|
|
||||||
|
|
||||||
</group>
|
|
||||||
|
|
||||||
</vector>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="108dp"
|
|
||||||
android:height="108dp"
|
|
||||||
android:viewportHeight="108"
|
|
||||||
android:viewportWidth="108">
|
|
||||||
<path
|
|
||||||
android:fillColor="#2b0037"
|
|
||||||
android:pathData="M0,0h108v108h-108z" />
|
|
||||||
</vector>
|
|
||||||
|
Before Width: | Height: | Size: 15 KiB |
@@ -1,53 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="240dp"
|
|
||||||
android:height="240dp"
|
|
||||||
android:viewportWidth="1200"
|
|
||||||
android:viewportHeight="1200">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Android 12 splash screen masks the icon to a circle at 2/3 of canvas (160dp of 240dp).
|
|
||||||
The Shakespeare logo SVG has viewBox="0 0 128 128".
|
|
||||||
We scale the 128x128 logo to fit ~800x800 in the center of 1200x1200,
|
|
||||||
leaving ~200px padding on each side for the circular safe zone.
|
|
||||||
Scale factor: 800/128 = 6.25. Translate: (200, 200) to shift origin.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<group
|
|
||||||
android:translateX="200"
|
|
||||||
android:translateY="200"
|
|
||||||
android:scaleX="6.25"
|
|
||||||
android:scaleY="6.25">
|
|
||||||
|
|
||||||
<!-- Red beak right -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M110.28,61.32l2.63,8.84c0,0,7.24,-1.6,7.62,3.2c0.38,4.8,-6.77,8,-6.77,8l2.26,10.63 c0,0,7.9,-6.4,8,-15.61c0,0,0.66,-11.29,-6.11,-13.92C113.67,60.85,110.28,61.32,110.28,61.32z"/>
|
|
||||||
|
|
||||||
<!-- Red tail feathers -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M68.71,94.99c0,0,-11.1,-4.7,-16.46,1.98c-0.75,0.94,-1.41,1.88,-2.16,2.82 c-0.56,0.75,-1.13,1.5,-1.69,2.16c-0.47,0.56,-1.03,1.13,-1.69,1.5c-0.66,0.38,-1.32,0.66,-2.07,0.85c-0.94,0.19,-1.88,0.19,-2.82,0.09 c-1.32,-0.09,-2.63,-0.38,-3.95,-0.66c-0.47,-0.09,-0.85,-0.19,-1.22,-0.28c-0.09,0,-0.19,-0.09,-0.28,-0.09 s-0.19,-0.09,-0.28,-0.09c-0.38,0.09,0.19,0.75,0.38,0.94c0.28,0.28,0.56,0.66,0.85,0.94c0.85,0.75,1.69,1.5,2.73,1.98 c1.32,0.66,2.73,1.03,4.14,1.13c0.09,0,0.38,0,0.47,0.09c0.19,0.19,-0.28,0.47,-0.47,0.56c-0.28,0.19,-0.47,0.28,-0.75,0.38 c-0.85,0.38,-1.79,0.56,-2.63,0.75c-0.85,0.19,-1.69,0.28,-2.45,0.28c-0.47,0,-0.85,0.09,-1.22,0.09c-0.28,0,-0.56,-0.09,-0.85,0 s0.09,0.47,0.28,0.56c0.38,0.19,0.75,0.47,1.13,0.66c1.13,0.56,2.26,1.03,3.39,1.32c1.5,0.38,3.1,0.56,4.61,0.38 c1.32,-0.19,2.63,-0.56,3.86,-1.03c6.77,-3.1,6.21,-9.59,12.42,-10.16c4.61,-0.38,11.1,2.07,11.1,2.07L68.71,94.99z"/>
|
|
||||||
|
|
||||||
<!-- Red beak left -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M19.79,38.28c0,0,-12.13,1.98,-15.24,12.79C0.61,64.9,20.26,69.5,20.26,69.5l1.22,-9.41 c0,0,-13.07,-1.32,-12.32,-6.3c0.94,-6.21,11.85,-5.64,11.85,-5.64L19.79,38.28z"/>
|
|
||||||
|
|
||||||
<!-- Red wing detail -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M20.73,70.92c0,0,-1.88,0.56,-4.61,2.54c-1.88,1.32,-4.42,3.01,-6.87,5.93 c-1.22,1.41,-2.16,3.1,-2.82,4.89c-0.47,1.22,-0.66,2.45,-0.66,3.76c0,0.28,0,0.56,0,0.85c0,0.09,0,0.85,0.28,0.66 c0.09,-0.09,0.19,-0.38,0.28,-0.47c0.19,-0.47,0.47,-0.85,0.75,-1.22c0.85,-1.13,1.88,-2.16,3.01,-3.01c0.38,-0.28,0.75,-0.47,1.13,-0.66 c0.28,-0.28,0.75,-0.66,0.94,-0.28c0.09,0.19,-0.09,0.47,-0.19,0.66c-0.09,0.28,-0.19,0.66,-0.19,0.94c-0.38,1.5,-0.56,3.01,-0.75,4.51 c-0.09,0.85,-0.09,1.69,0,2.45c0,0.38,0.09,0.85,0.09,1.22c0,0.19,0.09,0.38,0.09,0.56c0,0.19,0.19,0.47,0.38,0.19 c0.09,-0.09,0.09,-0.19,0.19,-0.38c0.19,-0.28,0.28,-0.66,0.47,-0.94c0.47,-0.85,0.94,-1.69,1.5,-2.63c0.66,-1.13,1.41,-2.16,2.16,-3.1 c0.85,-1.13,1.88,-2.26,2.92,-3.2c1.13,-1.03,2.35,-2.07,3.67,-2.92c0.75,-0.47,1.6,-0.94,2.45,-1.32L20.73,70.92z"/>
|
|
||||||
|
|
||||||
<!-- Yellow body -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M116.4,79.29c-1.13,-5.55,-2.73,-11.01,-4.51,-16.46c-1.5,-4.61,-3.1,-9.31,-5.83,-13.36 c-1.22,-1.79,-3.01,-3.01,-5.27,-3.86c-4.33,-1.69,-9.97,-1.98,-13.73,-1.98c-5.64,0,-11.48,1.22,-16.74,3.67 c-1.88,5.64,-7.05,19.94,-14.86,26.34c0.47,2.63,1.03,5.36,1.79,8c1.32,4.61,3.01,9.22,4.61,13.83c1.5,4.42,3.29,8.84,6.58,12.23 c0.85,0.94,1.88,1.69,2.82,2.45c2.26,1.88,4.99,3.01,7.71,3.95c2.54,0.85,5.17,1.5,7.81,2.07c4.7,1.03,11.48,2.82,16.08,0.66 c2.54,-1.13,4.61,-2.92,6.3,-5.08c1.79,-2.26,3.2,-4.8,4.42,-7.43c1.88,-3.95,3.86,-8.37,4.14,-12.89 C117.99,87.38,117.24,83.24,116.4,79.29z"/>
|
|
||||||
|
|
||||||
<!-- Blue head -->
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M77.64,33.57c-0.28,-1.03,-1.03,-2.07,-1.6,-3.01c-6.3,-11.01,-20.04,-16.27,-32.26,-15.52 c-3.76,0.28,-9.31,0.85,-13.54,2.73c-2.07,0.94,-3.86,2.35,-4.99,4.14c-2.54,4.23,-3.76,8.94,-5.08,13.64 C18.67,41,17.35,46.55,16.5,52.2c-0.75,4.89,-1.41,10.25,-0.09,15.14c1.03,3.86,3.29,9.22,5.74,12.32 c2.73,3.39,6.58,7.34,10.72,8.84c0.75,0.28,1.6,0.47,2.45,0.66c1.6,0.28,3.29,0.47,4.89,0.19c0.94,-0.19,1.98,-0.28,2.92,-0.56 c1.88,-0.47,3.67,-1.13,5.46,-1.79c7.52,-3.01,13.64,-7.43,17.68,-14.58c1.69,-3.1,3.1,-6.4,4.42,-9.69c0.09,-0.19,0.19,-0.38,0.19,-0.56 c1.98,-5.46,3.29,-11.19,4.61,-16.84c0.66,-2.73,1.41,-5.55,1.79,-8.37C77.55,35.92,77.92,34.7,77.64,33.57z"/>
|
|
||||||
|
|
||||||
</group>
|
|
||||||
|
|
||||||
</vector>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context=".MainActivity">
|
|
||||||
|
|
||||||
<WebView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@color/ic_launcher_background"/>
|
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
|
||||||
</adaptive-icon>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@color/ic_launcher_background"/>
|
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
|
||||||
</adaptive-icon>
|
|
||||||
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 20 KiB |
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="ic_launcher_background">#2b0037</color>
|
|
||||||
</resources>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<resources>
|
|
||||||
<string name="app_name">Shakespeare</string>
|
|
||||||
<string name="title_activity_main">Shakespeare</string>
|
|
||||||
<string name="package_name">diy.shakespeare.app</string>
|
|
||||||
<string name="custom_url_scheme">diy.shakespeare.app</string>
|
|
||||||
</resources>
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
|
||||||
<!-- Customize your theme here. -->
|
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
|
|
||||||
<item name="windowActionBar">false</item>
|
|
||||||
<item name="windowNoTitle">true</item>
|
|
||||||
<item name="android:background">@null</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
|
|
||||||
<item name="windowSplashScreenBackground">#2b0037</item>
|
|
||||||
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon_vector</item>
|
|
||||||
<item name="postSplashScreenTheme">@style/AppTheme.NoActionBar</item>
|
|
||||||
</style>
|
|
||||||
</resources>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<external-path name="my_images" path="." />
|
|
||||||
<cache-path name="my_cache_images" path="." />
|
|
||||||
</paths>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.getcapacitor.myapp;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Example local unit test, which will execute on the development machine (host).
|
|
||||||
*
|
|
||||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
|
||||||
*/
|
|
||||||
public class ExampleUnitTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void addition_isCorrect() throws Exception {
|
|
||||||
assertEquals(4, 2 + 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:8.13.0'
|
|
||||||
classpath 'com.google.gms:google-services:4.4.4'
|
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
|
||||||
// in the individual module build.gradle files
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: "variables.gradle"
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task clean(type: Delete) {
|
|
||||||
delete rootProject.buildDir
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
|
|
||||||
include ':capacitor-android'
|
|
||||||
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
|
|
||||||
|
|
||||||
include ':capacitor-app'
|
|
||||||
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android')
|
|
||||||
|
|
||||||
include ':capacitor-status-bar'
|
|
||||||
project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android')
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
# Project-wide Gradle settings.
|
|
||||||
|
|
||||||
# IDE (e.g. Android Studio) users:
|
|
||||||
# Gradle settings configured through the IDE *will override*
|
|
||||||
# any settings specified in this file.
|
|
||||||
|
|
||||||
# For more details on how to configure your build environment visit
|
|
||||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
|
||||||
|
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
|
||||||
org.gradle.jvmargs=-Xmx1536m
|
|
||||||
|
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
|
||||||
# org.gradle.parallel=true
|
|
||||||
|
|
||||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
|
||||||
# Android operating system, and which are packaged with your app's APK
|
|
||||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
|
||||||
android.useAndroidX=true
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip
|
|
||||||
networkTimeout=10000
|
|
||||||
validateDistributionUrl=true
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
||||||
@@ -1,251 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright © 2015-2021 the original authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
#
|
|
||||||
# Gradle start up script for POSIX generated by Gradle.
|
|
||||||
#
|
|
||||||
# Important for running:
|
|
||||||
#
|
|
||||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
|
||||||
# noncompliant, but you have some other compliant shell such as ksh or
|
|
||||||
# bash, then to run this script, type that shell name before the whole
|
|
||||||
# command line, like:
|
|
||||||
#
|
|
||||||
# ksh Gradle
|
|
||||||
#
|
|
||||||
# Busybox and similar reduced shells will NOT work, because this script
|
|
||||||
# requires all of these POSIX shell features:
|
|
||||||
# * functions;
|
|
||||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
|
||||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
|
||||||
# * compound commands having a testable exit status, especially «case»;
|
|
||||||
# * various built-in commands including «command», «set», and «ulimit».
|
|
||||||
#
|
|
||||||
# Important for patching:
|
|
||||||
#
|
|
||||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
|
||||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
|
||||||
#
|
|
||||||
# The "traditional" practice of packing multiple parameters into a
|
|
||||||
# space-separated string is a well documented source of bugs and security
|
|
||||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
|
||||||
# options in "$@", and eventually passing that to Java.
|
|
||||||
#
|
|
||||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
|
||||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
|
||||||
# see the in-line comments for details.
|
|
||||||
#
|
|
||||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
|
||||||
# Darwin, MinGW, and NonStop.
|
|
||||||
#
|
|
||||||
# (3) This script is generated from the Groovy template
|
|
||||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
|
||||||
# within the Gradle project.
|
|
||||||
#
|
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
app_path=$0
|
|
||||||
|
|
||||||
# Need this for daisy-chained symlinks.
|
|
||||||
while
|
|
||||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
|
||||||
[ -h "$app_path" ]
|
|
||||||
do
|
|
||||||
ls=$( ls -ld "$app_path" )
|
|
||||||
link=${ls#*' -> '}
|
|
||||||
case $link in #(
|
|
||||||
/*) app_path=$link ;; #(
|
|
||||||
*) app_path=$APP_HOME$link ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# This is normally unused
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
APP_BASE_NAME=${0##*/}
|
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
|
||||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
||||||
MAX_FD=maximum
|
|
||||||
|
|
||||||
warn () {
|
|
||||||
echo "$*"
|
|
||||||
} >&2
|
|
||||||
|
|
||||||
die () {
|
|
||||||
echo
|
|
||||||
echo "$*"
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
} >&2
|
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
|
||||||
cygwin=false
|
|
||||||
msys=false
|
|
||||||
darwin=false
|
|
||||||
nonstop=false
|
|
||||||
case "$( uname )" in #(
|
|
||||||
CYGWIN* ) cygwin=true ;; #(
|
|
||||||
Darwin* ) darwin=true ;; #(
|
|
||||||
MSYS* | MINGW* ) msys=true ;; #(
|
|
||||||
NONSTOP* ) nonstop=true ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
CLASSPATH="\\\"\\\""
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
|
||||||
else
|
|
||||||
JAVACMD=$JAVA_HOME/bin/java
|
|
||||||
fi
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD=java
|
|
||||||
if ! command -v java >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
||||||
case $MAX_FD in #(
|
|
||||||
max*)
|
|
||||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
|
||||||
# shellcheck disable=SC2039,SC3045
|
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
|
||||||
warn "Could not query maximum file descriptor limit"
|
|
||||||
esac
|
|
||||||
case $MAX_FD in #(
|
|
||||||
'' | soft) :;; #(
|
|
||||||
*)
|
|
||||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
|
||||||
# shellcheck disable=SC2039,SC3045
|
|
||||||
ulimit -n "$MAX_FD" ||
|
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Collect all arguments for the java command, stacking in reverse order:
|
|
||||||
# * args from the command line
|
|
||||||
# * the main class name
|
|
||||||
# * -classpath
|
|
||||||
# * -D...appname settings
|
|
||||||
# * --module-path (only if needed)
|
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if "$cygwin" || "$msys" ; then
|
|
||||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
|
||||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
|
||||||
|
|
||||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
|
||||||
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
for arg do
|
|
||||||
if
|
|
||||||
case $arg in #(
|
|
||||||
-*) false ;; # don't mess with options #(
|
|
||||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
|
||||||
[ -e "$t" ] ;; #(
|
|
||||||
*) false ;;
|
|
||||||
esac
|
|
||||||
then
|
|
||||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
|
||||||
fi
|
|
||||||
# Roll the args list around exactly as many times as the number of
|
|
||||||
# args, so each arg winds up back in the position where it started, but
|
|
||||||
# possibly modified.
|
|
||||||
#
|
|
||||||
# NB: a `for` loop captures its iteration list before it begins, so
|
|
||||||
# changing the positional parameters here affects neither the number of
|
|
||||||
# iterations, nor the values presented in `arg`.
|
|
||||||
shift # remove old arg
|
|
||||||
set -- "$@" "$arg" # push replacement arg
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Collect all arguments for the java command:
|
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
|
||||||
# and any embedded shellness will be escaped.
|
|
||||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
|
||||||
# treated as '${Hostname}' itself on the command line.
|
|
||||||
|
|
||||||
set -- \
|
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
|
||||||
-classpath "$CLASSPATH" \
|
|
||||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
|
||||||
"$@"
|
|
||||||
|
|
||||||
# Stop when "xargs" is not available.
|
|
||||||
if ! command -v xargs >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
die "xargs is not available"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
|
||||||
#
|
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
|
||||||
#
|
|
||||||
# In Bash we could simply go:
|
|
||||||
#
|
|
||||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
|
||||||
# set -- "${ARGS[@]}" "$@"
|
|
||||||
#
|
|
||||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
|
||||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
|
||||||
# character that might be a shell metacharacter, then use eval to reverse
|
|
||||||
# that process (while maintaining the separation between arguments), and wrap
|
|
||||||
# the whole thing up as a single "set" statement.
|
|
||||||
#
|
|
||||||
# This will of course break if any of these variables contains a newline or
|
|
||||||
# an unmatched quote.
|
|
||||||
#
|
|
||||||
|
|
||||||
eval "set -- $(
|
|
||||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
|
||||||
xargs -n1 |
|
|
||||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
|
||||||
tr '\n' ' '
|
|
||||||
)" '"$@"'
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
@rem
|
|
||||||
@rem Copyright 2015 the original author or authors.
|
|
||||||
@rem
|
|
||||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
@rem you may not use this file except in compliance with the License.
|
|
||||||
@rem You may obtain a copy of the License at
|
|
||||||
@rem
|
|
||||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
@rem
|
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
@rem See the License for the specific language governing permissions and
|
|
||||||
@rem limitations under the License.
|
|
||||||
@rem
|
|
||||||
@rem SPDX-License-Identifier: Apache-2.0
|
|
||||||
@rem
|
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
|
||||||
@rem ##########################################################################
|
|
||||||
@rem
|
|
||||||
@rem Gradle startup script for Windows
|
|
||||||
@rem
|
|
||||||
@rem ##########################################################################
|
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
|
||||||
if "%DIRNAME%"=="" set DIRNAME=.
|
|
||||||
@rem This is normally unused
|
|
||||||
set APP_BASE_NAME=%~n0
|
|
||||||
set APP_HOME=%DIRNAME%
|
|
||||||
|
|
||||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
||||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
||||||
|
|
||||||
@rem Find java.exe
|
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
|
||||||
if %ERRORLEVEL% equ 0 goto execute
|
|
||||||
|
|
||||||
echo. 1>&2
|
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
|
||||||
echo. 1>&2
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
||||||
echo location of your Java installation. 1>&2
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
|
||||||
|
|
||||||
echo. 1>&2
|
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
|
||||||
echo. 1>&2
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
||||||
echo location of your Java installation. 1>&2
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:execute
|
|
||||||
@rem Setup the command line
|
|
||||||
|
|
||||||
set CLASSPATH=
|
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
|
||||||
|
|
||||||
:end
|
|
||||||
@rem End local scope for the variables with windows NT shell
|
|
||||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
|
||||||
|
|
||||||
:fail
|
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
||||||
rem the _cmd.exe /c_ return code!
|
|
||||||
set EXIT_CODE=%ERRORLEVEL%
|
|
||||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
|
||||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
|
||||||
exit /b %EXIT_CODE%
|
|
||||||
|
|
||||||
:mainEnd
|
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
|
||||||
|
|
||||||
:omega
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
include ':app'
|
|
||||||
include ':capacitor-cordova-android-plugins'
|
|
||||||
project(':capacitor-cordova-android-plugins').projectDir = new File('./capacitor-cordova-android-plugins/')
|
|
||||||
|
|
||||||
apply from: 'capacitor.settings.gradle'
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
ext {
|
|
||||||
minSdkVersion = 24
|
|
||||||
compileSdkVersion = 36
|
|
||||||
targetSdkVersion = 36
|
|
||||||
androidxActivityVersion = '1.11.0'
|
|
||||||
androidxAppCompatVersion = '1.7.1'
|
|
||||||
androidxCoordinatorLayoutVersion = '1.3.0'
|
|
||||||
androidxCoreVersion = '1.17.0'
|
|
||||||
androidxFragmentVersion = '1.8.9'
|
|
||||||
coreSplashScreenVersion = '1.2.0'
|
|
||||||
androidxWebkitVersion = '1.14.0'
|
|
||||||
junitVersion = '4.13.2'
|
|
||||||
androidxJunitVersion = '1.3.0'
|
|
||||||
androidxEspressoCoreVersion = '3.7.0'
|
|
||||||
cordovaAndroidVersion = '14.0.1'
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
import type { CapacitorConfig } from '@capacitor/cli';
|
|
||||||
|
|
||||||
const config: CapacitorConfig = {
|
|
||||||
appId: 'diy.shakespeare.app',
|
|
||||||
appName: 'Shakespeare',
|
|
||||||
webDir: 'dist',
|
|
||||||
server: {
|
|
||||||
// Handle deep links from your domain
|
|
||||||
hostname: 'shakespeare.diy',
|
|
||||||
androidScheme: 'https',
|
|
||||||
iosScheme: 'https'
|
|
||||||
},
|
|
||||||
android: {
|
|
||||||
// Enable safe area handling for notches and navigation bars
|
|
||||||
allowMixedContent: false,
|
|
||||||
backgroundColor: '#2b0037'
|
|
||||||
},
|
|
||||||
ios: {
|
|
||||||
backgroundColor: '#2b0037',
|
|
||||||
contentInset: 'automatic',
|
|
||||||
scheme: 'Shakespeare'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default config;
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"description": "Build custom apps with AI assistance using Shakespeare, an open-source development environment",
|
"description": "Build custom apps with AI assistance using Shakespeare, an open-source development environment",
|
||||||
"homepage": "https://shakespeare.diy",
|
"homepage": "https://shakespeare.diy",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"version": "9.10.3",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "shakespeare.diy",
|
"name": "shakespeare.diy",
|
||||||
@@ -17,27 +17,21 @@
|
|||||||
"dev": "npm i --silent && vite",
|
"dev": "npm i --silent && vite",
|
||||||
"build": "npm i --silent && vite build -l error && cp dist/index.html dist/404.html && echo 'Project built successfully!'",
|
"build": "npm i --silent && vite build -l error && cp dist/index.html dist/404.html && echo 'Project built successfully!'",
|
||||||
"typecheck": "npm i --silent && tsc --noEmit",
|
"typecheck": "npm i --silent && tsc --noEmit",
|
||||||
"test": "npm i --silent && eslint && vitest run --reporter=dot --silent && echo 'All tests passed!'",
|
"test": "npm i --silent && eslint && vitest run --reporter=dot --silent && echo 'All tests passed!'"
|
||||||
"keygen": "keytool -genkey -v -keystore android/app/my-upload-key.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias upload",
|
|
||||||
"icons": "bash scripts/generate-icons.sh"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@capacitor/app": "^8.1.0",
|
|
||||||
"@capacitor/core": "^8.3.0",
|
|
||||||
"@capacitor/status-bar": "^8.0.2",
|
|
||||||
"@dnd-kit/core": "^6.3.1",
|
"@dnd-kit/core": "^6.3.1",
|
||||||
"@dnd-kit/sortable": "^10.0.0",
|
"@dnd-kit/sortable": "^10.0.0",
|
||||||
"@dnd-kit/utilities": "^3.2.2",
|
"@dnd-kit/utilities": "^3.2.2",
|
||||||
"@fontsource-variable/inter": "^5.2.6",
|
"@fontsource-variable/inter": "^5.2.6",
|
||||||
"@getalby/sdk": "^6.0.1",
|
"@getalby/sdk": "^6.0.1",
|
||||||
"@hookform/resolvers": "^5.2.2",
|
"@hookform/resolvers": "^3.9.0",
|
||||||
"@isomorphic-git/lightning-fs": "^4.6.2",
|
"@isomorphic-git/lightning-fs": "^4.6.2",
|
||||||
"@modelcontextprotocol/sdk": "^1.22.0",
|
"@modelcontextprotocol/sdk": "^1.22.0",
|
||||||
"@mozilla/readability": "^0.6.0",
|
"@mozilla/readability": "^0.6.0",
|
||||||
"@nostrify/nostrify": "^0.49.2",
|
"@nostrify/nostrify": "^0.48.2",
|
||||||
"@nostrify/react": "^0.2.24",
|
"@nostrify/react": "^0.2.20",
|
||||||
"@opensecret/react": "^1.5.4",
|
"@opensecret/react": "^1.5.4",
|
||||||
"@plausible-analytics/tracker": "^0.4.4",
|
|
||||||
"@radix-ui/react-accordion": "^1.2.0",
|
"@radix-ui/react-accordion": "^1.2.0",
|
||||||
"@radix-ui/react-alert-dialog": "^1.1.1",
|
"@radix-ui/react-alert-dialog": "^1.1.1",
|
||||||
"@radix-ui/react-aspect-ratio": "^1.1.0",
|
"@radix-ui/react-aspect-ratio": "^1.1.0",
|
||||||
@@ -88,7 +82,7 @@
|
|||||||
"mime": "^4.1.0",
|
"mime": "^4.1.0",
|
||||||
"nostr-tools": "^2.15.2",
|
"nostr-tools": "^2.15.2",
|
||||||
"nunjucks": "^3.2.4",
|
"nunjucks": "^3.2.4",
|
||||||
"openai": "^6.16.0",
|
"openai": "^5.15.0",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"prismjs": "^1.30.0",
|
"prismjs": "^1.30.0",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
@@ -96,7 +90,7 @@
|
|||||||
"react-day-picker": "^8.10.1",
|
"react-day-picker": "^8.10.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-error-boundary": "^6.0.0",
|
"react-error-boundary": "^6.0.0",
|
||||||
"react-hook-form": "^7.71.1",
|
"react-hook-form": "^7.53.0",
|
||||||
"react-i18next": "^15.7.3",
|
"react-i18next": "^15.7.3",
|
||||||
"react-markdown": "^10.1.0",
|
"react-markdown": "^10.1.0",
|
||||||
"react-resizable-panels": "^3.0.3",
|
"react-resizable-panels": "^3.0.3",
|
||||||
@@ -113,11 +107,9 @@
|
|||||||
"vaul": "^0.9.3",
|
"vaul": "^0.9.3",
|
||||||
"webln": "^0.3.2",
|
"webln": "^0.3.2",
|
||||||
"workbox-window": "^7.3.0",
|
"workbox-window": "^7.3.0",
|
||||||
"zod": "^4.3.6"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@capacitor/android": "^8.3.0",
|
|
||||||
"@capacitor/cli": "^8.3.0",
|
|
||||||
"@eslint/js": "^9.9.0",
|
"@eslint/js": "^9.9.0",
|
||||||
"@html-eslint/eslint-plugin": "^0.41.0",
|
"@html-eslint/eslint-plugin": "^0.41.0",
|
||||||
"@html-eslint/parser": "^0.41.0",
|
"@html-eslint/parser": "^0.41.0",
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
## [9.10.3] - 2026-04-02
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Fix Android app showing default Capacitor splash screen and icon colors
|
|
||||||
|
|
||||||
## [9.10.2] - 2026-04-02
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Fix Android app showing default Capacitor icon instead of Shakespeare logo in app drawer
|
|
||||||
|
|
||||||
## [9.10.1] - 2026-04-02
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Replace default Capacitor vector drawable icons with Shakespeare logo
|
|
||||||
|
|
||||||
## [9.10.0] - 2026-04-02
|
|
||||||
|
|
||||||
### Added
|
|
||||||
- Android app powered by Capacitor with deep links, splash screen, and signed release builds
|
|
||||||
- CI pipeline for building APKs, publishing to GitLab releases, and distributing via Zapstore
|
|
||||||
- Nsite deployment for decentralized hosting via Nostr
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
- Make version number on mobile settings a clickable link to the changelog with build date
|
|
||||||
|
|
||||||
## [9.9.2] - 2026-04-02
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
- Simplify nsite deployment to always use named sites, removing the root site option
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Fix crash in "What's new" toast when used outside the router context
|
|
||||||
- Truncate long changelog excerpts in update notifications so they fit neatly in the toast
|
|
||||||
- Left-align changelog page content for better readability
|
|
||||||
|
|
||||||
## [9.9.1] - 2026-04-02
|
|
||||||
|
|
||||||
### Added
|
|
||||||
- Changelog page and versioning system with "What's new" toast notifications on updates
|
|
||||||
- Release skill for managing versioned releases with changelog generation and git tagging
|
|
||||||
@@ -1,197 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Colors for output
|
|
||||||
GREEN='\033[0;32m'
|
|
||||||
YELLOW='\033[1;33m'
|
|
||||||
NC='\033[0m' # No Color
|
|
||||||
|
|
||||||
echo -e "${GREEN}Generating app icons...${NC}\n"
|
|
||||||
|
|
||||||
# Check for inkscape (preferred) or rsvg-convert as fallback
|
|
||||||
if command -v inkscape &> /dev/null; then
|
|
||||||
SVG_RENDERER="inkscape"
|
|
||||||
elif command -v rsvg-convert &> /dev/null; then
|
|
||||||
SVG_RENDERER="rsvg"
|
|
||||||
else
|
|
||||||
echo -e "${YELLOW}Warning: neither inkscape nor rsvg-convert found. Install one to render SVG icons.${NC}"
|
|
||||||
echo "On Fedora/RHEL: sudo dnf install inkscape"
|
|
||||||
echo "On Ubuntu/Debian: sudo apt-get install inkscape"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if ImageMagick is installed (needed for compositing).
|
|
||||||
# ImageMagick 7+ uses `magick`; ImageMagick 6 (Ubuntu/Debian) uses `convert`.
|
|
||||||
if command -v magick &> /dev/null; then
|
|
||||||
MAGICK="magick"
|
|
||||||
elif command -v convert &> /dev/null; then
|
|
||||||
MAGICK="convert"
|
|
||||||
else
|
|
||||||
echo -e "${YELLOW}Warning: ImageMagick not found. Please install it to generate icons.${NC}"
|
|
||||||
echo "On Fedora/RHEL: sudo dnf install ImageMagick"
|
|
||||||
echo "On Ubuntu/Debian: sudo apt-get install imagemagick"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source SVG logo
|
|
||||||
SOURCE_SVG="public/shakespeare.svg"
|
|
||||||
|
|
||||||
if [ ! -f "$SOURCE_SVG" ]; then
|
|
||||||
echo -e "${YELLOW}Error: Source logo not found at $SOURCE_SVG${NC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Brand colors
|
|
||||||
BG_COLOR="#2b0037" # Shakespeare purple
|
|
||||||
|
|
||||||
TMPDIR=$(mktemp -d)
|
|
||||||
LOGO_COLOR="$TMPDIR/logo_color.png"
|
|
||||||
|
|
||||||
# Render the original colorful SVG at high resolution for downscaling.
|
|
||||||
echo "Rendering colorful SVG at 512x512..."
|
|
||||||
|
|
||||||
if [ "$SVG_RENDERER" = "inkscape" ]; then
|
|
||||||
inkscape --export-type=png --export-filename="$LOGO_COLOR" -w 512 -h 512 "$SOURCE_SVG" 2>/dev/null
|
|
||||||
else
|
|
||||||
rsvg-convert -w 512 -h 512 "$SOURCE_SVG" -o "$LOGO_COLOR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ── Adaptive icon foreground PNGs (transparent bg, colorful logo, safe-zone padding) ──
|
|
||||||
# Content at 47% of canvas to fit within Android's adaptive icon safe zone.
|
|
||||||
|
|
||||||
echo "Generating adaptive foreground PNGs..."
|
|
||||||
|
|
||||||
make_foreground() {
|
|
||||||
local size=$1
|
|
||||||
local content_size=$(echo "$size * 47 / 100" | bc)
|
|
||||||
local dest=$2
|
|
||||||
$MAGICK -size "${size}x${size}" "xc:none" \
|
|
||||||
\( "$LOGO_COLOR" -resize "${content_size}x${content_size}" \) \
|
|
||||||
-gravity center -compose over -composite \
|
|
||||||
"$dest"
|
|
||||||
}
|
|
||||||
|
|
||||||
make_foreground 48 android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
|
|
||||||
make_foreground 72 android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
|
|
||||||
make_foreground 96 android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
|
|
||||||
make_foreground 144 android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
|
|
||||||
make_foreground 192 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
|
|
||||||
|
|
||||||
# ── Legacy launcher icons (ic_launcher.png and ic_launcher_round.png) ──
|
|
||||||
# These are used on pre-API-26 devices and as fallback on some launchers.
|
|
||||||
# They must have the logo composited onto the purple background.
|
|
||||||
|
|
||||||
echo "Generating legacy launcher icons (ic_launcher.png and ic_launcher_round.png)..."
|
|
||||||
|
|
||||||
# make_legacy_square: logo on flat purple square background
|
|
||||||
make_legacy_square() {
|
|
||||||
local size=$1
|
|
||||||
local content_size=$(echo "$size * 60 / 100" | bc)
|
|
||||||
local dest=$2
|
|
||||||
$MAGICK -size "${size}x${size}" "xc:${BG_COLOR}" \
|
|
||||||
\( "$LOGO_COLOR" -resize "${content_size}x${content_size}" \) \
|
|
||||||
-gravity center -compose over -composite \
|
|
||||||
"$dest"
|
|
||||||
}
|
|
||||||
|
|
||||||
# make_legacy_round: logo on circular purple background (alpha-masked circle)
|
|
||||||
make_legacy_round() {
|
|
||||||
local size=$1
|
|
||||||
local content_size=$(echo "$size * 60 / 100" | bc)
|
|
||||||
local dest=$2
|
|
||||||
local mask="$TMPDIR/circle_mask_${size}.png"
|
|
||||||
# Create a white circle mask
|
|
||||||
$MAGICK -size "${size}x${size}" "xc:none" \
|
|
||||||
-fill white -draw "circle $((size/2)),$((size/2)) $((size/2)),0" \
|
|
||||||
"$mask"
|
|
||||||
# Fill purple, apply circle mask, composite logo
|
|
||||||
$MAGICK -size "${size}x${size}" "xc:${BG_COLOR}" \
|
|
||||||
"$mask" -compose dst-in -composite \
|
|
||||||
\( "$LOGO_COLOR" -resize "${content_size}x${content_size}" \) \
|
|
||||||
-gravity center -compose over -composite \
|
|
||||||
"$dest"
|
|
||||||
}
|
|
||||||
|
|
||||||
make_legacy_square 48 android/app/src/main/res/mipmap-mdpi/ic_launcher.png
|
|
||||||
make_legacy_square 72 android/app/src/main/res/mipmap-hdpi/ic_launcher.png
|
|
||||||
make_legacy_square 96 android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
|
|
||||||
make_legacy_square 144 android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
|
|
||||||
make_legacy_square 192 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
|
|
||||||
|
|
||||||
make_legacy_round 48 android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
|
|
||||||
make_legacy_round 72 android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
|
|
||||||
make_legacy_round 96 android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
|
|
||||||
make_legacy_round 144 android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
|
|
||||||
make_legacy_round 192 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
|
|
||||||
|
|
||||||
# Update background color
|
|
||||||
BACKGROUND_COLOR_FILE="android/app/src/main/res/values/ic_launcher_background.xml"
|
|
||||||
mkdir -p android/app/src/main/res/values
|
|
||||||
cat > "$BACKGROUND_COLOR_FILE" << 'EOF'
|
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="ic_launcher_background">#2b0037</color>
|
|
||||||
</resources>
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# ── Splash screen PNGs (logo centered on purple background) ──
|
|
||||||
# These are the legacy splash screens used by the Capacitor splash screen plugin.
|
|
||||||
# Logo is sized to ~25% of the shorter dimension, centered on solid purple.
|
|
||||||
|
|
||||||
echo "Generating splash screen PNGs..."
|
|
||||||
|
|
||||||
make_splash() {
|
|
||||||
local w=$1
|
|
||||||
local h=$2
|
|
||||||
local dest=$3
|
|
||||||
local shorter=$(( w < h ? w : h ))
|
|
||||||
local logo_size=$(echo "$shorter * 25 / 100" | bc)
|
|
||||||
$MAGICK -size "${w}x${h}" "xc:${BG_COLOR}" \
|
|
||||||
\( "$LOGO_COLOR" -resize "${logo_size}x${logo_size}" \) \
|
|
||||||
-gravity center -compose over -composite \
|
|
||||||
"$dest"
|
|
||||||
}
|
|
||||||
|
|
||||||
make_splash 480 320 android/app/src/main/res/drawable/splash.png
|
|
||||||
make_splash 320 480 android/app/src/main/res/drawable-port-mdpi/splash.png
|
|
||||||
make_splash 480 800 android/app/src/main/res/drawable-port-hdpi/splash.png
|
|
||||||
make_splash 720 1280 android/app/src/main/res/drawable-port-xhdpi/splash.png
|
|
||||||
make_splash 960 1600 android/app/src/main/res/drawable-port-xxhdpi/splash.png
|
|
||||||
make_splash 1280 1920 android/app/src/main/res/drawable-port-xxxhdpi/splash.png
|
|
||||||
make_splash 480 320 android/app/src/main/res/drawable-land-mdpi/splash.png
|
|
||||||
make_splash 800 480 android/app/src/main/res/drawable-land-hdpi/splash.png
|
|
||||||
make_splash 1280 720 android/app/src/main/res/drawable-land-xhdpi/splash.png
|
|
||||||
make_splash 1600 960 android/app/src/main/res/drawable-land-xxhdpi/splash.png
|
|
||||||
make_splash 1920 1280 android/app/src/main/res/drawable-land-xxxhdpi/splash.png
|
|
||||||
|
|
||||||
# ── iOS App Icon (1024x1024, colorful logo on purple background) ──
|
|
||||||
|
|
||||||
echo "Generating iOS app icon..."
|
|
||||||
|
|
||||||
IOS_ICON_DIR="ios/App/App/Assets.xcassets/AppIcon.appiconset"
|
|
||||||
|
|
||||||
if [ -d "$IOS_ICON_DIR" ]; then
|
|
||||||
IOS_ICON="$IOS_ICON_DIR/[email protected]"
|
|
||||||
# Logo at ~60% of canvas, centered on purple background
|
|
||||||
$MAGICK -size "1024x1024" "xc:${BG_COLOR}" \
|
|
||||||
\( "$LOGO_COLOR" -resize "614x614" \) \
|
|
||||||
-gravity center -compose over -composite \
|
|
||||||
"$IOS_ICON"
|
|
||||||
echo -e " ${GREEN}✓${NC} $IOS_ICON"
|
|
||||||
else
|
|
||||||
echo -e " ${YELLOW}Skipped: $IOS_ICON_DIR not found${NC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Cleanup temp files
|
|
||||||
rm -rf "$TMPDIR"
|
|
||||||
|
|
||||||
echo -e "\n${GREEN}App icons generated successfully!${NC}"
|
|
||||||
echo -e "Icon: colorful Shakespeare logo on ${GREEN}${BG_COLOR}${NC} (Shakespeare purple)"
|
|
||||||
echo -e "Generated:"
|
|
||||||
echo -e " Android:"
|
|
||||||
echo -e " - ic_launcher_foreground.png (adaptive, all densities)"
|
|
||||||
echo -e " - ic_launcher.png (legacy square, all densities)"
|
|
||||||
echo -e " - ic_launcher_round.png (legacy round, all densities)"
|
|
||||||
echo -e " - splash.png (portrait + landscape, all densities)"
|
|
||||||
echo -e " iOS:"
|
|
||||||
echo -e " - [email protected] (1024x1024)"
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { render } from '@testing-library/react';
|
||||||
|
import { test, expect } from 'vitest';
|
||||||
|
|
||||||
|
import App from './App';
|
||||||
|
|
||||||
|
test('App', () => {
|
||||||
|
const { container } = render(<App />);
|
||||||
|
|
||||||
|
// Basic smoke test to ensure App renders without crashing
|
||||||
|
expect(container).toBeInTheDocument();
|
||||||
|
})
|
||||||
@@ -8,13 +8,13 @@ import { Suspense, useEffect } from 'react';
|
|||||||
import LightningFS from '@isomorphic-git/lightning-fs';
|
import LightningFS from '@isomorphic-git/lightning-fs';
|
||||||
import NostrProvider from '@/components/NostrProvider';
|
import NostrProvider from '@/components/NostrProvider';
|
||||||
import { NostrSync } from '@/components/NostrSync';
|
import { NostrSync } from '@/components/NostrSync';
|
||||||
|
import { Toaster } from "@/components/ui/toaster";
|
||||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||||
import { NostrLoginProvider } from '@nostrify/react/login';
|
import { NostrLoginProvider } from '@nostrify/react/login';
|
||||||
import { AppProvider } from '@/components/AppProvider';
|
import { AppProvider } from '@/components/AppProvider';
|
||||||
import { AppConfig } from '@/contexts/AppContext';
|
import { AppConfig } from '@/contexts/AppContext';
|
||||||
import { useAppContext } from '@/hooks/useAppContext';
|
import { useAppContext } from '@/hooks/useAppContext';
|
||||||
import { SentryProvider } from '@/components/SentryProvider';
|
import { SentryProvider } from '@/components/SentryProvider';
|
||||||
import { PlausibleProvider } from '@/components/PlausibleProvider';
|
|
||||||
import { AISettingsProvider } from '@/components/AISettingsProvider';
|
import { AISettingsProvider } from '@/components/AISettingsProvider';
|
||||||
import { GitSettingsProvider } from '@/components/GitSettingsProvider';
|
import { GitSettingsProvider } from '@/components/GitSettingsProvider';
|
||||||
import { DeploySettingsProvider } from '@/components/DeploySettingsProvider';
|
import { DeploySettingsProvider } from '@/components/DeploySettingsProvider';
|
||||||
@@ -28,8 +28,6 @@ import { DynamicFavicon } from '@/components/DynamicFavicon';
|
|||||||
import { OfflineIndicator } from '@/components/OfflineIndicator';
|
import { OfflineIndicator } from '@/components/OfflineIndicator';
|
||||||
import { PWAUpdatePrompt } from '@/components/PWAUpdatePrompt';
|
import { PWAUpdatePrompt } from '@/components/PWAUpdatePrompt';
|
||||||
import { ErrorBoundary } from '@/components/ErrorBoundary';
|
import { ErrorBoundary } from '@/components/ErrorBoundary';
|
||||||
import { LockdownModeDetector } from '@/components/LockdownModeDetector';
|
|
||||||
|
|
||||||
|
|
||||||
import AppRouter from './AppRouter';
|
import AppRouter from './AppRouter';
|
||||||
|
|
||||||
@@ -54,7 +52,7 @@ const defaultConfig: AppConfig = {
|
|||||||
relayMetadata: {
|
relayMetadata: {
|
||||||
relays: [
|
relays: [
|
||||||
{ url: 'wss://relay.ditto.pub', read: true, write: true },
|
{ url: 'wss://relay.ditto.pub', read: true, write: true },
|
||||||
{ url: 'wss://relay.damus.io', read: true, write: true },
|
{ url: 'wss://relay.nostr.band', read: true, write: true },
|
||||||
{ url: 'wss://relay.primal.net', read: true, write: true },
|
{ url: 'wss://relay.primal.net', read: true, write: true },
|
||||||
],
|
],
|
||||||
updatedAt: 0,
|
updatedAt: 0,
|
||||||
@@ -72,6 +70,11 @@ const defaultConfig: AppConfig = {
|
|||||||
description: "Build Nostr clients with React. This is the default template that you should choose in the majority of cases. It ships with complete Nostr integration out of the box, enabling a variety of use-cases from social media to blogging to AI-powered apps. If you're not sure which template to choose, choose this one.",
|
description: "Build Nostr clients with React. This is the default template that you should choose in the majority of cases. It ships with complete Nostr integration out of the box, enabling a variety of use-cases from social media to blogging to AI-powered apps. If you're not sure which template to choose, choose this one.",
|
||||||
url: "https://gitlab.com/soapbox-pub/mkstack.git",
|
url: "https://gitlab.com/soapbox-pub/mkstack.git",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Nutstack",
|
||||||
|
description: "This is a variant of MKStack extended to support Cashu integration. Choose this template only if the user has indicated they require Cashu integration.",
|
||||||
|
url: "https://gitlab.com/lemonknowsall/nutstack.git",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
esmUrl: "https://esm.sh",
|
esmUrl: "https://esm.sh",
|
||||||
corsProxy: "https://proxy.shakespeare.diy/?url={href}",
|
corsProxy: "https://proxy.shakespeare.diy/?url={href}",
|
||||||
@@ -88,8 +91,6 @@ const defaultConfig: AppConfig = {
|
|||||||
fsPathTemplates: "/templates",
|
fsPathTemplates: "/templates",
|
||||||
sentryDsn: import.meta.env.VITE_SENTRY_DSN || "",
|
sentryDsn: import.meta.env.VITE_SENTRY_DSN || "",
|
||||||
sentryEnabled: true,
|
sentryEnabled: true,
|
||||||
plausibleDomain: import.meta.env.VITE_PLAUSIBLE_DOMAIN || "",
|
|
||||||
plausibleEndpoint: import.meta.env.VITE_PLAUSIBLE_ENDPOINT || "",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialize filesystem adapter
|
// Initialize filesystem adapter
|
||||||
@@ -134,39 +135,37 @@ export function App() {
|
|||||||
<UnheadProvider head={head}>
|
<UnheadProvider head={head}>
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<AppProvider storageKey="nostr:app-config" defaultConfig={defaultConfig}>
|
<AppProvider storageKey="nostr:app-config" defaultConfig={defaultConfig}>
|
||||||
<PlausibleProvider>
|
<SentryProvider>
|
||||||
<SentryProvider>
|
<FSProvider fs={fs}>
|
||||||
<FSProvider fs={fs}>
|
<ConsoleErrorProvider>
|
||||||
<ConsoleErrorProvider>
|
<FSCleanupHandler />
|
||||||
<FSCleanupHandler />
|
<NostrLoginProvider storageKey='nostr:login'>
|
||||||
<NostrLoginProvider storageKey='nostr:login'>
|
<NostrProvider>
|
||||||
<NostrProvider>
|
<NostrSync />
|
||||||
<NostrSync />
|
<AISettingsProvider>
|
||||||
<AISettingsProvider>
|
<GitSettingsProvider>
|
||||||
<GitSettingsProvider>
|
<DeploySettingsProvider>
|
||||||
<DeploySettingsProvider>
|
<GitSyncProvider>
|
||||||
<GitSyncProvider>
|
<SessionManagerProvider>
|
||||||
<SessionManagerProvider>
|
<TooltipProvider>
|
||||||
<TooltipProvider>
|
<Toaster />
|
||||||
<DynamicFavicon />
|
<DynamicFavicon />
|
||||||
<OfflineIndicator />
|
<OfflineIndicator />
|
||||||
<PWAUpdatePrompt />
|
<PWAUpdatePrompt />
|
||||||
<LockdownModeDetector />
|
<Suspense>
|
||||||
<Suspense>
|
<AppRouter />
|
||||||
<AppRouter />
|
</Suspense>
|
||||||
</Suspense>
|
</TooltipProvider>
|
||||||
</TooltipProvider>
|
</SessionManagerProvider>
|
||||||
</SessionManagerProvider>
|
</GitSyncProvider>
|
||||||
</GitSyncProvider>
|
</DeploySettingsProvider>
|
||||||
</DeploySettingsProvider>
|
</GitSettingsProvider>
|
||||||
</GitSettingsProvider>
|
</AISettingsProvider>
|
||||||
</AISettingsProvider>
|
</NostrProvider>
|
||||||
</NostrProvider>
|
</NostrLoginProvider>
|
||||||
</NostrLoginProvider>
|
</ConsoleErrorProvider>
|
||||||
</ConsoleErrorProvider>
|
</FSProvider>
|
||||||
</FSProvider>
|
</SentryProvider>
|
||||||
</SentryProvider>
|
|
||||||
</PlausibleProvider>
|
|
||||||
</AppProvider>
|
</AppProvider>
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
</UnheadProvider>
|
</UnheadProvider>
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import { BrowserRouter, Route, Routes } from "react-router-dom";
|
import { BrowserRouter, Route, Routes } from "react-router-dom";
|
||||||
import { Toaster } from "./components/ui/toaster";
|
|
||||||
import { ScrollToTop } from "./components/ScrollToTop";
|
import { ScrollToTop } from "./components/ScrollToTop";
|
||||||
import { SessionMonitor } from "./components/SessionMonitor";
|
import { SessionMonitor } from "./components/SessionMonitor";
|
||||||
import { URLFragmentHandler } from "./components/URLFragmentHandler";
|
import { URLFragmentHandler } from "./components/URLFragmentHandler";
|
||||||
import { VersionCheck } from "./components/VersionCheck";
|
|
||||||
|
|
||||||
import Index from "./pages/Index";
|
import Index from "./pages/Index";
|
||||||
import Clone from "./pages/Clone";
|
import Clone from "./pages/Clone";
|
||||||
@@ -25,13 +23,10 @@ import { NIP19Page } from "./pages/NIP19Page";
|
|||||||
import NotFound from "./pages/NotFound";
|
import NotFound from "./pages/NotFound";
|
||||||
import { ProjectView } from "./pages/ProjectView";
|
import { ProjectView } from "./pages/ProjectView";
|
||||||
import { SettingsLayout } from "./components/SettingsLayout";
|
import { SettingsLayout } from "./components/SettingsLayout";
|
||||||
import { ChangelogPage } from "./pages/ChangelogPage";
|
|
||||||
|
|
||||||
export function AppRouter() {
|
export function AppRouter() {
|
||||||
return (
|
return (
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Toaster />
|
|
||||||
<VersionCheck />
|
|
||||||
<ScrollToTop />
|
<ScrollToTop />
|
||||||
<SessionMonitor />
|
<SessionMonitor />
|
||||||
<URLFragmentHandler />
|
<URLFragmentHandler />
|
||||||
@@ -54,7 +49,6 @@ export function AppRouter() {
|
|||||||
<Route path="storage" element={<StorageSettings />} />
|
<Route path="storage" element={<StorageSettings />} />
|
||||||
<Route path="about" element={<AboutSettings />} />
|
<Route path="about" element={<AboutSettings />} />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/changelog" element={<ChangelogPage />} />
|
|
||||||
<Route path="/project/:projectId" element={<ProjectView />} />
|
<Route path="/project/:projectId" element={<ProjectView />} />
|
||||||
{/* NIP-19 route for npub1, note1, naddr1, nevent1, nprofile1 */}
|
{/* NIP-19 route for npub1, note1, naddr1, nevent1, nprofile1 */}
|
||||||
<Route path="/:nip19" element={<NIP19Page />} />
|
<Route path="/:nip19" element={<NIP19Page />} />
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Check } from 'lucide-react';
|
import { Check } from 'lucide-react';
|
||||||
import { UrlListEditor } from '@/components/UrlListEditor';
|
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { PasswordInput } from '@/components/ui/password-input';
|
import { PasswordInput } from '@/components/ui/password-input';
|
||||||
@@ -64,8 +63,8 @@ export function AddCustomProviderDialog({
|
|||||||
const [customHost, setCustomHost] = useState('');
|
const [customHost, setCustomHost] = useState('');
|
||||||
const [customProxy, setCustomProxy] = useState(false);
|
const [customProxy, setCustomProxy] = useState(false);
|
||||||
const [customGateway, setCustomGateway] = useState('');
|
const [customGateway, setCustomGateway] = useState('');
|
||||||
const [customRelayUrls, setCustomRelayUrls] = useState<string[]>([]);
|
const [customRelayUrls, setCustomRelayUrls] = useState('');
|
||||||
const [customBlossomServers, setCustomBlossomServers] = useState<string[]>([]);
|
const [customBlossomServers, setCustomBlossomServers] = useState('');
|
||||||
|
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
if (!customProviderType || !customName.trim()) return;
|
if (!customProviderType || !customName.trim()) return;
|
||||||
@@ -85,8 +84,12 @@ export function AddCustomProviderDialog({
|
|||||||
type: 'nsite',
|
type: 'nsite',
|
||||||
name: customName.trim(),
|
name: customName.trim(),
|
||||||
gateway: customGateway.trim() || 'nsite.lol',
|
gateway: customGateway.trim() || 'nsite.lol',
|
||||||
relayUrls: customRelayUrls.length > 0 ? customRelayUrls : ['wss://relay.ditto.pub'],
|
relayUrls: customRelayUrls.trim()
|
||||||
blossomServers: customBlossomServers.length > 0 ? customBlossomServers : ['https://blossom.primal.net/'],
|
? customRelayUrls.split(',').map(s => s.trim()).filter(Boolean)
|
||||||
|
: ['wss://relay.nostr.band'],
|
||||||
|
blossomServers: customBlossomServers.trim()
|
||||||
|
? customBlossomServers.split(',').map(s => s.trim()).filter(Boolean)
|
||||||
|
: ['https://blossom.primal.net/'],
|
||||||
};
|
};
|
||||||
} else if (customProviderType === 'netlify') {
|
} else if (customProviderType === 'netlify') {
|
||||||
if (!customApiKey.trim()) return;
|
if (!customApiKey.trim()) return;
|
||||||
@@ -154,8 +157,8 @@ export function AddCustomProviderDialog({
|
|||||||
setCustomHost('');
|
setCustomHost('');
|
||||||
setCustomProxy(false);
|
setCustomProxy(false);
|
||||||
setCustomGateway('');
|
setCustomGateway('');
|
||||||
setCustomRelayUrls([]);
|
setCustomRelayUrls('');
|
||||||
setCustomBlossomServers([]);
|
setCustomBlossomServers('');
|
||||||
|
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
};
|
};
|
||||||
@@ -195,8 +198,8 @@ export function AddCustomProviderDialog({
|
|||||||
setCustomHost('');
|
setCustomHost('');
|
||||||
setCustomProxy(false);
|
setCustomProxy(false);
|
||||||
setCustomGateway('');
|
setCustomGateway('');
|
||||||
setCustomRelayUrls([]);
|
setCustomRelayUrls('');
|
||||||
setCustomBlossomServers([]);
|
setCustomBlossomServers('');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
@@ -246,7 +249,7 @@ export function AddCustomProviderDialog({
|
|||||||
) : customProviderType === 'nsite' ? (
|
) : customProviderType === 'nsite' ? (
|
||||||
<>
|
<>
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
Deploy to Nostr as a static website. Uses a kind 15128 site manifest event and Blossom file storage.
|
Deploy to Nostr as a static website. Uses kind 34128 events and Blossom file storage.
|
||||||
</p>
|
</p>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="custom-gateway">Gateway</Label>
|
<Label htmlFor="custom-gateway">Gateway</Label>
|
||||||
@@ -257,20 +260,24 @@ export function AddCustomProviderDialog({
|
|||||||
onChange={(e) => setCustomGateway(e.target.value)}
|
onChange={(e) => setCustomGateway(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<UrlListEditor
|
<div className="grid gap-2">
|
||||||
label="Relay URLs"
|
<Label htmlFor="custom-relays">Relay URLs (comma-separated)</Label>
|
||||||
items={customRelayUrls}
|
<Input
|
||||||
onChange={setCustomRelayUrls}
|
id="custom-relays"
|
||||||
protocol="wss"
|
placeholder="wss://relay.nostr.band, wss://relay.damus.io"
|
||||||
placeholder="relay.ditto.pub"
|
value={customRelayUrls}
|
||||||
/>
|
onChange={(e) => setCustomRelayUrls(e.target.value)}
|
||||||
<UrlListEditor
|
/>
|
||||||
label="Blossom Servers"
|
</div>
|
||||||
items={customBlossomServers}
|
<div className="grid gap-2">
|
||||||
onChange={setCustomBlossomServers}
|
<Label htmlFor="custom-blossom">Blossom Servers (comma-separated)</Label>
|
||||||
protocol="https"
|
<Input
|
||||||
placeholder="blossom.primal.net"
|
id="custom-blossom"
|
||||||
/>
|
placeholder="https://blossom.primal.net/"
|
||||||
|
value={customBlossomServers}
|
||||||
|
onChange={(e) => setCustomBlossomServers(e.target.value)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -1,567 +0,0 @@
|
|||||||
import { useState, useEffect, useCallback, useRef } from 'react';
|
|
||||||
import {
|
|
||||||
Dialog,
|
|
||||||
DialogContent,
|
|
||||||
DialogHeader,
|
|
||||||
DialogTitle,
|
|
||||||
DialogDescription,
|
|
||||||
} from '@/components/ui/dialog';
|
|
||||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';
|
|
||||||
import { Button } from '@/components/ui/button';
|
|
||||||
import { Input } from '@/components/ui/input';
|
|
||||||
import { Textarea } from '@/components/ui/textarea';
|
|
||||||
import { Label } from '@/components/ui/label';
|
|
||||||
import { Skeleton } from '@/components/ui/skeleton';
|
|
||||||
import { Badge } from '@/components/ui/badge';
|
|
||||||
import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/avatar';
|
|
||||||
import { useToast } from '@/hooks/useToast';
|
|
||||||
import { useFS } from '@/hooks/useFS';
|
|
||||||
import { useFSPaths } from '@/hooks/useFSPaths';
|
|
||||||
import { useCurrentUser } from '@/hooks/useCurrentUser';
|
|
||||||
import { useNostrPublish } from '@/hooks/useNostrPublish';
|
|
||||||
import { useUploadFile } from '@/hooks/useUploadFile';
|
|
||||||
import { useAppEvent } from '@/hooks/useAppEvent';
|
|
||||||
import { useProjectDeploySettings } from '@/hooks/useProjectDeploySettings';
|
|
||||||
import { useQueryClient } from '@tanstack/react-query';
|
|
||||||
import { DotAI } from '@/lib/DotAI';
|
|
||||||
import { buildAppEvent } from '@/lib/appEvent';
|
|
||||||
import {
|
|
||||||
Loader2,
|
|
||||||
Save,
|
|
||||||
Plus,
|
|
||||||
X,
|
|
||||||
ExternalLink,
|
|
||||||
Pencil,
|
|
||||||
Upload,
|
|
||||||
ChevronDown,
|
|
||||||
CircleHelp,
|
|
||||||
} from 'lucide-react';
|
|
||||||
import type { NostrEvent } from '@nostrify/nostrify';
|
|
||||||
|
|
||||||
interface AppDialogProps {
|
|
||||||
projectId: string;
|
|
||||||
open: boolean;
|
|
||||||
onOpenChange: (open: boolean) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AppFormData {
|
|
||||||
name: string;
|
|
||||||
about: string;
|
|
||||||
picture: string;
|
|
||||||
website: string;
|
|
||||||
dTag: string;
|
|
||||||
supportedKinds: string[];
|
|
||||||
webHandlers: Array<{ url: string; type: string }>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Parse a kind 31990 event into form data */
|
|
||||||
function eventToFormData(event: NostrEvent): AppFormData {
|
|
||||||
let metadata: Record<string, string> = {};
|
|
||||||
try {
|
|
||||||
if (event.content) {
|
|
||||||
metadata = JSON.parse(event.content);
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// Invalid JSON content, use empty metadata
|
|
||||||
}
|
|
||||||
|
|
||||||
const dTag = event.tags.find(([t]) => t === 'd')?.[1] ?? '';
|
|
||||||
const supportedKinds = event.tags
|
|
||||||
.filter(([t]) => t === 'k')
|
|
||||||
.map(([, v]) => v)
|
|
||||||
.filter(Boolean);
|
|
||||||
|
|
||||||
const webHandlers = event.tags
|
|
||||||
.filter(([t]) => t === 'web')
|
|
||||||
.map(([, url, type]) => ({ url: url ?? '', type: type ?? '' }));
|
|
||||||
|
|
||||||
return {
|
|
||||||
name: metadata.name ?? '',
|
|
||||||
about: metadata.about ?? '',
|
|
||||||
picture: metadata.picture ?? '',
|
|
||||||
website: metadata.website ?? '',
|
|
||||||
dTag,
|
|
||||||
supportedKinds,
|
|
||||||
webHandlers,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convert a slug like "my-cool-app" to title case like "My Cool App" */
|
|
||||||
function toTitleCase(slug: string): string {
|
|
||||||
return slug
|
|
||||||
.replace(/[-_]+/g, ' ')
|
|
||||||
.replace(/\b\w/g, (c) => c.toUpperCase())
|
|
||||||
.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Create empty form data for a new app */
|
|
||||||
function emptyFormData(projectId: string): AppFormData {
|
|
||||||
return {
|
|
||||||
name: toTitleCase(projectId),
|
|
||||||
about: '',
|
|
||||||
picture: '',
|
|
||||||
website: '',
|
|
||||||
dTag: projectId,
|
|
||||||
supportedKinds: [],
|
|
||||||
webHandlers: [],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function AppDialog({ projectId, open, onOpenChange }: AppDialogProps) {
|
|
||||||
const { fs } = useFS();
|
|
||||||
const { projectsPath } = useFSPaths();
|
|
||||||
const { user } = useCurrentUser();
|
|
||||||
const { toast } = useToast();
|
|
||||||
const queryClient = useQueryClient();
|
|
||||||
const { mutateAsync: publishEvent } = useNostrPublish();
|
|
||||||
const { mutateAsync: uploadFile, isPending: isUploading } = useUploadFile();
|
|
||||||
const cwd = `${projectsPath}/${projectId}`;
|
|
||||||
|
|
||||||
const { event, isLoading, aTag, hasApp, refetch } = useAppEvent({ cwd });
|
|
||||||
const { settings: deploySettings, isLoading: isDeployLoading } = useProjectDeploySettings(projectId);
|
|
||||||
|
|
||||||
const [formData, setFormData] = useState<AppFormData>(emptyFormData(projectId));
|
|
||||||
const [isSaving, setIsSaving] = useState(false);
|
|
||||||
const [newKind, setNewKind] = useState('');
|
|
||||||
const [newHandlerUrl, setNewHandlerUrl] = useState('');
|
|
||||||
const [newHandlerType, setNewHandlerType] = useState('');
|
|
||||||
const [advancedOpen, setAdvancedOpen] = useState(false);
|
|
||||||
|
|
||||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
||||||
|
|
||||||
// Get the deployed URL from project deploy settings
|
|
||||||
const deployedUrl = (() => {
|
|
||||||
if (!deploySettings?.currentProvider || !deploySettings?.providers) return null;
|
|
||||||
const config = deploySettings.providers[deploySettings.currentProvider];
|
|
||||||
return config?.url ?? null;
|
|
||||||
})();
|
|
||||||
|
|
||||||
// Populate form when event loads
|
|
||||||
useEffect(() => {
|
|
||||||
if (event) {
|
|
||||||
setFormData(eventToFormData(event));
|
|
||||||
} else if (!isLoading && !hasApp) {
|
|
||||||
setFormData(emptyFormData(projectId));
|
|
||||||
}
|
|
||||||
}, [event, isLoading, hasApp, projectId]);
|
|
||||||
|
|
||||||
// Auto-fill website from deployment URL when creating a new app (not editing existing)
|
|
||||||
useEffect(() => {
|
|
||||||
if (!hasApp && !isDeployLoading && deployedUrl && !formData.website) {
|
|
||||||
setFormData(prev => ({ ...prev, website: deployedUrl }));
|
|
||||||
}
|
|
||||||
}, [hasApp, isDeployLoading, deployedUrl, formData.website]);
|
|
||||||
|
|
||||||
const updateField = useCallback(<K extends keyof AppFormData>(key: K, value: AppFormData[K]) => {
|
|
||||||
setFormData(prev => ({ ...prev, [key]: value }));
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const addKind = useCallback(() => {
|
|
||||||
const kind = newKind.trim();
|
|
||||||
if (kind && !formData.supportedKinds.includes(kind)) {
|
|
||||||
updateField('supportedKinds', [...formData.supportedKinds, kind]);
|
|
||||||
setNewKind('');
|
|
||||||
}
|
|
||||||
}, [newKind, formData.supportedKinds, updateField]);
|
|
||||||
|
|
||||||
const removeKind = useCallback((kind: string) => {
|
|
||||||
updateField('supportedKinds', formData.supportedKinds.filter(k => k !== kind));
|
|
||||||
}, [formData.supportedKinds, updateField]);
|
|
||||||
|
|
||||||
const addHandler = useCallback(() => {
|
|
||||||
const url = newHandlerUrl.trim();
|
|
||||||
if (url) {
|
|
||||||
updateField('webHandlers', [...formData.webHandlers, { url, type: newHandlerType.trim() }]);
|
|
||||||
setNewHandlerUrl('');
|
|
||||||
setNewHandlerType('');
|
|
||||||
}
|
|
||||||
}, [newHandlerUrl, newHandlerType, formData.webHandlers, updateField]);
|
|
||||||
|
|
||||||
const removeHandler = useCallback((index: number) => {
|
|
||||||
updateField('webHandlers', formData.webHandlers.filter((_, i) => i !== index));
|
|
||||||
}, [formData.webHandlers, updateField]);
|
|
||||||
|
|
||||||
const handleIconUpload = useCallback(async (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
||||||
const file = e.target.files?.[0];
|
|
||||||
if (!file) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const tags = await uploadFile(file);
|
|
||||||
const url = tags[0]?.[1];
|
|
||||||
if (url) {
|
|
||||||
updateField('picture', url);
|
|
||||||
toast({ title: 'Icon uploaded', description: 'Your app icon has been uploaded.' });
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
toast({
|
|
||||||
title: 'Upload failed',
|
|
||||||
description: error instanceof Error ? error.message : 'Failed to upload icon.',
|
|
||||||
variant: 'destructive',
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
// Reset input so re-selecting the same file triggers onChange
|
|
||||||
if (fileInputRef.current) {
|
|
||||||
fileInputRef.current.value = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [uploadFile, updateField, toast]);
|
|
||||||
|
|
||||||
const handleSave = async () => {
|
|
||||||
if (!user) {
|
|
||||||
toast({
|
|
||||||
title: 'Not logged in',
|
|
||||||
description: 'You must be logged in with Nostr to publish an app.',
|
|
||||||
variant: 'destructive',
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!formData.name.trim()) {
|
|
||||||
toast({
|
|
||||||
title: 'Name required',
|
|
||||||
description: 'Please enter a name for your app.',
|
|
||||||
variant: 'destructive',
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!formData.dTag.trim()) {
|
|
||||||
toast({
|
|
||||||
title: 'Identifier required',
|
|
||||||
description: 'Please enter a unique identifier (d-tag) for your app.',
|
|
||||||
variant: 'destructive',
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setIsSaving(true);
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Build event content and tags
|
|
||||||
const { content, tags } = await buildAppEvent(
|
|
||||||
{
|
|
||||||
name: formData.name,
|
|
||||||
about: formData.about,
|
|
||||||
picture: formData.picture,
|
|
||||||
website: formData.website,
|
|
||||||
dTag: formData.dTag,
|
|
||||||
supportedKinds: formData.supportedKinds,
|
|
||||||
webHandlers: formData.webHandlers,
|
|
||||||
},
|
|
||||||
{ fs, cwd, pubkey: user.pubkey },
|
|
||||||
);
|
|
||||||
|
|
||||||
// Publish the event
|
|
||||||
const published = await publishEvent({
|
|
||||||
kind: 31990,
|
|
||||||
content,
|
|
||||||
tags,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Store the "a" coordinate in .git/shakespeare/app.json
|
|
||||||
const aValue = `31990:${published.pubkey}:${formData.dTag.trim()}`;
|
|
||||||
const dotAI = new DotAI(fs, cwd);
|
|
||||||
await dotAI.writeAppConfig({ a: aValue });
|
|
||||||
|
|
||||||
// Invalidate queries
|
|
||||||
await queryClient.invalidateQueries({ queryKey: ['app-event'] });
|
|
||||||
await refetch();
|
|
||||||
|
|
||||||
toast({
|
|
||||||
title: hasApp ? 'App updated' : 'App published',
|
|
||||||
description: `"${formData.name}" has been ${hasApp ? 'updated' : 'published'} to Nostr.`,
|
|
||||||
});
|
|
||||||
|
|
||||||
onOpenChange(false);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to publish app:', error);
|
|
||||||
toast({
|
|
||||||
title: 'Failed to publish',
|
|
||||||
description: error instanceof Error ? error.message : 'An unexpected error occurred',
|
|
||||||
variant: 'destructive',
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
setIsSaving(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!user) {
|
|
||||||
return (
|
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
||||||
<DialogContent className="max-w-md">
|
|
||||||
<DialogHeader>
|
|
||||||
<DialogTitle>App</DialogTitle>
|
|
||||||
</DialogHeader>
|
|
||||||
<p className="text-sm text-muted-foreground">
|
|
||||||
You must be logged in with Nostr to manage your app.
|
|
||||||
</p>
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
||||||
<DialogContent className="max-w-lg max-h-[85vh] overflow-y-auto">
|
|
||||||
<DialogHeader>
|
|
||||||
<DialogTitle>{hasApp ? 'Edit App' : 'Publish App'}</DialogTitle>
|
|
||||||
<DialogDescription>
|
|
||||||
{hasApp
|
|
||||||
? 'Update your app\'s listing on Nostr.'
|
|
||||||
: 'Publish your project as a Nostr app.'}
|
|
||||||
</DialogDescription>
|
|
||||||
</DialogHeader>
|
|
||||||
|
|
||||||
{isLoading ? (
|
|
||||||
<div className="space-y-4">
|
|
||||||
<div className="flex items-start gap-4">
|
|
||||||
<Skeleton className="h-20 w-20 rounded-2xl flex-shrink-0" />
|
|
||||||
<div className="flex-1 space-y-2 pt-1">
|
|
||||||
<Skeleton className="h-5 w-40" />
|
|
||||||
<Skeleton className="h-4 w-full" />
|
|
||||||
<Skeleton className="h-4 w-2/3" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<Skeleton className="h-10 w-full" />
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="space-y-5">
|
|
||||||
{/* App Preview Card */}
|
|
||||||
<div className="flex items-start gap-4">
|
|
||||||
{/* Icon with upload */}
|
|
||||||
<div className="relative flex-shrink-0 group">
|
|
||||||
<input
|
|
||||||
ref={fileInputRef}
|
|
||||||
type="file"
|
|
||||||
accept="image/*"
|
|
||||||
onChange={handleIconUpload}
|
|
||||||
className="hidden"
|
|
||||||
disabled={isSaving || isUploading}
|
|
||||||
/>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => fileInputRef.current?.click()}
|
|
||||||
disabled={isSaving || isUploading}
|
|
||||||
className="relative block rounded-2xl overflow-hidden focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none"
|
|
||||||
>
|
|
||||||
{formData.picture ? (
|
|
||||||
<>
|
|
||||||
<Avatar className="h-20 w-20 rounded-2xl">
|
|
||||||
<AvatarImage src={formData.picture} alt={formData.name || 'App icon'} className="object-cover" />
|
|
||||||
<AvatarFallback className="rounded-2xl bg-muted" />
|
|
||||||
</Avatar>
|
|
||||||
<div className="absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded-2xl">
|
|
||||||
{isUploading ? (
|
|
||||||
<Loader2 className="h-5 w-5 text-white animate-spin" />
|
|
||||||
) : (
|
|
||||||
<Pencil className="h-4 w-4 text-white" />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<div className="h-20 w-20 rounded-2xl bg-muted flex items-center justify-center transition-colors group-hover:bg-muted-foreground">
|
|
||||||
{isUploading ? (
|
|
||||||
<Loader2 className="h-6 w-6 text-muted-foreground animate-spin group-hover:text-background" />
|
|
||||||
) : (
|
|
||||||
<Upload className="h-6 w-6 text-muted-foreground transition-colors group-hover:text-background" />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Name & Description inline */}
|
|
||||||
<div className="flex-1 min-w-0 space-y-2">
|
|
||||||
<Input
|
|
||||||
value={formData.name}
|
|
||||||
onChange={e => updateField('name', e.target.value)}
|
|
||||||
placeholder="App Name"
|
|
||||||
disabled={isSaving}
|
|
||||||
/>
|
|
||||||
<Textarea
|
|
||||||
value={formData.about}
|
|
||||||
onChange={e => updateField('about', e.target.value)}
|
|
||||||
placeholder="A short description of your app..."
|
|
||||||
rows={2}
|
|
||||||
disabled={isSaving}
|
|
||||||
className="resize-none"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Website */}
|
|
||||||
<div className="space-y-1.5">
|
|
||||||
<Label htmlFor="app-website" className="text-xs text-muted-foreground">Website</Label>
|
|
||||||
<Input
|
|
||||||
id="app-website"
|
|
||||||
value={formData.website}
|
|
||||||
onChange={e => updateField('website', e.target.value)}
|
|
||||||
placeholder={deployedUrl || 'https://myapp.example.com'}
|
|
||||||
disabled={isSaving}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Existing app coordinate info */}
|
|
||||||
{aTag && (
|
|
||||||
<div className="text-xs text-muted-foreground space-y-1">
|
|
||||||
<p className="font-medium">Nostr Coordinate</p>
|
|
||||||
<code className="block p-2 bg-muted rounded text-xs break-all select-all">{aTag}</code>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Advanced Section */}
|
|
||||||
<Collapsible open={advancedOpen} onOpenChange={setAdvancedOpen}>
|
|
||||||
<CollapsibleTrigger asChild>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="flex items-center gap-2 w-full text-sm text-muted-foreground hover:text-foreground transition-colors py-2 border-t"
|
|
||||||
>
|
|
||||||
<ChevronDown className={`h-4 w-4 transition-transform ${advancedOpen ? 'rotate-180' : ''}`} />
|
|
||||||
<span>Advanced</span>
|
|
||||||
</button>
|
|
||||||
</CollapsibleTrigger>
|
|
||||||
<CollapsibleContent>
|
|
||||||
<div className="space-y-4 pt-2">
|
|
||||||
{/* Hint to use AI */}
|
|
||||||
<div className="flex items-start gap-2 text-xs text-muted-foreground bg-muted/50 rounded-lg p-3">
|
|
||||||
<CircleHelp className="h-3.5 w-3.5 mt-0.5 flex-shrink-0" />
|
|
||||||
<span>Not sure? Ask Shakespeare to update your app.</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Identifier (d-tag) */}
|
|
||||||
<div className="space-y-1.5">
|
|
||||||
<Label htmlFor="app-dtag" className="text-xs">Identifier</Label>
|
|
||||||
<Input
|
|
||||||
id="app-dtag"
|
|
||||||
value={formData.dTag}
|
|
||||||
onChange={e => updateField('dTag', e.target.value)}
|
|
||||||
placeholder="my-app"
|
|
||||||
disabled={isSaving || hasApp}
|
|
||||||
/>
|
|
||||||
<p className="text-xs text-muted-foreground">
|
|
||||||
{hasApp ? 'Cannot be changed after publishing.' : 'Unique identifier for this app. Defaults to the project ID.'}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Supported Kinds */}
|
|
||||||
<div className="space-y-1.5">
|
|
||||||
<Label className="text-xs">Supported Event Kinds</Label>
|
|
||||||
{formData.supportedKinds.length > 0 && (
|
|
||||||
<div className="flex flex-wrap gap-1">
|
|
||||||
{formData.supportedKinds.map(kind => (
|
|
||||||
<Badge key={kind} variant="secondary" className="gap-1">
|
|
||||||
{kind}
|
|
||||||
<button
|
|
||||||
onClick={() => removeKind(kind)}
|
|
||||||
disabled={isSaving}
|
|
||||||
className="hover:text-destructive"
|
|
||||||
>
|
|
||||||
<X className="h-3 w-3" />
|
|
||||||
</button>
|
|
||||||
</Badge>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div className="flex gap-2">
|
|
||||||
<Input
|
|
||||||
value={newKind}
|
|
||||||
onChange={e => setNewKind(e.target.value)}
|
|
||||||
placeholder="Kind number (e.g. 1)"
|
|
||||||
disabled={isSaving}
|
|
||||||
onKeyDown={e => {
|
|
||||||
if (e.key === 'Enter') {
|
|
||||||
e.preventDefault();
|
|
||||||
addKind();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
className="flex-1"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
size="sm"
|
|
||||||
onClick={addKind}
|
|
||||||
disabled={isSaving || !newKind.trim()}
|
|
||||||
className="h-9"
|
|
||||||
>
|
|
||||||
<Plus className="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Web Handlers */}
|
|
||||||
<div className="space-y-1.5">
|
|
||||||
<Label className="text-xs">Web Handlers</Label>
|
|
||||||
{formData.webHandlers.length > 0 && (
|
|
||||||
<div className="space-y-1.5">
|
|
||||||
{formData.webHandlers.map((handler, index) => (
|
|
||||||
<div key={index} className="flex items-center gap-2 text-sm bg-muted/50 p-2 rounded-md">
|
|
||||||
<ExternalLink className="h-3 w-3 text-muted-foreground flex-shrink-0" />
|
|
||||||
<span className="truncate flex-1">{handler.url}</span>
|
|
||||||
{handler.type && (
|
|
||||||
<Badge variant="outline" className="text-xs flex-shrink-0">{handler.type}</Badge>
|
|
||||||
)}
|
|
||||||
<button
|
|
||||||
onClick={() => removeHandler(index)}
|
|
||||||
disabled={isSaving}
|
|
||||||
className="hover:text-destructive flex-shrink-0"
|
|
||||||
>
|
|
||||||
<X className="h-3 w-3" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div className="flex gap-2">
|
|
||||||
<Input
|
|
||||||
value={newHandlerUrl}
|
|
||||||
onChange={e => setNewHandlerUrl(e.target.value)}
|
|
||||||
placeholder="https://app.example.com/e/<bech32>"
|
|
||||||
disabled={isSaving}
|
|
||||||
className="flex-1"
|
|
||||||
/>
|
|
||||||
<Input
|
|
||||||
value={newHandlerType}
|
|
||||||
onChange={e => setNewHandlerType(e.target.value)}
|
|
||||||
placeholder="nevent"
|
|
||||||
disabled={isSaving}
|
|
||||||
className="w-24"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
size="sm"
|
|
||||||
onClick={addHandler}
|
|
||||||
disabled={isSaving || !newHandlerUrl.trim()}
|
|
||||||
className="h-9"
|
|
||||||
>
|
|
||||||
<Plus className="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<p className="text-xs text-muted-foreground">
|
|
||||||
URL patterns where <code className="text-xs">{'<bech32>'}</code> will be replaced with the NIP-19 entity.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</CollapsibleContent>
|
|
||||||
</Collapsible>
|
|
||||||
|
|
||||||
{/* Save Button */}
|
|
||||||
<Button
|
|
||||||
onClick={handleSave}
|
|
||||||
disabled={isSaving || !formData.name.trim()}
|
|
||||||
className="w-full gap-2"
|
|
||||||
>
|
|
||||||
{isSaving ? (
|
|
||||||
<Loader2 className="h-4 w-4 animate-spin" />
|
|
||||||
) : (
|
|
||||||
<Save className="h-4 w-4" />
|
|
||||||
)}
|
|
||||||
{isSaving
|
|
||||||
? (hasApp ? 'Updating...' : 'Publishing...')
|
|
||||||
: (hasApp ? 'Update App' : 'Publish App')}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -60,8 +60,6 @@ const AppConfigSchema = z.object({
|
|||||||
sentryDsn: z.string(),
|
sentryDsn: z.string(),
|
||||||
sentryEnabled: z.boolean(),
|
sentryEnabled: z.boolean(),
|
||||||
systemPrompt: z.string(),
|
systemPrompt: z.string(),
|
||||||
plausibleDomain: z.string(),
|
|
||||||
plausibleEndpoint: z.string(),
|
|
||||||
}) satisfies z.ZodType<AppConfig>;
|
}) satisfies z.ZodType<AppConfig>;
|
||||||
|
|
||||||
export function AppProvider(props: AppProviderProps) {
|
export function AppProvider(props: AppProviderProps) {
|
||||||
|
|||||||
@@ -170,17 +170,17 @@ export function BranchSwitcher({ projectId, className }: BranchSwitcherProps) {
|
|||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
className={cn("gap-1 sm:gap-2 hover:bg-secondary/10 hover:border-secondary/20", className)}
|
className={cn("h-7 text-xs gap-1.5", className)}
|
||||||
disabled={isSwitching}
|
disabled={isSwitching}
|
||||||
>
|
>
|
||||||
{isSwitching ? (
|
{isSwitching ? (
|
||||||
<Loader2 className="h-4 w-4 animate-spin" />
|
<Loader2 className="h-3 w-3 animate-spin" />
|
||||||
) : (
|
) : (
|
||||||
<GitBranch className="h-4 w-4" />
|
<GitBranch className="h-3 w-3" />
|
||||||
)}
|
)}
|
||||||
<span className=" max-w-[120px] truncate">{currentBranch}</span>
|
<span className="max-w-[120px] truncate">{currentBranch}</span>
|
||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align="end" className="w-56">
|
<DropdownMenuContent align="end" className="w-56">
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
import { useEffect, useState } from 'react';
|
|
||||||
import {
|
|
||||||
AlertDialog,
|
|
||||||
AlertDialogContent,
|
|
||||||
AlertDialogDescription,
|
|
||||||
AlertDialogHeader,
|
|
||||||
AlertDialogTitle,
|
|
||||||
} from '@/components/ui/alert-dialog';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Detects if IndexedDB is unavailable (which happens in iOS lockdown mode)
|
|
||||||
* and displays a blocking alert dialog informing the user.
|
|
||||||
*/
|
|
||||||
export function LockdownModeDetector() {
|
|
||||||
const [isLockdownMode, setIsLockdownMode] = useState(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
// Check if IndexedDB is available
|
|
||||||
const checkIndexedDB = async () => {
|
|
||||||
try {
|
|
||||||
// Check if IndexedDB exists
|
|
||||||
if (!window.indexedDB) {
|
|
||||||
setIsLockdownMode(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to open a test database to verify IndexedDB actually works
|
|
||||||
// In iOS lockdown mode, indexedDB exists but throws errors when used
|
|
||||||
const testDBName = '_shakespeare_lockdown_test';
|
|
||||||
const request = window.indexedDB.open(testDBName, 1);
|
|
||||||
|
|
||||||
request.onerror = () => {
|
|
||||||
setIsLockdownMode(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
request.onsuccess = () => {
|
|
||||||
// IndexedDB is working, clean up test database
|
|
||||||
request.result.close();
|
|
||||||
window.indexedDB.deleteDatabase(testDBName);
|
|
||||||
};
|
|
||||||
} catch {
|
|
||||||
// Any error means IndexedDB is not available
|
|
||||||
setIsLockdownMode(true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
checkIndexedDB();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<AlertDialog open={isLockdownMode}>
|
|
||||||
<AlertDialogContent>
|
|
||||||
<AlertDialogHeader>
|
|
||||||
<AlertDialogTitle className="text-left">🔒 Lockdown Mode Detected</AlertDialogTitle>
|
|
||||||
<AlertDialogDescription className="space-y-3 text-left">
|
|
||||||
<p>
|
|
||||||
Shakespeare requires IndexedDB to function, which is unavailable in iOS Lockdown Mode.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
To use Shakespeare, please disable Lockdown Mode in your device settings:
|
|
||||||
</p>
|
|
||||||
<ol className="list-decimal list-inside space-y-1 text-left ml-4">
|
|
||||||
<li>Open Settings</li>
|
|
||||||
<li>Go to Privacy & Security</li>
|
|
||||||
<li>Tap Lockdown Mode</li>
|
|
||||||
<li>Turn off Lockdown Mode</li>
|
|
||||||
</ol>
|
|
||||||
</AlertDialogDescription>
|
|
||||||
</AlertDialogHeader>
|
|
||||||
</AlertDialogContent>
|
|
||||||
</AlertDialog>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import { ReactNode, useEffect, useRef } from 'react';
|
|
||||||
import { useAppContext } from '@/hooks/useAppContext';
|
|
||||||
|
|
||||||
interface PlausibleProviderProps {
|
|
||||||
children: ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reactively initializes Plausible Analytics from AppConfig.
|
|
||||||
* Plausible's `init()` can only be called once, so we guard with a ref.
|
|
||||||
*/
|
|
||||||
export function PlausibleProvider({ children }: PlausibleProviderProps) {
|
|
||||||
const { config } = useAppContext();
|
|
||||||
const initializedRef = useRef(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (initializedRef.current || !config.plausibleDomain) return;
|
|
||||||
initializedRef.current = true;
|
|
||||||
|
|
||||||
import('@plausible-analytics/tracker').then(({ init }) => {
|
|
||||||
init({
|
|
||||||
domain: config.plausibleDomain,
|
|
||||||
...(config.plausibleEndpoint && { endpoint: config.plausibleEndpoint }),
|
|
||||||
});
|
|
||||||
}).catch(console.error);
|
|
||||||
}, [config.plausibleDomain, config.plausibleEndpoint]);
|
|
||||||
|
|
||||||
return <>{children}</>;
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,6 @@ import {
|
|||||||
ChevronDown,
|
ChevronDown,
|
||||||
Trash2,
|
Trash2,
|
||||||
Star,
|
Star,
|
||||||
AppWindow,
|
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { useLocalStorage } from '@/hooks/useLocalStorage';
|
import { useLocalStorage } from '@/hooks/useLocalStorage';
|
||||||
@@ -28,7 +27,6 @@ interface ProjectTitleMenuProps {
|
|||||||
onDuplicate: () => void;
|
onDuplicate: () => void;
|
||||||
onDelete: () => void;
|
onDelete: () => void;
|
||||||
onProjectDetails: () => void;
|
onProjectDetails: () => void;
|
||||||
onApp: () => void;
|
|
||||||
isAnyLoading: boolean;
|
isAnyLoading: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
@@ -41,7 +39,6 @@ export function ProjectTitleMenu({
|
|||||||
onDuplicate,
|
onDuplicate,
|
||||||
onDelete,
|
onDelete,
|
||||||
onProjectDetails,
|
onProjectDetails,
|
||||||
onApp,
|
|
||||||
isAnyLoading,
|
isAnyLoading,
|
||||||
className = '',
|
className = '',
|
||||||
}: ProjectTitleMenuProps) {
|
}: ProjectTitleMenuProps) {
|
||||||
@@ -101,15 +98,6 @@ export function ProjectTitleMenu({
|
|||||||
Project Details
|
Project Details
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
|
|
||||||
<DropdownMenuItem
|
|
||||||
onClick={onApp}
|
|
||||||
disabled={isAnyLoading}
|
|
||||||
className="gap-2"
|
|
||||||
>
|
|
||||||
<AppWindow className="h-4 w-4" />
|
|
||||||
App
|
|
||||||
</DropdownMenuItem>
|
|
||||||
|
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
onClick={onGitHistory}
|
onClick={onGitHistory}
|
||||||
disabled={isAnyLoading}
|
disabled={isAnyLoading}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import {
|
|||||||
import type { DeployProvider } from '@/contexts/DeploySettingsContext';
|
import type { DeployProvider } from '@/contexts/DeploySettingsContext';
|
||||||
import type { PresetDeployProvider } from '@/lib/deploy/types';
|
import type { PresetDeployProvider } from '@/lib/deploy/types';
|
||||||
import { ExternalFavicon } from '@/components/ExternalFavicon';
|
import { ExternalFavicon } from '@/components/ExternalFavicon';
|
||||||
import { UrlListEditor } from '@/components/UrlListEditor';
|
|
||||||
|
|
||||||
interface ProviderConfigDialogProps {
|
interface ProviderConfigDialogProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@@ -139,22 +138,34 @@ export function ProviderConfigDialog({
|
|||||||
onChange={(e) => setLocalProvider({ ...localProvider, gateway: e.target.value })}
|
onChange={(e) => setLocalProvider({ ...localProvider, gateway: e.target.value })}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<UrlListEditor
|
<div className="grid gap-2">
|
||||||
label="Relay URLs"
|
<Label htmlFor="provider-relays">
|
||||||
items={localProvider.relayUrls ?? []}
|
Relay URLs (comma-separated) <span className="text-destructive">*</span>
|
||||||
onChange={(urls) => setLocalProvider({ ...localProvider, relayUrls: urls })}
|
</Label>
|
||||||
protocol="wss"
|
<Input
|
||||||
placeholder="relay.ditto.pub"
|
id="provider-relays"
|
||||||
required
|
placeholder="wss://relay.nostr.band, wss://relay.damus.io"
|
||||||
/>
|
value={localProvider.relayUrls?.join(', ') || ''}
|
||||||
<UrlListEditor
|
onChange={(e) => setLocalProvider({
|
||||||
label="Blossom Servers"
|
...localProvider,
|
||||||
items={localProvider.blossomServers ?? []}
|
relayUrls: e.target.value.split(',').map(s => s.trim()).filter(Boolean)
|
||||||
onChange={(servers) => setLocalProvider({ ...localProvider, blossomServers: servers })}
|
})}
|
||||||
protocol="https"
|
/>
|
||||||
placeholder="blossom.primal.net"
|
</div>
|
||||||
required
|
<div className="grid gap-2">
|
||||||
/>
|
<Label htmlFor="provider-blossom">
|
||||||
|
Blossom Servers (comma-separated) <span className="text-destructive">*</span>
|
||||||
|
</Label>
|
||||||
|
<Input
|
||||||
|
id="provider-blossom"
|
||||||
|
placeholder="https://blossom.primal.net/"
|
||||||
|
value={localProvider.blossomServers?.join(', ') || ''}
|
||||||
|
onChange={(e) => setLocalProvider({
|
||||||
|
...localProvider,
|
||||||
|
blossomServers: e.target.value.split(',').map(s => s.trim()).filter(Boolean)
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -45,8 +45,6 @@ describe('SentryProvider', () => {
|
|||||||
fsPathTmp: '/tmp',
|
fsPathTmp: '/tmp',
|
||||||
fsPathPlugins: '/plugins',
|
fsPathPlugins: '/plugins',
|
||||||
fsPathTemplates: '/templates',
|
fsPathTemplates: '/templates',
|
||||||
plausibleDomain: '',
|
|
||||||
plausibleEndpoint: '',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render(
|
render(
|
||||||
@@ -89,8 +87,6 @@ describe('SentryProvider', () => {
|
|||||||
fsPathTmp: '/tmp',
|
fsPathTmp: '/tmp',
|
||||||
fsPathPlugins: '/plugins',
|
fsPathPlugins: '/plugins',
|
||||||
fsPathTemplates: '/templates',
|
fsPathTemplates: '/templates',
|
||||||
plausibleDomain: '',
|
|
||||||
plausibleEndpoint: '',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render(
|
render(
|
||||||
@@ -134,8 +130,6 @@ describe('SentryProvider', () => {
|
|||||||
fsPathTmp: '/tmp',
|
fsPathTmp: '/tmp',
|
||||||
fsPathPlugins: '/plugins',
|
fsPathPlugins: '/plugins',
|
||||||
fsPathTemplates: '/templates',
|
fsPathTemplates: '/templates',
|
||||||
plausibleDomain: '',
|
|
||||||
plausibleEndpoint: '',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render(
|
render(
|
||||||
@@ -182,8 +176,6 @@ describe('SentryProvider', () => {
|
|||||||
fsPathTmp: '/tmp',
|
fsPathTmp: '/tmp',
|
||||||
fsPathPlugins: '/plugins',
|
fsPathPlugins: '/plugins',
|
||||||
fsPathTemplates: '/templates',
|
fsPathTemplates: '/templates',
|
||||||
plausibleDomain: '',
|
|
||||||
plausibleEndpoint: '',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render(
|
render(
|
||||||
|
|||||||
@@ -35,9 +35,6 @@ import { NostrReadProtocolTool } from '@/lib/tools/NostrReadProtocolTool';
|
|||||||
import { NostrReadNipsIndexTool } from '@/lib/tools/NostrReadNipsIndexTool';
|
import { NostrReadNipsIndexTool } from '@/lib/tools/NostrReadNipsIndexTool';
|
||||||
import { NostrGenerateKindTool } from '@/lib/tools/NostrGenerateKindTool';
|
import { NostrGenerateKindTool } from '@/lib/tools/NostrGenerateKindTool';
|
||||||
import { NostrPublishEventsTool } from '@/lib/tools/NostrPublishEventsTool';
|
import { NostrPublishEventsTool } from '@/lib/tools/NostrPublishEventsTool';
|
||||||
import { NostrEncodeTool } from '@/lib/tools/NostrEncodeTool';
|
|
||||||
import { NostrDecodeTool } from '@/lib/tools/NostrDecodeTool';
|
|
||||||
import { BlossomUploadTool } from '@/lib/tools/BlossomUploadTool';
|
|
||||||
import { ShellTool } from '@/lib/tools/ShellTool';
|
import { ShellTool } from '@/lib/tools/ShellTool';
|
||||||
import { ReadConsoleMessagesTool } from '@/lib/tools/ReadConsoleMessagesTool';
|
import { ReadConsoleMessagesTool } from '@/lib/tools/ReadConsoleMessagesTool';
|
||||||
import { SkillTool } from '@/lib/tools/SkillTool';
|
import { SkillTool } from '@/lib/tools/SkillTool';
|
||||||
@@ -49,7 +46,6 @@ import { WebSearchTool } from '@/lib/tools/WebSearchTool';
|
|||||||
import { createMCPTools } from '@/lib/tools/MCPTool';
|
import { createMCPTools } from '@/lib/tools/MCPTool';
|
||||||
import { TodoWriteTool } from '@/lib/tools/TodoWriteTool';
|
import { TodoWriteTool } from '@/lib/tools/TodoWriteTool';
|
||||||
import { TodoReadTool } from '@/lib/tools/TodoReadTool';
|
import { TodoReadTool } from '@/lib/tools/TodoReadTool';
|
||||||
import { AppTool } from '@/lib/tools/AppTool';
|
|
||||||
import { ProjectPreviewConsoleError } from '@/lib/consoleMessages';
|
import { ProjectPreviewConsoleError } from '@/lib/consoleMessages';
|
||||||
import { toolToOpenAI } from '@/lib/tools/openai-adapter';
|
import { toolToOpenAI } from '@/lib/tools/openai-adapter';
|
||||||
import { Tool } from '@/lib/tools/Tool';
|
import { Tool } from '@/lib/tools/Tool';
|
||||||
@@ -221,9 +217,6 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
|||||||
nostr_read_nips_index: new NostrReadNipsIndexTool(),
|
nostr_read_nips_index: new NostrReadNipsIndexTool(),
|
||||||
nostr_generate_kind: new NostrGenerateKindTool(),
|
nostr_generate_kind: new NostrGenerateKindTool(),
|
||||||
nostr_publish_events: new NostrPublishEventsTool(),
|
nostr_publish_events: new NostrPublishEventsTool(),
|
||||||
nostr_encode: new NostrEncodeTool(),
|
|
||||||
nostr_decode: new NostrDecodeTool(),
|
|
||||||
blossom_upload: new BlossomUploadTool(fs, cwd, user?.signer),
|
|
||||||
shell: new ShellTool(fs, cwd, git, config.corsProxy, user?.signer),
|
shell: new ShellTool(fs, cwd, git, config.corsProxy, user?.signer),
|
||||||
read_console_messages: new ReadConsoleMessagesTool(),
|
read_console_messages: new ReadConsoleMessagesTool(),
|
||||||
skill: new SkillTool(fs, availableSkills),
|
skill: new SkillTool(fs, availableSkills),
|
||||||
@@ -231,13 +224,6 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
|||||||
websearch: new WebSearchTool(),
|
websearch: new WebSearchTool(),
|
||||||
todowrite: new TodoWriteTool(fs, projectId, { projectsPath }),
|
todowrite: new TodoWriteTool(fs, projectId, { projectsPath }),
|
||||||
todoread: new TodoReadTool(fs, projectId, { projectsPath }),
|
todoread: new TodoReadTool(fs, projectId, { projectsPath }),
|
||||||
app: new AppTool(
|
|
||||||
fs,
|
|
||||||
cwd,
|
|
||||||
user?.signer,
|
|
||||||
user?.pubkey,
|
|
||||||
config.relayMetadata.relays.filter(r => r.write).map(r => r.url),
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add generate_image tool if imageModel is configured
|
// Add generate_image tool if imageModel is configured
|
||||||
@@ -289,7 +275,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return tools;
|
return tools;
|
||||||
}, [fs, git, cwd, user, projectsPath, tmpPath, config.corsProxy, config.relayMetadata, settings, aiSettings, models, handleFileChanged, handleCommit, projectId, availableSkills]);
|
}, [fs, git, cwd, user, projectsPath, tmpPath, config.corsProxy, settings, aiSettings, models, handleFileChanged, handleCommit, projectId, availableSkills]);
|
||||||
|
|
||||||
// MCP tools wrapped for execution
|
// MCP tools wrapped for execution
|
||||||
const mcpToolWrappers = useMemo(() => createMCPTools(mcpClients), [mcpClients]);
|
const mcpToolWrappers = useMemo(() => createMCPTools(mcpClients), [mcpClients]);
|
||||||
|
|||||||
@@ -1,140 +1,37 @@
|
|||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { Button } from '@/components/ui/button';
|
|
||||||
import { Textarea } from '@/components/ui/textarea';
|
import { Textarea } from '@/components/ui/textarea';
|
||||||
import { CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
import { ImageOff } from 'lucide-react';
|
||||||
import { Save, Loader2, ImageOff } from 'lucide-react';
|
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { useGitStatus } from '@/hooks/useGitStatus';
|
|
||||||
import { isMediaFile } from '@/lib/fileUtils';
|
import { isMediaFile } from '@/lib/fileUtils';
|
||||||
|
|
||||||
interface FileEditorProps {
|
interface FileEditorProps {
|
||||||
filePath: string;
|
filePath: string;
|
||||||
content: string;
|
content: string;
|
||||||
onSave: (content: string) => void;
|
onContentChange: (content: string) => void;
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
projectId?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function FileEditor({ filePath, content, onSave, isLoading, projectId }: FileEditorProps) {
|
export function FileEditor({ filePath, content, onContentChange, isLoading }: FileEditorProps) {
|
||||||
const { t } = useTranslation();
|
|
||||||
const [editedContent, setEditedContent] = useState(content);
|
const [editedContent, setEditedContent] = useState(content);
|
||||||
const [isSaving, setIsSaving] = useState(false);
|
const isMedia = isMediaFile(filePath);
|
||||||
const [hasChanges, setHasChanges] = useState(false);
|
|
||||||
const { data: gitStatus } = useGitStatus(projectId || null);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setEditedContent(content);
|
setEditedContent(content);
|
||||||
setHasChanges(false);
|
|
||||||
}, [content, filePath]);
|
}, [content, filePath]);
|
||||||
|
|
||||||
useEffect(() => {
|
const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
||||||
setHasChanges(editedContent !== content);
|
const newContent = e.target.value;
|
||||||
}, [editedContent, content]);
|
setEditedContent(newContent);
|
||||||
|
onContentChange(newContent);
|
||||||
const handleSave = async () => {
|
|
||||||
setIsSaving(true);
|
|
||||||
try {
|
|
||||||
await onSave(editedContent);
|
|
||||||
setHasChanges(false);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to save file:', error);
|
|
||||||
} finally {
|
|
||||||
setIsSaving(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getLanguageFromPath = (path: string): string => {
|
|
||||||
const extension = path.split('.').pop()?.toLowerCase();
|
|
||||||
const languageMap: Record<string, string> = {
|
|
||||||
js: 'javascript',
|
|
||||||
jsx: 'javascript',
|
|
||||||
ts: 'typescript',
|
|
||||||
tsx: 'typescript',
|
|
||||||
html: 'html',
|
|
||||||
css: 'css',
|
|
||||||
json: 'json',
|
|
||||||
md: 'markdown',
|
|
||||||
py: 'python',
|
|
||||||
java: 'java',
|
|
||||||
cpp: 'cpp',
|
|
||||||
c: 'c',
|
|
||||||
sh: 'bash',
|
|
||||||
yml: 'yaml',
|
|
||||||
yaml: 'yaml',
|
|
||||||
};
|
|
||||||
return languageMap[extension || ''] || 'text';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMonospaceFont = () => {
|
const getMonospaceFont = () => {
|
||||||
return 'font-mono text-sm';
|
return 'font-mono text-sm';
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper function to get git status for the current file
|
|
||||||
const getFileGitStatus = (filePath: string) => {
|
|
||||||
if (!gitStatus?.changedFiles) return null;
|
|
||||||
const fileChange = gitStatus.changedFiles.find(change => change.filepath === filePath);
|
|
||||||
return fileChange?.status || null;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Helper function to get styling classes based on git status
|
|
||||||
const getGitStatusClasses = (status: string | null) => {
|
|
||||||
switch (status) {
|
|
||||||
case 'added':
|
|
||||||
case 'untracked':
|
|
||||||
return 'text-green-600 dark:text-green-400';
|
|
||||||
case 'modified':
|
|
||||||
case 'staged':
|
|
||||||
return 'text-yellow-600 dark:text-yellow-400';
|
|
||||||
default:
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Get git status for the current file
|
|
||||||
const currentFileGitStatus = getFileGitStatus(filePath);
|
|
||||||
const gitStatusClasses = getGitStatusClasses(currentFileGitStatus);
|
|
||||||
const isMedia = isMediaFile(filePath);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-full flex flex-col">
|
<div className="h-full flex flex-col">
|
||||||
<CardHeader className="border-b py-2 sm:py-3">
|
<div className="flex-1 p-0">
|
||||||
<div className="flex items-center justify-between">
|
|
||||||
<CardTitle className={cn("text-sm sm:text-base truncate flex-1 mr-2", gitStatusClasses)}>{filePath}</CardTitle>
|
|
||||||
<div className="flex items-center space-x-1 sm:space-x-2">
|
|
||||||
{hasChanges && !isMedia && (
|
|
||||||
<span className="text-xs sm:text-sm text-muted-foreground hidden sm:inline">{t('unsavedChanges')}</span>
|
|
||||||
)}
|
|
||||||
{!isMedia && (
|
|
||||||
<Button
|
|
||||||
onClick={handleSave}
|
|
||||||
disabled={!hasChanges || isSaving || isLoading}
|
|
||||||
size="sm"
|
|
||||||
className="focus-ring"
|
|
||||||
>
|
|
||||||
{isSaving ? (
|
|
||||||
<>
|
|
||||||
<Loader2 className="mr-1 sm:mr-2 h-4 w-4 animate-spin" />
|
|
||||||
<span className="hidden sm:inline">{t('saving')}</span>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<Save className="sm:mr-2 h-4 w-4" />
|
|
||||||
<span className="hidden sm:inline">{t('save')}</span>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{!isMedia && (
|
|
||||||
<div className="text-xs text-muted-foreground mt-1">
|
|
||||||
{t('languageLabel')}: {getLanguageFromPath(filePath)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</CardHeader>
|
|
||||||
|
|
||||||
<CardContent className="flex-1 p-0">
|
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<div className="flex items-center justify-center h-full">
|
<div className="flex items-center justify-center h-full">
|
||||||
<div className="animate-spin rounded-full h-6 w-6 border-b-2 border-primary"></div>
|
<div className="animate-spin rounded-full h-6 w-6 border-b-2 border-primary"></div>
|
||||||
@@ -146,7 +43,7 @@ export function FileEditor({ filePath, content, onSave, isLoading, projectId }:
|
|||||||
) : (
|
) : (
|
||||||
<Textarea
|
<Textarea
|
||||||
value={editedContent}
|
value={editedContent}
|
||||||
onChange={(e) => setEditedContent(e.target.value)}
|
onChange={handleChange}
|
||||||
className={cn(
|
className={cn(
|
||||||
'w-full h-full resize-none border-0 rounded-none',
|
'w-full h-full resize-none border-0 rounded-none',
|
||||||
'focus:outline-none focus:ring-0',
|
'focus:outline-none focus:ring-0',
|
||||||
@@ -157,7 +54,7 @@ export function FileEditor({ filePath, content, onSave, isLoading, projectId }:
|
|||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</CardContent>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,8 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { useProjectsManager } from '@/hooks/useProjectsManager';
|
import { useProjectsManager } from '@/hooks/useProjectsManager';
|
||||||
import { useFS } from '@/hooks/useFS';
|
import { useFS } from '@/hooks/useFS';
|
||||||
import { useGitStatus } from '@/hooks/useGitStatus';
|
import { useGitStatus } from '@/hooks/useGitStatus';
|
||||||
import { ChevronRight, ChevronDown, File, Folder, Search } from 'lucide-react';
|
import { ChevronRight, ChevronDown, File, Folder, Search, Code, FileText, Image, FileJson, Palette, Settings, FileCode } from 'lucide-react';
|
||||||
|
import type { LucideIcon } from 'lucide-react';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { createGitignoreFilter, normalizePathForGitignore } from '@/lib/gitignore';
|
import { createGitignoreFilter, normalizePathForGitignore } from '@/lib/gitignore';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
@@ -22,6 +23,49 @@ interface FileNode {
|
|||||||
isOpen?: boolean;
|
isOpen?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper function to get file icon based on extension
|
||||||
|
function getFileIcon(fileName: string): { icon: LucideIcon; color: string } {
|
||||||
|
const ext = fileName.split('.').pop()?.toLowerCase() || '';
|
||||||
|
|
||||||
|
// Image files - subtle blue hint
|
||||||
|
if (['jpg', 'jpeg', 'png', 'gif', 'svg', 'webp', 'ico', 'bmp', 'tiff'].includes(ext)) {
|
||||||
|
return { icon: Image, color: 'text-blue-400/60' };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code files - subtle amber hint
|
||||||
|
if (['js', 'jsx', 'ts', 'tsx', 'py', 'java', 'cpp', 'c', 'cs', 'php', 'rb', 'go', 'rs', 'swift', 'kt', 'scala', 'dart'].includes(ext)) {
|
||||||
|
return { icon: Code, color: 'text-amber-400/60' };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Web files - subtle orange hint
|
||||||
|
if (['html', 'htm', 'xhtml'].includes(ext)) {
|
||||||
|
return { icon: FileCode, color: 'text-orange-400/60' };
|
||||||
|
}
|
||||||
|
|
||||||
|
// CSS files - subtle purple hint
|
||||||
|
if (['css', 'scss', 'sass', 'less', 'styl'].includes(ext)) {
|
||||||
|
return { icon: Palette, color: 'text-purple-400/60' };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Data/Config files - subtle green hint
|
||||||
|
if (['json', 'jsonc'].includes(ext)) {
|
||||||
|
return { icon: FileJson, color: 'text-green-400/60' };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Config files - subtle amber hint
|
||||||
|
if (['xml', 'yaml', 'yml', 'toml', 'ini', 'conf', 'config'].includes(ext)) {
|
||||||
|
return { icon: Settings, color: 'text-amber-400/60' };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Text/Markdown files - subtle amber hint
|
||||||
|
if (['txt', 'md', 'markdown', 'rst', 'log'].includes(ext)) {
|
||||||
|
return { icon: FileText, color: 'text-amber-400/60' };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default file icon - subtle amber hint
|
||||||
|
return { icon: File, color: 'text-amber-400/60' };
|
||||||
|
}
|
||||||
|
|
||||||
export function FileTree({ projectId, onFileSelect, selectedFile }: FileTreeProps) {
|
export function FileTree({ projectId, onFileSelect, selectedFile }: FileTreeProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [tree, setTree] = useState<FileNode[]>([]);
|
const [tree, setTree] = useState<FileNode[]>([]);
|
||||||
@@ -264,7 +308,10 @@ export function FileTree({ projectId, onFileSelect, selectedFile }: FileTreeProp
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div className="w-4" /> {/* Spacer for alignment */}
|
<div className="w-4" /> {/* Spacer for alignment */}
|
||||||
<File className={cn("h-4 w-4 text-gray-500 flex-shrink-0", gitignoreClasses)} />
|
{(() => {
|
||||||
|
const { icon: Icon, color } = getFileIcon(node.name);
|
||||||
|
return <Icon className={cn("h-4 w-4 flex-shrink-0", color, gitignoreClasses)} />;
|
||||||
|
})()}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<span className={cn("text-sm whitespace-nowrap", gitStatusClasses, gitignoreClasses)}>{node.name}</span>
|
<span className={cn("text-sm whitespace-nowrap", gitStatusClasses, gitignoreClasses)}>{node.name}</span>
|
||||||
|
|||||||
@@ -7,12 +7,10 @@ import { useFSPaths } from '@/hooks/useFSPaths';
|
|||||||
import { addConsoleMessage, getConsoleMessages, type ConsoleMessage } from '@/lib/consoleMessages';
|
import { addConsoleMessage, getConsoleMessages, type ConsoleMessage } from '@/lib/consoleMessages';
|
||||||
import { useConsoleError } from '@/hooks/useConsoleError';
|
import { useConsoleError } from '@/hooks/useConsoleError';
|
||||||
import { useBuildProject } from '@/hooks/useBuildProject';
|
import { useBuildProject } from '@/hooks/useBuildProject';
|
||||||
import { Tabs, TabsContent } from '@/components/ui/tabs';
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||||
import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area';
|
import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { FolderOpen, ArrowLeft, Bug, Copy, Check, Loader2, Code, X, Terminal, Expand, Shrink, Hammer, RefreshCw } from 'lucide-react';
|
import { FolderOpen, Bug, Copy, Check, Loader2, Code, X, Terminal, Expand, Shrink, Hammer, RefreshCw, Save } from 'lucide-react';
|
||||||
import { useIsMobile } from '@/hooks/useIsMobile';
|
|
||||||
import { GitStatusIndicator } from '@/components/GitStatusIndicator';
|
|
||||||
import { BranchSwitcher } from '@/components/BranchSwitcher';
|
import { BranchSwitcher } from '@/components/BranchSwitcher';
|
||||||
import { BrowserAddressBar } from '@/components/ui/browser-address-bar';
|
import { BrowserAddressBar } from '@/components/ui/browser-address-bar';
|
||||||
import { type DeviceMode } from '@/components/ui/device-toggle';
|
import { type DeviceMode } from '@/components/ui/device-toggle';
|
||||||
@@ -63,16 +61,16 @@ interface JSONRPCResponse {
|
|||||||
id: number;
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable = true }: PreviewPaneProps) {
|
export function PreviewPane({ projectId, activeTab, onToggleView: _onToggleView, isPreviewable = true }: PreviewPaneProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { config } = useAppContext();
|
const { config } = useAppContext();
|
||||||
const { previewDomain } = config;
|
const { previewDomain } = config;
|
||||||
const [selectedFile, setSelectedFile] = useState<string | null>(null);
|
const [openFiles, setOpenFiles] = useState<string[]>([]);
|
||||||
const [fileContent, setFileContent] = useState<string>('');
|
const [activeFileTab, setActiveFileTab] = useState<string | null>(null);
|
||||||
|
const [fileContents, setFileContents] = useState<Record<string, string>>({});
|
||||||
|
const [editedContents, setEditedContents] = useState<Record<string, string>>({});
|
||||||
|
const [isSaving, setIsSaving] = useState(false);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [mobileCodeView, setMobileCodeView] = useState<'explorer' | 'editor' | 'terminal'>('explorer');
|
|
||||||
const [desktopCodeView, setDesktopCodeView] = useState<'files' | 'terminal'>('files');
|
|
||||||
const isMobile = useIsMobile();
|
|
||||||
const [hasBuiltProject, setHasBuiltProject] = useState(false);
|
const [hasBuiltProject, setHasBuiltProject] = useState(false);
|
||||||
const [buildError, setBuildError] = useState<string | null>(null);
|
const [buildError, setBuildError] = useState<string | null>(null);
|
||||||
const [currentPath, setCurrentPath] = useState('/');
|
const [currentPath, setCurrentPath] = useState('/');
|
||||||
@@ -82,6 +80,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
|
|||||||
const [isFullscreen, setIsFullscreen] = useState(false);
|
const [isFullscreen, setIsFullscreen] = useState(false);
|
||||||
const [deviceMode, setDeviceMode] = useState<DeviceMode>('laptop');
|
const [deviceMode, setDeviceMode] = useState<DeviceMode>('laptop');
|
||||||
const [isLogsOpen, setIsLogsOpen] = useState(false);
|
const [isLogsOpen, setIsLogsOpen] = useState(false);
|
||||||
|
const [logsPanelTab, setLogsPanelTab] = useState<'logs' | 'code' | 'terminal'>('logs');
|
||||||
const previewContainerRef = useRef<HTMLDivElement>(null);
|
const previewContainerRef = useRef<HTMLDivElement>(null);
|
||||||
const iframeRef = useRef<HTMLIFrameElement>(null);
|
const iframeRef = useRef<HTMLIFrameElement>(null);
|
||||||
const iframePanelRef = useRef<ImperativePanelHandle>(null);
|
const iframePanelRef = useRef<ImperativePanelHandle>(null);
|
||||||
@@ -125,22 +124,26 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
|
|||||||
const loadFileContent = useCallback(async (filePath: string) => {
|
const loadFileContent = useCallback(async (filePath: string) => {
|
||||||
// Skip loading media files - they can't be edited as text
|
// Skip loading media files - they can't be edited as text
|
||||||
if (isMediaFile(filePath)) {
|
if (isMediaFile(filePath)) {
|
||||||
setFileContent('');
|
setFileContents(prev => ({ ...prev, [filePath]: '' }));
|
||||||
setIsLoading(false);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't reload if we already have the content
|
||||||
|
if (fileContents[filePath]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
const content = await projectsManager.readFile(projectId, filePath);
|
const content = await projectsManager.readFile(projectId, filePath);
|
||||||
setFileContent(content);
|
setFileContents(prev => ({ ...prev, [filePath]: content }));
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
console.error('Failed to load file:', _error);
|
console.error('Failed to load file:', _error);
|
||||||
setFileContent('');
|
setFileContents(prev => ({ ...prev, [filePath]: '' }));
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
}, [projectId, projectsManager]);
|
}, [projectId, projectsManager, fileContents]);
|
||||||
|
|
||||||
const getContentType = (filename: string): string => {
|
const getContentType = (filename: string): string => {
|
||||||
const ext = filename.split('.').pop()?.toLowerCase();
|
const ext = filename.split('.').pop()?.toLowerCase();
|
||||||
@@ -416,19 +419,22 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
|
|||||||
return () => window.removeEventListener('message', handleMessage);
|
return () => window.removeEventListener('message', handleMessage);
|
||||||
}, [handleFetch, handleConsoleMessage, handleUpdateNavigationState, projectId, previewDomain]);
|
}, [handleFetch, handleConsoleMessage, handleUpdateNavigationState, projectId, previewDomain]);
|
||||||
|
|
||||||
|
// Load content for all open files
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (selectedFile) {
|
openFiles.forEach(filePath => {
|
||||||
loadFileContent(selectedFile);
|
if (!fileContents[filePath] && !isMediaFile(filePath)) {
|
||||||
}
|
loadFileContent(filePath);
|
||||||
}, [selectedFile, loadFileContent]);
|
}
|
||||||
|
});
|
||||||
|
}, [openFiles, fileContents, loadFileContent]);
|
||||||
|
|
||||||
// Reset selected file and navigation history when projectId changes
|
// Reset selected file and navigation history when projectId changes
|
||||||
const prevProjectIdRef = useRef<string>();
|
const prevProjectIdRef = useRef<string>();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSelectedFile(null);
|
setOpenFiles([]);
|
||||||
setFileContent('');
|
setActiveFileTab(null);
|
||||||
setMobileCodeView('explorer');
|
setFileContents({});
|
||||||
setDesktopCodeView('files');
|
setEditedContents({});
|
||||||
setBuildError(null);
|
setBuildError(null);
|
||||||
|
|
||||||
// Reset navigation history and state
|
// Reset navigation history and state
|
||||||
@@ -463,18 +469,61 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
|
|||||||
}, [projectId, checkForBuiltProject, refreshIframe]);
|
}, [projectId, checkForBuiltProject, refreshIframe]);
|
||||||
|
|
||||||
const handleFileSelect = (filePath: string) => {
|
const handleFileSelect = (filePath: string) => {
|
||||||
setSelectedFile(filePath);
|
// Skip media files
|
||||||
if (isMobile) {
|
if (isMediaFile(filePath)) {
|
||||||
setMobileCodeView('editor');
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to open files if not already open
|
||||||
|
if (!openFiles.includes(filePath)) {
|
||||||
|
setOpenFiles(prev => [...prev, filePath]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set as active tab
|
||||||
|
setActiveFileTab(filePath);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCloseTab = (filePath: string, e: React.MouseEvent) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
// Remove from open files
|
||||||
|
setOpenFiles(prev => prev.filter(f => f !== filePath));
|
||||||
|
|
||||||
|
// Remove from file contents
|
||||||
|
setFileContents(prev => {
|
||||||
|
const newContents = { ...prev };
|
||||||
|
delete newContents[filePath];
|
||||||
|
return newContents;
|
||||||
|
});
|
||||||
|
|
||||||
|
// If this was the active tab, switch to another tab or clear
|
||||||
|
if (activeFileTab === filePath) {
|
||||||
|
const remainingFiles = openFiles.filter(f => f !== filePath);
|
||||||
|
if (remainingFiles.length > 0) {
|
||||||
|
setActiveFileTab(remainingFiles[remainingFiles.length - 1]);
|
||||||
|
} else {
|
||||||
|
setActiveFileTab(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFileSave = async (content: string) => {
|
const handleFileSave = async () => {
|
||||||
if (!selectedFile) return;
|
if (!activeFileTab) return;
|
||||||
|
|
||||||
|
const contentToSave = editedContents[activeFileTab];
|
||||||
|
if (contentToSave === undefined || contentToSave === fileContents[activeFileTab]) {
|
||||||
|
return; // No changes to save
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsSaving(true);
|
||||||
try {
|
try {
|
||||||
await fs.writeFile(`${projectsPath}/${projectId}/${selectedFile}`, content);
|
await fs.writeFile(`${projectsPath}/${projectId}/${activeFileTab}`, contentToSave);
|
||||||
setFileContent(content);
|
setFileContents(prev => ({ ...prev, [activeFileTab]: contentToSave }));
|
||||||
|
setEditedContents(prev => {
|
||||||
|
const newContents = { ...prev };
|
||||||
|
delete newContents[activeFileTab];
|
||||||
|
return newContents;
|
||||||
|
});
|
||||||
|
|
||||||
// Automatically trigger a rebuild after saving a file
|
// Automatically trigger a rebuild after saving a file
|
||||||
if (isPreviewable) {
|
if (isPreviewable) {
|
||||||
@@ -487,6 +536,8 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to save file:', error);
|
console.error('Failed to save file:', error);
|
||||||
|
} finally {
|
||||||
|
setIsSaving(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -597,18 +648,6 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
|
|||||||
)}
|
)}
|
||||||
<span className="hidden lg:inline">Build</span>
|
<span className="hidden lg:inline">Build</span>
|
||||||
</Button>
|
</Button>
|
||||||
{(!isMobile && onToggleView && isPreviewable) && (
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={onToggleView}
|
|
||||||
className="h-8 gap-2"
|
|
||||||
title={t('codeButtonTooltip')}
|
|
||||||
>
|
|
||||||
<Code className="h-4 w-4" />
|
|
||||||
<span className="hidden lg:inline">Code</span>
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
@@ -617,7 +656,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
|
|||||||
title={t('logsButtonTooltip')}
|
title={t('logsButtonTooltip')}
|
||||||
>
|
>
|
||||||
<Bug className="h-4 w-4" />
|
<Bug className="h-4 w-4" />
|
||||||
<span className="hidden lg:inline">Logs</span>
|
<span className="hidden lg:inline">Debug</span>
|
||||||
{hasConsoleErrors && (
|
{hasConsoleErrors && (
|
||||||
<span className="absolute -top-1 -right-1 h-3 w-3 rounded-full border-2 border-background bg-red-500" />
|
<span className="absolute -top-1 -right-1 h-3 w-3 rounded-full border-2 border-background bg-red-500" />
|
||||||
)}
|
)}
|
||||||
@@ -631,7 +670,6 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
|
|||||||
<ResizablePanel
|
<ResizablePanel
|
||||||
ref={iframePanelRef}
|
ref={iframePanelRef}
|
||||||
defaultSize={isLogsOpen ? 60 : 100}
|
defaultSize={isLogsOpen ? 60 : 100}
|
||||||
minSize={30}
|
|
||||||
className="min-h-0"
|
className="min-h-0"
|
||||||
>
|
>
|
||||||
<div className="h-full flex items-center justify-center min-h-0">
|
<div className="h-full flex items-center justify-center min-h-0">
|
||||||
@@ -751,35 +789,77 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
|
|||||||
collapsedSize={0}
|
collapsedSize={0}
|
||||||
>
|
>
|
||||||
{/* Logs Panel */}
|
{/* Logs Panel */}
|
||||||
<div className="h-full flex flex-col bg-background border-t overflow-hidden min-h-0 w-full min-w-0">
|
<Tabs value={logsPanelTab} onValueChange={(v) => setLogsPanelTab(v as 'logs' | 'code' | 'terminal')} className="h-full flex flex-col bg-background border-t overflow-hidden min-h-0 w-full min-w-0">
|
||||||
{/* Logs Header */}
|
{/* Logs Header */}
|
||||||
<div className="h-12 px-4 border-b flex items-center justify-between flex-shrink-0">
|
<div className="h-12 px-4 border-b flex items-center justify-between flex-shrink-0">
|
||||||
|
<TabsList className="h-8">
|
||||||
|
<TabsTrigger value="logs" className="h-7 text-xs gap-1.5">
|
||||||
|
<Bug className="h-3 w-3" />
|
||||||
|
<span>Logs</span>
|
||||||
|
{hasConsoleErrors && (
|
||||||
|
<span className="h-1.5 w-1.5 rounded-full bg-red-500" />
|
||||||
|
)}
|
||||||
|
</TabsTrigger>
|
||||||
|
<TabsTrigger value="code" className="h-7 text-xs gap-1.5">
|
||||||
|
<Code className="h-3 w-3" />
|
||||||
|
<span>Code</span>
|
||||||
|
</TabsTrigger>
|
||||||
|
<TabsTrigger value="terminal" className="h-7 text-xs gap-1.5">
|
||||||
|
<Terminal className="h-3 w-3" />
|
||||||
|
<span>Terminal</span>
|
||||||
|
</TabsTrigger>
|
||||||
|
</TabsList>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{hasConsoleErrors && (
|
{logsPanelTab === 'logs' && messageCount > 0 && (
|
||||||
<span className="h-2 w-2 rounded-full bg-red-500" />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
{messageCount > 0 && (
|
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={copyAllMessagesToClipboard}
|
onClick={copyAllMessagesToClipboard}
|
||||||
className="h-7 px-2 text-xs"
|
className="h-7 text-xs gap-1.5"
|
||||||
>
|
>
|
||||||
{copiedAll ? (
|
{copiedAll ? (
|
||||||
<>
|
<>
|
||||||
<Check className="h-3 w-3 mr-1.5 text-success" />
|
<Check className="h-3 w-3 text-success" />
|
||||||
{t('copied')}
|
<span className="hidden sm:inline">{t('copied')}</span>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Copy className="h-3 w-3 mr-1.5" />
|
<Copy className="h-3 w-3" />
|
||||||
{t('copyAll')}
|
<span className="hidden sm:inline">{t('copyAll')}</span>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
{logsPanelTab === 'code' && (
|
||||||
|
<>
|
||||||
|
<BranchSwitcher projectId={projectId} />
|
||||||
|
{activeFileTab && (() => {
|
||||||
|
const hasUnsavedChanges = editedContents[activeFileTab] !== undefined &&
|
||||||
|
editedContents[activeFileTab] !== fileContents[activeFileTab];
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
onClick={handleFileSave}
|
||||||
|
disabled={!hasUnsavedChanges || isSaving || isLoading}
|
||||||
|
className="h-7 text-xs gap-1.5"
|
||||||
|
>
|
||||||
|
{isSaving ? (
|
||||||
|
<>
|
||||||
|
<Loader2 className="h-3 w-3 animate-spin" />
|
||||||
|
<span className="hidden sm:inline">{t('saving')}</span>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<Save className="h-3 w-3" />
|
||||||
|
<span className="hidden sm:inline">{t('save')}</span>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
})()}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
@@ -790,60 +870,151 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* Logs Content */}
|
{/* Panel Content */}
|
||||||
<div className="flex-1 min-h-0 overflow-hidden w-full">
|
<div className="flex-1 min-h-0 overflow-hidden w-full">
|
||||||
<ScrollArea className="h-full w-full">
|
{/* Logs Tab */}
|
||||||
<div className="p-2 space-y-0 w-full min-w-0 max-w-full">
|
<TabsContent value="logs" className="h-full mt-0 m-0 data-[state=active]:flex data-[state=active]:flex-col">
|
||||||
{messageCount === 0 ? (
|
<ScrollArea className="flex-1 min-h-0">
|
||||||
<div className="flex flex-col items-center justify-center py-12 text-center">
|
<div className="p-2 space-y-0 w-full min-w-0 max-w-full">
|
||||||
<p className="text-sm text-muted-foreground font-medium">No console messages</p>
|
{messageCount === 0 ? (
|
||||||
<p className="text-xs text-muted-foreground mt-1">Messages from your project will appear here</p>
|
<div className="flex flex-col items-center justify-center py-12 text-center">
|
||||||
</div>
|
<p className="text-sm text-muted-foreground font-medium">No console messages</p>
|
||||||
) : (
|
<p className="text-xs text-muted-foreground mt-1">Messages from your project will appear here</p>
|
||||||
messages.map((msg, index) => (
|
</div>
|
||||||
<div
|
) : (
|
||||||
key={index}
|
messages.map((msg, index) => (
|
||||||
className="group relative py-0.5 px-1 hover:bg-muted/50 transition-colors duration-150 rounded cursor-pointer w-full max-w-full"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
copyMessageToClipboard(msg, index);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
className={cn(
|
key={index}
|
||||||
"text-xs font-mono leading-tight whitespace-pre-wrap break-words w-full min-w-0 max-w-full",
|
className="group relative py-0.5 px-1 hover:bg-muted/50 transition-colors duration-150 rounded cursor-pointer w-full max-w-full"
|
||||||
msg.level === 'error' ? "text-destructive" :
|
|
||||||
msg.level === 'warn' ? "text-warning" :
|
|
||||||
msg.level === 'info' ? "text-primary" :
|
|
||||||
"text-muted-foreground"
|
|
||||||
)}
|
|
||||||
style={{ wordBreak: 'break-word', overflowWrap: 'break-word' }}
|
|
||||||
>
|
|
||||||
{msg.message}
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
copyMessageToClipboard(msg, index);
|
copyMessageToClipboard(msg, index);
|
||||||
}}
|
}}
|
||||||
className="h-3 w-3 p-0 opacity-0 group-hover:opacity-100 transition-all duration-200 absolute right-1 top-1 hover:bg-muted/70 text-muted-foreground hover:text-foreground bg-background/80 rounded border"
|
|
||||||
>
|
>
|
||||||
{copiedMessageIndex === index ? (
|
<div
|
||||||
<Check className="h-2 w-2 text-success" />
|
className={cn(
|
||||||
) : (
|
"text-xs font-mono leading-tight whitespace-pre-wrap break-words w-full min-w-0 max-w-full",
|
||||||
<Copy className="h-2 w-2" />
|
msg.level === 'error' ? "text-destructive" :
|
||||||
)}
|
msg.level === 'warn' ? "text-warning" :
|
||||||
</Button>
|
msg.level === 'info' ? "text-primary" :
|
||||||
|
"text-muted-foreground"
|
||||||
|
)}
|
||||||
|
style={{ wordBreak: 'break-word', overflowWrap: 'break-word' }}
|
||||||
|
>
|
||||||
|
{msg.message}
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
copyMessageToClipboard(msg, index);
|
||||||
|
}}
|
||||||
|
className="h-3 w-3 p-0 opacity-0 group-hover:opacity-100 transition-all duration-200 absolute right-1 top-1 hover:bg-muted/70 text-muted-foreground hover:text-foreground bg-background/80 rounded border"
|
||||||
|
>
|
||||||
|
{copiedMessageIndex === index ? (
|
||||||
|
<Check className="h-2 w-2 text-success" />
|
||||||
|
) : (
|
||||||
|
<Copy className="h-2 w-2" />
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</ScrollArea>
|
||||||
|
</TabsContent>
|
||||||
|
{/* Code Tab */}
|
||||||
|
<TabsContent value="code" className="h-full mt-0 m-0 data-[state=active]:flex data-[state=active]:flex-col">
|
||||||
|
<div className="flex-1 min-h-0 flex">
|
||||||
|
<div className="w-1/3 border-r flex flex-col min-h-0">
|
||||||
|
<ScrollArea className="flex-1 min-h-0">
|
||||||
|
<ScrollBar orientation="horizontal" />
|
||||||
|
<div className="min-w-max">
|
||||||
|
<FileTree
|
||||||
|
projectId={projectId}
|
||||||
|
onFileSelect={handleFileSelect}
|
||||||
|
selectedFile={activeFileTab}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
))
|
</ScrollArea>
|
||||||
)}
|
</div>
|
||||||
|
<div className="flex-1 min-h-0 flex flex-col overflow-hidden">
|
||||||
|
{openFiles.length > 0 ? (
|
||||||
|
<>
|
||||||
|
{/* File Tabs */}
|
||||||
|
<div className="border-b flex-shrink-0 w-full overflow-x-auto overflow-y-hidden">
|
||||||
|
<div className="flex items-center gap-1 px-2" style={{ width: 'max-content' }}>
|
||||||
|
{openFiles.map((filePath) => {
|
||||||
|
const fileName = filePath.split('/').pop() || filePath;
|
||||||
|
const hasUnsavedChanges = editedContents[filePath] !== undefined &&
|
||||||
|
editedContents[filePath] !== fileContents[filePath];
|
||||||
|
const isActive = activeFileTab === filePath;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
key={filePath}
|
||||||
|
onClick={() => {
|
||||||
|
setActiveFileTab(filePath);
|
||||||
|
}}
|
||||||
|
className={cn(
|
||||||
|
"flex items-center gap-2 px-3 py-1.5 text-sm border-b-2 transition-colors flex-shrink-0 whitespace-nowrap",
|
||||||
|
isActive
|
||||||
|
? "border-primary text-foreground"
|
||||||
|
: "border-transparent text-muted-foreground hover:text-foreground"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<span>{fileName}</span>
|
||||||
|
{hasUnsavedChanges && (
|
||||||
|
<span className="h-1.5 w-1.5 rounded-full bg-primary flex-shrink-0" />
|
||||||
|
)}
|
||||||
|
<button
|
||||||
|
onClick={(e) => handleCloseTab(filePath, e)}
|
||||||
|
className="ml-1 hover:bg-muted rounded p-0.5 flex-shrink-0"
|
||||||
|
>
|
||||||
|
<X className="h-3 w-3" />
|
||||||
|
</button>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/* Editor */}
|
||||||
|
{activeFileTab && (
|
||||||
|
<FileEditor
|
||||||
|
filePath={activeFileTab}
|
||||||
|
content={editedContents[activeFileTab] !== undefined
|
||||||
|
? editedContents[activeFileTab]
|
||||||
|
: (fileContents[activeFileTab] ?? '')}
|
||||||
|
onContentChange={(content) => {
|
||||||
|
setEditedContents(prev => ({ ...prev, [activeFileTab]: content }));
|
||||||
|
}}
|
||||||
|
isLoading={isLoading && !fileContents[activeFileTab]}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<div className="h-full flex items-center justify-center">
|
||||||
|
<div className="text-center">
|
||||||
|
<FolderOpen className="h-12 w-12 mx-auto text-muted-foreground mb-4" />
|
||||||
|
<p className="text-muted-foreground">
|
||||||
|
{t('selectFileFromExplorer')}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ScrollArea>
|
</TabsContent>
|
||||||
|
{/* Terminal Tab */}
|
||||||
|
<TabsContent value="terminal" className="h-full mt-0 m-0 data-[state=active]:flex data-[state=active]:flex-col">
|
||||||
|
<div className="flex-1 min-h-0">
|
||||||
|
<TerminalComponent cwd={`${projectsPath}/${projectId}`} />
|
||||||
|
</div>
|
||||||
|
</TabsContent>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Tabs>
|
||||||
</ResizablePanel>
|
</ResizablePanel>
|
||||||
</ResizablePanelGroup>
|
</ResizablePanelGroup>
|
||||||
</div>
|
</div>
|
||||||
@@ -864,180 +1035,6 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
|
|||||||
</TabsContent>
|
</TabsContent>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<TabsContent value="code" className="h-full mt-0">
|
|
||||||
{isMobile ? (
|
|
||||||
<div className="h-full flex flex-col min-h-0">
|
|
||||||
{/* Mobile Code view header */}
|
|
||||||
<div className="h-12 px-4 border-b flex items-center bg-gradient-to-r from-muted/20 to-background flex-shrink-0">
|
|
||||||
<BranchSwitcher projectId={projectId} />
|
|
||||||
<div className="flex-1" />
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => setMobileCodeView(mobileCodeView === 'terminal' ? 'explorer' : 'terminal')}
|
|
||||||
className="gap-2 text-muted-foreground hover:text-foreground"
|
|
||||||
>
|
|
||||||
<Terminal className="h-4 w-4" />
|
|
||||||
<span className="hidden sm:inline">Terminal</span>
|
|
||||||
</Button>
|
|
||||||
<GitStatusIndicator projectId={projectId} />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{mobileCodeView === 'explorer' ? (
|
|
||||||
<div className="flex-1 min-h-0">
|
|
||||||
<ScrollArea className="h-full">
|
|
||||||
<ScrollBar orientation="horizontal" />
|
|
||||||
<div className="min-w-max">
|
|
||||||
<FileTree
|
|
||||||
projectId={projectId}
|
|
||||||
onFileSelect={handleFileSelect}
|
|
||||||
selectedFile={selectedFile}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</ScrollArea>
|
|
||||||
</div>
|
|
||||||
) : mobileCodeView === 'terminal' ? (
|
|
||||||
<div className="flex-1 min-h-0">
|
|
||||||
<TerminalComponent cwd={`${projectsPath}/${projectId}`} />
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<div className="p-3 border-b bg-gradient-to-r from-primary/5 to-accent/5 flex items-center gap-2">
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => setMobileCodeView('explorer')}
|
|
||||||
className="p-1"
|
|
||||||
>
|
|
||||||
<ArrowLeft className="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
<h3 className="font-semibold flex-1 truncate bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
|
|
||||||
{selectedFile ? selectedFile.split('/').pop() : t('fileEditor')}
|
|
||||||
</h3>
|
|
||||||
<GitStatusIndicator projectId={projectId} />
|
|
||||||
</div>
|
|
||||||
<div className="flex-1">
|
|
||||||
{selectedFile ? (
|
|
||||||
<FileEditor
|
|
||||||
filePath={selectedFile}
|
|
||||||
content={fileContent}
|
|
||||||
onSave={handleFileSave}
|
|
||||||
isLoading={isLoading}
|
|
||||||
projectId={projectId}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<div className="h-full flex items-center justify-center">
|
|
||||||
<div className="text-center">
|
|
||||||
<FolderOpen className="h-12 w-12 mx-auto text-muted-foreground mb-4" />
|
|
||||||
<p className="text-muted-foreground">
|
|
||||||
{t('selectFileFromExplorer')}
|
|
||||||
</p>
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => setMobileCodeView('explorer')}
|
|
||||||
className="mt-4"
|
|
||||||
>
|
|
||||||
{t('openFileExplorer')}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="h-full flex flex-col">
|
|
||||||
{/* Code view header with back button */}
|
|
||||||
{!isMobile && onToggleView && isPreviewable && (
|
|
||||||
<div className="h-12 px-4 border-b flex items-center bg-gradient-to-r from-muted/20 to-background gap-3">
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={onToggleView}
|
|
||||||
className="gap-2 text-muted-foreground hover:text-foreground"
|
|
||||||
>
|
|
||||||
<ArrowLeft className="h-4 w-4" />
|
|
||||||
{t('backToPreview')}
|
|
||||||
</Button>
|
|
||||||
<div className="flex-1" />
|
|
||||||
<BranchSwitcher projectId={projectId} />
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => setDesktopCodeView(desktopCodeView === 'terminal' ? 'files' : 'terminal')}
|
|
||||||
className="gap-2 text-muted-foreground hover:text-foreground"
|
|
||||||
>
|
|
||||||
<Terminal className="h-4 w-4" />
|
|
||||||
<span className="hidden lg:inline">Terminal</span>
|
|
||||||
</Button>
|
|
||||||
<GitStatusIndicator projectId={projectId} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{/* Code view header without back button for non-previewable projects */}
|
|
||||||
{!isMobile && !isPreviewable && (
|
|
||||||
<div className="h-12 px-4 border-b flex items-center bg-gradient-to-r from-muted/20 to-background">
|
|
||||||
<div className="flex-1" />
|
|
||||||
<BranchSwitcher projectId={projectId} />
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => setDesktopCodeView(desktopCodeView === 'terminal' ? 'files' : 'terminal')}
|
|
||||||
className="gap-2 text-muted-foreground hover:text-foreground"
|
|
||||||
>
|
|
||||||
<Terminal className="h-4 w-4" />
|
|
||||||
<span className="hidden lg:inline">Terminal</span>
|
|
||||||
</Button>
|
|
||||||
<GitStatusIndicator projectId={projectId} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="flex-1 flex min-h-0">
|
|
||||||
{desktopCodeView === 'terminal' ? (
|
|
||||||
<div className="flex-1">
|
|
||||||
<TerminalComponent cwd={`${projectsPath}/${projectId}`} />
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<div className="w-1/3 border-r flex flex-col">
|
|
||||||
<ScrollArea className="flex-1">
|
|
||||||
<ScrollBar orientation="horizontal" />
|
|
||||||
<div className="min-w-max">
|
|
||||||
<FileTree
|
|
||||||
projectId={projectId}
|
|
||||||
onFileSelect={handleFileSelect}
|
|
||||||
selectedFile={selectedFile}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</ScrollArea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex-1">
|
|
||||||
{selectedFile ? (
|
|
||||||
<FileEditor
|
|
||||||
filePath={selectedFile}
|
|
||||||
content={fileContent}
|
|
||||||
onSave={handleFileSave}
|
|
||||||
isLoading={isLoading}
|
|
||||||
projectId={projectId}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<div className="h-full flex items-center justify-center">
|
|
||||||
<div className="text-center">
|
|
||||||
<p className="text-muted-foreground">
|
|
||||||
{t('selectFileFromExplorer')}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</TabsContent>
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import {
|
|||||||
X,
|
X,
|
||||||
Search,
|
Search,
|
||||||
Clipboard,
|
Clipboard,
|
||||||
AppWindow,
|
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { VFSImage } from '@/components/VFSImage';
|
import { VFSImage } from '@/components/VFSImage';
|
||||||
@@ -413,25 +412,6 @@ function getToolInfo(toolName: string, args: Record<string, unknown>, projectId?
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'app': {
|
|
||||||
const action = args.action as string | undefined;
|
|
||||||
if (action === 'view_app') {
|
|
||||||
return {
|
|
||||||
icon: AppWindow,
|
|
||||||
title: 'Viewed app',
|
|
||||||
callingTitle: 'Viewing app',
|
|
||||||
errorTitle: 'Failed to view app',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const name = args.name ? String(args.name) : 'app';
|
|
||||||
return {
|
|
||||||
icon: AppWindow,
|
|
||||||
title: `Updated ${name}`,
|
|
||||||
callingTitle: `Updating ${name}`,
|
|
||||||
errorTitle: `Failed to update ${name}`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
const formattedName = toolName.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
|
const formattedName = toolName.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,147 +0,0 @@
|
|||||||
import { useState, useRef, KeyboardEvent } from 'react';
|
|
||||||
import { X, Plus } from 'lucide-react';
|
|
||||||
import { Button } from '@/components/ui/button';
|
|
||||||
import { Input } from '@/components/ui/input';
|
|
||||||
import { Label } from '@/components/ui/label';
|
|
||||||
import { ExternalFavicon } from '@/components/ExternalFavicon';
|
|
||||||
import { cn } from '@/lib/utils';
|
|
||||||
|
|
||||||
interface UrlListEditorProps {
|
|
||||||
/** Label shown above the list */
|
|
||||||
label: string;
|
|
||||||
/** Current array of full URLs */
|
|
||||||
items: string[];
|
|
||||||
/** Called when the list changes */
|
|
||||||
onChange: (items: string[]) => void;
|
|
||||||
/** Controls auto-prefix on bare domain entry */
|
|
||||||
protocol: 'wss' | 'https';
|
|
||||||
/** Placeholder shown in the add input */
|
|
||||||
placeholder?: string;
|
|
||||||
/** Whether to show the required asterisk */
|
|
||||||
required?: boolean;
|
|
||||||
/** Additional CSS classes for the root element */
|
|
||||||
className?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Normalize a bare domain or partial URL to a fully-qualified URL.
|
|
||||||
* If the value already has any protocol it is returned as-is.
|
|
||||||
*/
|
|
||||||
function normalizeEntry(value: string, protocol: 'wss' | 'https'): string {
|
|
||||||
const trimmed = value.trim();
|
|
||||||
if (!trimmed) return '';
|
|
||||||
if (/^wss?:\/\//i.test(trimmed) || /^https?:\/\//i.test(trimmed)) return trimmed;
|
|
||||||
return `${protocol}://${trimmed}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a URL to an https:// form suitable for favicon lookup.
|
|
||||||
* wss:// → https://, ws:// → http://
|
|
||||||
*/
|
|
||||||
function toHttpsUrl(url: string): string {
|
|
||||||
return url.replace(/^wss:\/\//i, 'https://').replace(/^ws:\/\//i, 'http://');
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Strip the protocol prefix for compact display */
|
|
||||||
function displayLabel(url: string): string {
|
|
||||||
return url.replace(/^wss?:\/\//i, '').replace(/^https?:\/\//i, '');
|
|
||||||
}
|
|
||||||
|
|
||||||
export function UrlListEditor({
|
|
||||||
label,
|
|
||||||
items,
|
|
||||||
onChange,
|
|
||||||
protocol,
|
|
||||||
placeholder,
|
|
||||||
required,
|
|
||||||
className,
|
|
||||||
}: UrlListEditorProps) {
|
|
||||||
const [inputValue, setInputValue] = useState('');
|
|
||||||
const inputRef = useRef<HTMLInputElement>(null);
|
|
||||||
|
|
||||||
const handleAdd = () => {
|
|
||||||
const normalized = normalizeEntry(inputValue, protocol);
|
|
||||||
if (!normalized) return;
|
|
||||||
// Silently ignore duplicates
|
|
||||||
if (items.includes(normalized)) {
|
|
||||||
setInputValue('');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
onChange([...items, normalized]);
|
|
||||||
setInputValue('');
|
|
||||||
inputRef.current?.focus();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleRemove = (index: number) => {
|
|
||||||
onChange(items.filter((_, i) => i !== index));
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {
|
|
||||||
if (e.key === 'Enter') {
|
|
||||||
e.preventDefault();
|
|
||||||
handleAdd();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={cn('grid gap-2', className)}>
|
|
||||||
<Label>
|
|
||||||
{label}
|
|
||||||
{required && <span className="text-destructive ml-1">*</span>}
|
|
||||||
</Label>
|
|
||||||
|
|
||||||
{/* Scrollable list of existing items */}
|
|
||||||
{items.length > 0 && (
|
|
||||||
<div className="rounded-md border overflow-y-auto max-h-48">
|
|
||||||
{items.map((item, index) => (
|
|
||||||
<div
|
|
||||||
key={index}
|
|
||||||
className="flex items-center gap-2 px-3 py-2 hover:bg-muted border-b last:border-b-0"
|
|
||||||
>
|
|
||||||
<ExternalFavicon
|
|
||||||
url={toHttpsUrl(item)}
|
|
||||||
size={14}
|
|
||||||
className="shrink-0 opacity-70"
|
|
||||||
/>
|
|
||||||
<span className="flex-1 text-sm font-mono truncate">
|
|
||||||
{displayLabel(item)}
|
|
||||||
</span>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
variant="ghost"
|
|
||||||
size="icon"
|
|
||||||
className="h-6 w-6 shrink-0 text-muted-foreground hover:text-destructive"
|
|
||||||
onClick={() => handleRemove(index)}
|
|
||||||
aria-label={`Remove ${item}`}
|
|
||||||
>
|
|
||||||
<X className="h-3 w-3" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Add input */}
|
|
||||||
<div className="flex gap-2">
|
|
||||||
<Input
|
|
||||||
ref={inputRef}
|
|
||||||
value={inputValue}
|
|
||||||
onChange={(e) => setInputValue(e.target.value)}
|
|
||||||
onKeyDown={handleKeyDown}
|
|
||||||
placeholder={placeholder ?? (protocol === 'wss' ? 'relay.example.com' : 'server.example.com')}
|
|
||||||
className="font-mono text-sm"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
variant="outline"
|
|
||||||
size="icon"
|
|
||||||
onClick={handleAdd}
|
|
||||||
disabled={!inputValue.trim()}
|
|
||||||
aria-label={`Add ${label}`}
|
|
||||||
>
|
|
||||||
<Plus className="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
import { useEffect } from 'react';
|
|
||||||
import { Link } from 'react-router-dom';
|
|
||||||
|
|
||||||
import { toast } from '@/hooks/useToast';
|
|
||||||
import { ToastAction } from '@/components/ui/toast';
|
|
||||||
import { parseChangelog } from '@/lib/changelog';
|
|
||||||
|
|
||||||
const STORAGE_KEY = 'shakespeare:app-version';
|
|
||||||
|
|
||||||
/** Fetch the first changelog item for the given version (or the latest entry). */
|
|
||||||
async function fetchChangelogExcerpt(version: string): Promise<string | undefined> {
|
|
||||||
try {
|
|
||||||
const res = await fetch('/CHANGELOG.md');
|
|
||||||
if (!res.ok) return undefined;
|
|
||||||
const markdown = await res.text();
|
|
||||||
const entries = parseChangelog(markdown);
|
|
||||||
|
|
||||||
// Try to find the entry matching the current version, otherwise use the first entry.
|
|
||||||
const entry = entries.find((e) => e.version === version) ?? entries[0];
|
|
||||||
if (!entry) return undefined;
|
|
||||||
|
|
||||||
// Return a truncated first item from the first section.
|
|
||||||
const item = entry.sections[0]?.items[0];
|
|
||||||
if (!item) return undefined;
|
|
||||||
if (item.length <= 60) return item;
|
|
||||||
return item.slice(0, 60).trimEnd() + '…';
|
|
||||||
} catch {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Compares the running app version against localStorage and shows a toast when the version changes. */
|
|
||||||
export function VersionCheck() {
|
|
||||||
useEffect(() => {
|
|
||||||
const currentVersion = import.meta.env.VERSION;
|
|
||||||
if (!currentVersion) return;
|
|
||||||
|
|
||||||
const storedVersion = localStorage.getItem(STORAGE_KEY);
|
|
||||||
localStorage.setItem(STORAGE_KEY, currentVersion);
|
|
||||||
|
|
||||||
if (storedVersion && storedVersion !== currentVersion) {
|
|
||||||
// Show the toast immediately, then enrich it with a changelog excerpt.
|
|
||||||
const { update, id } = toast({
|
|
||||||
title: `What's new in v${currentVersion}`,
|
|
||||||
action: (
|
|
||||||
<ToastAction altText="View changelog" asChild>
|
|
||||||
<Link to="/changelog">See all</Link>
|
|
||||||
</ToastAction>
|
|
||||||
),
|
|
||||||
});
|
|
||||||
|
|
||||||
fetchChangelogExcerpt(currentVersion).then((excerpt) => {
|
|
||||||
if (excerpt) {
|
|
||||||
update({
|
|
||||||
id,
|
|
||||||
title: `What's new in v${currentVersion}`,
|
|
||||||
description: excerpt,
|
|
||||||
action: (
|
|
||||||
<ToastAction altText="View changelog" asChild>
|
|
||||||
<Link to="/changelog">See all</Link>
|
|
||||||
</ToastAction>
|
|
||||||
),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
@@ -13,9 +13,6 @@ import { useFS } from '@/hooks/useFS';
|
|||||||
import { useFSPaths } from '@/hooks/useFSPaths';
|
import { useFSPaths } from '@/hooks/useFSPaths';
|
||||||
import { useAppContext } from '@/hooks/useAppContext';
|
import { useAppContext } from '@/hooks/useAppContext';
|
||||||
import { useNostr } from '@nostrify/react';
|
import { useNostr } from '@nostrify/react';
|
||||||
import { useNostrPublish } from '@/hooks/useNostrPublish';
|
|
||||||
import { useGit } from '@/hooks/useGit';
|
|
||||||
import { NostrURI } from '@/lib/NostrURI';
|
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import type { DeployProvider } from '@/contexts/DeploySettingsContext';
|
import type { DeployProvider } from '@/contexts/DeploySettingsContext';
|
||||||
import type { PresetDeployProvider } from '@/lib/deploy/types';
|
import type { PresetDeployProvider } from '@/lib/deploy/types';
|
||||||
@@ -36,9 +33,6 @@ import { VercelAdapter } from '@/lib/deploy/VercelAdapter';
|
|||||||
import { CloudflareAdapter } from '@/lib/deploy/CloudflareAdapter';
|
import { CloudflareAdapter } from '@/lib/deploy/CloudflareAdapter';
|
||||||
import { DenoDeployAdapter } from '@/lib/deploy/DenoDeployAdapter';
|
import { DenoDeployAdapter } from '@/lib/deploy/DenoDeployAdapter';
|
||||||
import { RailwayAdapter } from '@/lib/deploy/RailwayAdapter';
|
import { RailwayAdapter } from '@/lib/deploy/RailwayAdapter';
|
||||||
import { readNsiteVfsConfig, writeNsiteVfsConfig } from '@/lib/nsiteConfig';
|
|
||||||
import type { NsiteVfsConfig } from '@/lib/nsiteConfig';
|
|
||||||
import { projectNameToDTag } from '@/lib/utils/nsite';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalize a URL string to ensure it has a protocol
|
* Normalize a URL string to ensure it has a protocol
|
||||||
@@ -50,23 +44,6 @@ function normalizeUrl(url: string): string {
|
|||||||
return `https://${url}`;
|
return `https://${url}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resolveNsiteSourceUrl(remoteUrl: string | null): Promise<string | undefined> {
|
|
||||||
if (!remoteUrl) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (/^https?:\/\//i.test(remoteUrl)) {
|
|
||||||
return remoteUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (remoteUrl.startsWith('nostr://')) {
|
|
||||||
const nostrURI = await NostrURI.parse(remoteUrl);
|
|
||||||
return nostrURI.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render provider icon using favicon or fallback
|
* Render provider icon using favicon or fallback
|
||||||
*/
|
*/
|
||||||
@@ -105,9 +82,7 @@ interface ShakespeareFormData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface NsiteFormData {
|
interface NsiteFormData {
|
||||||
siteTitle: string;
|
nsec: string;
|
||||||
siteDescription: string;
|
|
||||||
dTag: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface NetlifyFormData {
|
interface NetlifyFormData {
|
||||||
@@ -145,8 +120,6 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
|||||||
const { projectsPath } = useFSPaths();
|
const { projectsPath } = useFSPaths();
|
||||||
const { config } = useAppContext();
|
const { config } = useAppContext();
|
||||||
const { nostr } = useNostr();
|
const { nostr } = useNostr();
|
||||||
const { mutateAsync: publishEvent } = useNostrPublish();
|
|
||||||
const { git } = useGit();
|
|
||||||
|
|
||||||
const [selectedProviderId, setSelectedProviderId] = useState<string>('');
|
const [selectedProviderId, setSelectedProviderId] = useState<string>('');
|
||||||
const [isDeploying, setIsDeploying] = useState(false);
|
const [isDeploying, setIsDeploying] = useState(false);
|
||||||
@@ -154,46 +127,12 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
|||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [isShakespeareFormValid, setIsShakespeareFormValid] = useState(true);
|
const [isShakespeareFormValid, setIsShakespeareFormValid] = useState(true);
|
||||||
|
|
||||||
// .nsite/config.json state — loaded once on mount, used to skip config form on re-deploy
|
|
||||||
const [nsiteVfsConfig, setNsiteVfsConfig] = useState<NsiteVfsConfig | null>(null);
|
|
||||||
const [nsiteVfsConfigLoading, setNsiteVfsConfigLoading] = useState(true);
|
|
||||||
// When a .nsite/config.json already exists, hide the full form and show a summary instead.
|
|
||||||
// The user can click "Edit" to expand it.
|
|
||||||
const [nsiteShowFullForm, setNsiteShowFullForm] = useState(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!projectId) {
|
|
||||||
setNsiteVfsConfigLoading(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const projectPath = `${projectsPath}/${projectId}`;
|
|
||||||
readNsiteVfsConfig(fs, projectPath)
|
|
||||||
.then((cfg) => {
|
|
||||||
setNsiteVfsConfig(cfg);
|
|
||||||
// If a config already exists, seed the form from it and stay in summary mode.
|
|
||||||
// If not, show the full form so the user can configure for the first time.
|
|
||||||
if (cfg) {
|
|
||||||
setNsiteForm({
|
|
||||||
siteTitle: cfg.title ?? '',
|
|
||||||
siteDescription: cfg.description ?? '',
|
|
||||||
dTag: (cfg.id != null && cfg.id !== '') ? cfg.id : '',
|
|
||||||
});
|
|
||||||
setNsiteShowFullForm(false);
|
|
||||||
} else {
|
|
||||||
setNsiteShowFullForm(true);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.finally(() => setNsiteVfsConfigLoading(false));
|
|
||||||
}, [fs, projectsPath, projectId]);
|
|
||||||
|
|
||||||
// Provider-specific form data
|
// Provider-specific form data
|
||||||
const [shakespeareForm, setShakespeareForm] = useState<ShakespeareFormData>({
|
const [shakespeareForm, setShakespeareForm] = useState<ShakespeareFormData>({
|
||||||
subdomain: projectId,
|
subdomain: projectId,
|
||||||
});
|
});
|
||||||
const [nsiteForm, setNsiteForm] = useState<NsiteFormData>({
|
const [nsiteForm, setNsiteForm] = useState<NsiteFormData>({
|
||||||
siteTitle: '',
|
nsec: '',
|
||||||
siteDescription: '',
|
|
||||||
dTag: '',
|
|
||||||
});
|
});
|
||||||
const [netlifyForm, setNetlifyForm] = useState<NetlifyFormData>({
|
const [netlifyForm, setNetlifyForm] = useState<NetlifyFormData>({
|
||||||
siteId: '',
|
siteId: '',
|
||||||
@@ -261,25 +200,17 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
|||||||
} else if (selectedProvider.type === 'nsite') {
|
} else if (selectedProvider.type === 'nsite') {
|
||||||
const nsiteProvider = selectedProvider;
|
const nsiteProvider = selectedProvider;
|
||||||
|
|
||||||
if (!user) {
|
if (!nsiteForm.nsec) {
|
||||||
throw new Error('You must be logged in to deploy to nsite.');
|
throw new Error('Site private key (nsec) is required');
|
||||||
}
|
}
|
||||||
|
|
||||||
const sourceUrl = await resolveNsiteSourceUrl(
|
|
||||||
await git.getRemoteURL(projectPath, 'origin')
|
|
||||||
);
|
|
||||||
|
|
||||||
adapter = new NsiteAdapter({
|
adapter = new NsiteAdapter({
|
||||||
fs,
|
fs,
|
||||||
nostr,
|
nostr,
|
||||||
signer: user.signer,
|
nsec: nsiteForm.nsec,
|
||||||
gateway: nsiteProvider.gateway,
|
gateway: nsiteProvider.gateway,
|
||||||
relayUrls: nsiteProvider.relayUrls,
|
relayUrls: nsiteProvider.relayUrls,
|
||||||
blossomServers: nsiteProvider.blossomServers,
|
blossomServers: nsiteProvider.blossomServers,
|
||||||
siteTitle: nsiteForm.siteTitle || undefined,
|
|
||||||
siteDescription: nsiteForm.siteDescription || undefined,
|
|
||||||
sourceUrl,
|
|
||||||
siteIdentifier: nsiteForm.dTag || undefined,
|
|
||||||
});
|
});
|
||||||
} else if (selectedProvider.type === 'netlify') {
|
} else if (selectedProvider.type === 'netlify') {
|
||||||
const netlifyProvider = selectedProvider;
|
const netlifyProvider = selectedProvider;
|
||||||
@@ -388,28 +319,9 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
|||||||
type: 'nsite',
|
type: 'nsite',
|
||||||
url: result.url,
|
url: result.url,
|
||||||
data: {
|
data: {
|
||||||
siteTitle: nsiteForm.siteTitle || undefined,
|
nsec: nsiteForm.nsec,
|
||||||
siteDescription: nsiteForm.siteDescription || undefined,
|
|
||||||
dTag: nsiteForm.dTag || undefined,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Write .nsite/config.json for nsyte CLI interoperability.
|
|
||||||
// This file is safe to commit — it never contains the nsec.
|
|
||||||
const nsiteProvider = selectedProvider;
|
|
||||||
const newNsiteVfsConfig: NsiteVfsConfig = {
|
|
||||||
relays: nsiteProvider.relayUrls,
|
|
||||||
servers: nsiteProvider.blossomServers,
|
|
||||||
id: nsiteForm.dTag || undefined,
|
|
||||||
title: nsiteForm.siteTitle || undefined,
|
|
||||||
description: nsiteForm.siteDescription || undefined,
|
|
||||||
fallback: '/index.html',
|
|
||||||
gatewayHostnames: [nsiteProvider.gateway],
|
|
||||||
};
|
|
||||||
await writeNsiteVfsConfig(fs, projectPath, newNsiteVfsConfig);
|
|
||||||
// Update in-memory state so summary view reflects new values immediately
|
|
||||||
setNsiteVfsConfig(newNsiteVfsConfig);
|
|
||||||
setNsiteShowFullForm(false);
|
|
||||||
} else if (selectedProvider.type === 'netlify') {
|
} else if (selectedProvider.type === 'netlify') {
|
||||||
await updateProjectSettings(selectedProviderId, {
|
await updateProjectSettings(selectedProviderId, {
|
||||||
type: 'netlify',
|
type: 'netlify',
|
||||||
@@ -457,53 +369,6 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
|||||||
}
|
}
|
||||||
|
|
||||||
setDeployResult(result);
|
setDeployResult(result);
|
||||||
|
|
||||||
// Update repository announcement with deployment URL if using Nostr git
|
|
||||||
try {
|
|
||||||
const projectPath = `${projectsPath}/${projectId}`;
|
|
||||||
const remoteUrl = await git.getRemoteURL(projectPath, 'origin');
|
|
||||||
|
|
||||||
if (remoteUrl && remoteUrl.startsWith('nostr://') && user) {
|
|
||||||
const nostrURI = await NostrURI.parse(remoteUrl);
|
|
||||||
|
|
||||||
// Query for existing repository announcement
|
|
||||||
const existingRepos = await nostr.query(
|
|
||||||
[{ kinds: [30617], authors: [user.pubkey], '#d': [nostrURI.identifier], limit: 1 }],
|
|
||||||
{ signal: AbortSignal.timeout(1500) }
|
|
||||||
);
|
|
||||||
|
|
||||||
if (existingRepos.length > 0) {
|
|
||||||
let changed = false;
|
|
||||||
let hasWebTag = false;
|
|
||||||
|
|
||||||
const repoEvent = structuredClone(existingRepos[0]);
|
|
||||||
|
|
||||||
for (const tag of repoEvent.tags) {
|
|
||||||
if (tag[0] === 'web') {
|
|
||||||
if (tag[1] !== result.url) {
|
|
||||||
tag[1] = result.url;
|
|
||||||
changed = true;
|
|
||||||
hasWebTag = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasWebTag) {
|
|
||||||
repoEvent.tags.push(['web', result.url]);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Publish updated repo event if deployment URL changed
|
|
||||||
if (changed) {
|
|
||||||
// Publish the updated event
|
|
||||||
await publishEvent(repoEvent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
// Silently fail - updating web tag is not critical for deployment
|
|
||||||
console.warn('Failed to update repository announcement with deployment URL:', err);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(err instanceof Error ? err.message : 'Deployment failed');
|
setError(err instanceof Error ? err.message : 'Deployment failed');
|
||||||
} finally {
|
} finally {
|
||||||
@@ -517,14 +382,12 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
|||||||
setError(null);
|
setError(null);
|
||||||
// Reset forms
|
// Reset forms
|
||||||
setShakespeareForm({ subdomain: projectId });
|
setShakespeareForm({ subdomain: projectId });
|
||||||
setNsiteForm({ siteTitle: '', siteDescription: '', dTag: '' });
|
setNsiteForm({ nsec: '' });
|
||||||
setNetlifyForm({ siteId: '', siteName: '' });
|
setNetlifyForm({ siteId: '', siteName: '' });
|
||||||
setVercelForm({ projectName: projectName || projectId, teamId: '' });
|
setVercelForm({ projectName: projectName || projectId, teamId: '' });
|
||||||
setCloudflareForm({ projectName: projectName || projectId });
|
setCloudflareForm({ projectName: projectName || projectId });
|
||||||
setDenoDeployForm({ projectName: projectName || projectId });
|
setDenoDeployForm({ projectName: projectName || projectId });
|
||||||
setRailwayForm({ workspaceId: '', projectId: '', environmentId: '', serviceId: '', projectName: projectName || projectId });
|
setRailwayForm({ workspaceId: '', projectId: '', environmentId: '', serviceId: '', projectName: projectName || projectId });
|
||||||
// Return to summary mode so next open shows the compact view (if config exists)
|
|
||||||
setNsiteShowFullForm(false);
|
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -536,17 +399,8 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
|||||||
setIsShakespeareFormValid(isValid);
|
setIsShakespeareFormValid(isValid);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleNsiteSiteTitleChange = useCallback((siteTitle: string) => {
|
const handleNsiteNsecChange = useCallback((nsec: string) => {
|
||||||
setNsiteForm(prev => ({ ...prev, siteTitle }));
|
setNsiteForm({ nsec });
|
||||||
// Derive the dTag from the title so the user never has to think about it.
|
|
||||||
// Falls back to projectName when the title is blank.
|
|
||||||
projectNameToDTag(siteTitle || projectName).then(dTag => {
|
|
||||||
setNsiteForm(prev => ({ ...prev, dTag }));
|
|
||||||
});
|
|
||||||
}, [projectName]);
|
|
||||||
|
|
||||||
const handleNsiteSiteDescriptionChange = useCallback((siteDescription: string) => {
|
|
||||||
setNsiteForm(prev => ({ ...prev, siteDescription }));
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleNetlifySiteChange = useCallback((siteId: string, siteName: string) => {
|
const handleNetlifySiteChange = useCallback((siteId: string, siteName: string) => {
|
||||||
@@ -595,72 +449,15 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (selectedProvider.type === 'nsite') {
|
if (selectedProvider.type === 'nsite') {
|
||||||
// While the .nsite/config.json load is still in flight, render nothing to avoid flicker
|
|
||||||
if (nsiteVfsConfigLoading) return null;
|
|
||||||
|
|
||||||
// Summary view: shown when .nsite/config.json already exists and user hasn't clicked Edit
|
|
||||||
if (nsiteVfsConfig && !nsiteShowFullForm) {
|
|
||||||
const relayCount = nsiteVfsConfig.relays?.length ?? 0;
|
|
||||||
const serverCount = nsiteVfsConfig.servers?.length ?? 0;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="space-y-3">
|
|
||||||
<div className="rounded-md border bg-muted/30 p-3 space-y-2 text-sm">
|
|
||||||
{nsiteVfsConfig.title && (
|
|
||||||
<div className="flex justify-between">
|
|
||||||
<span className="text-muted-foreground">Title</span>
|
|
||||||
<span className="font-medium">{nsiteVfsConfig.title}</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div className="flex justify-between">
|
|
||||||
<span className="text-muted-foreground">Relays</span>
|
|
||||||
<span className="font-medium">{relayCount} configured</span>
|
|
||||||
</div>
|
|
||||||
<div className="flex justify-between">
|
|
||||||
<span className="text-muted-foreground">Blossom servers</span>
|
|
||||||
<span className="font-medium">{serverCount} configured</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="text-xs text-muted-foreground underline hover:text-foreground transition-colors"
|
|
||||||
onClick={() => setNsiteShowFullForm(true)}
|
|
||||||
>
|
|
||||||
Edit site settings
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Full config form: shown on first deploy or when user clicks "Edit site settings"
|
|
||||||
const savedConfig = projectSettings.providers[selectedProviderId];
|
const savedConfig = projectSettings.providers[selectedProviderId];
|
||||||
const legacy = savedConfig?.type === 'nsite' ? savedConfig.data : undefined;
|
const savedNsec = savedConfig?.type === 'nsite' ? savedConfig.data.nsec : undefined;
|
||||||
|
|
||||||
// .nsite/config.json wins; .git/shakespeare/deploy.json is the legacy fallback
|
|
||||||
const savedSiteTitle = nsiteVfsConfig?.title ?? legacy?.siteTitle;
|
|
||||||
const savedSiteDescription = nsiteVfsConfig?.description ?? legacy?.siteDescription;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-3">
|
<NsiteDeployForm
|
||||||
<NsiteDeployForm
|
gateway={selectedProvider.gateway}
|
||||||
key={selectedProviderId}
|
savedNsec={savedNsec}
|
||||||
projectName={projectName || projectId}
|
onNsecChange={handleNsiteNsecChange}
|
||||||
savedNsec={legacy?.nsec}
|
/>
|
||||||
savedSiteTitle={savedSiteTitle}
|
|
||||||
savedSiteDescription={savedSiteDescription}
|
|
||||||
onSiteTitleChange={handleNsiteSiteTitleChange}
|
|
||||||
onSiteDescriptionChange={handleNsiteSiteDescriptionChange}
|
|
||||||
/>
|
|
||||||
{nsiteVfsConfig && (
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="text-xs text-muted-foreground underline hover:text-foreground transition-colors"
|
|
||||||
onClick={() => setNsiteShowFullForm(false)}
|
|
||||||
>
|
|
||||||
Back to summary
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -920,22 +717,6 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
|||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{selectedProvider?.type === 'nsite' && !user && (
|
|
||||||
<Alert>
|
|
||||||
<AlertCircle className="h-4 w-4" />
|
|
||||||
<AlertDescription>
|
|
||||||
You must be logged in with Nostr to deploy to nsite.{' '}
|
|
||||||
<Link
|
|
||||||
to="/settings/nostr"
|
|
||||||
className="underline hover:no-underline"
|
|
||||||
onClick={handleClose}
|
|
||||||
>
|
|
||||||
Go to Nostr Settings
|
|
||||||
</Link>
|
|
||||||
</AlertDescription>
|
|
||||||
</Alert>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<Alert variant="destructive">
|
<Alert variant="destructive">
|
||||||
<AlertCircle className="h-4 w-4" />
|
<AlertCircle className="h-4 w-4" />
|
||||||
@@ -950,8 +731,7 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
|||||||
isDeploying ||
|
isDeploying ||
|
||||||
(selectedProvider.type === 'shakespeare' && !user) ||
|
(selectedProvider.type === 'shakespeare' && !user) ||
|
||||||
(selectedProvider.type === 'shakespeare' && !isShakespeareFormValid) ||
|
(selectedProvider.type === 'shakespeare' && !isShakespeareFormValid) ||
|
||||||
(selectedProvider.type === 'nsite' && !user) ||
|
(selectedProvider.type === 'nsite' && !nsiteForm.nsec) ||
|
||||||
(selectedProvider.type === 'nsite' && !nsiteForm.dTag) ||
|
|
||||||
(selectedProvider.type === 'netlify' && !netlifyForm.siteId && !netlifyForm.siteName) ||
|
(selectedProvider.type === 'netlify' && !netlifyForm.siteId && !netlifyForm.siteName) ||
|
||||||
(selectedProvider.type === 'cloudflare' && !cloudflareForm.projectName) ||
|
(selectedProvider.type === 'cloudflare' && !cloudflareForm.projectName) ||
|
||||||
(selectedProvider.type === 'deno' && !denoDeployForm.projectName) ||
|
(selectedProvider.type === 'deno' && !denoDeployForm.projectName) ||
|
||||||
|
|||||||
@@ -1,103 +1,107 @@
|
|||||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
import { useState, useEffect, useRef } from 'react';
|
||||||
import { AlertCircle } from 'lucide-react';
|
import { generateSecretKey, getPublicKey } from 'nostr-tools/pure';
|
||||||
|
import { nip19 } from 'nostr-tools';
|
||||||
import { Label } from '@/components/ui/label';
|
import { Label } from '@/components/ui/label';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Textarea } from '@/components/ui/textarea';
|
import { PasswordInput } from '@/components/ui/password-input';
|
||||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
import { RefreshCw } from 'lucide-react';
|
||||||
|
|
||||||
interface NsiteDeployFormProps {
|
interface NsiteDeployFormProps {
|
||||||
/** Human-readable project name — used to default the title */
|
gateway: string;
|
||||||
projectName: string;
|
|
||||||
/** Persisted values from a previous deployment */
|
|
||||||
savedSiteTitle?: string;
|
|
||||||
savedSiteDescription?: string;
|
|
||||||
/** Present only when the project was previously deployed with a dedicated keypair (v1) */
|
|
||||||
savedNsec?: string;
|
savedNsec?: string;
|
||||||
onSiteTitleChange: (title: string) => void;
|
onNsecChange: (nsec: string) => void;
|
||||||
onSiteDescriptionChange: (description: string) => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function NsiteDeployForm({
|
export function NsiteDeployForm({
|
||||||
projectName,
|
gateway,
|
||||||
savedSiteTitle,
|
|
||||||
savedSiteDescription,
|
|
||||||
savedNsec,
|
savedNsec,
|
||||||
onSiteTitleChange,
|
onNsecChange,
|
||||||
onSiteDescriptionChange,
|
|
||||||
}: NsiteDeployFormProps) {
|
}: NsiteDeployFormProps) {
|
||||||
const [siteTitle, setSiteTitle] = useState(savedSiteTitle ?? projectName);
|
const [nsec, setNsec] = useState(savedNsec || '');
|
||||||
const [siteDescription, setSiteDescription] = useState(savedSiteDescription ?? '');
|
const [npub, setNpub] = useState('');
|
||||||
|
const initialized = useRef(false);
|
||||||
// On mount: sync all saved values to parent and set defaults.
|
|
||||||
// The component is keyed by selectedProviderId in DeploySteps, so this always
|
|
||||||
// runs with fresh props — no initialized guard needed.
|
|
||||||
const initializedRef = useRef(false);
|
|
||||||
const stableSyncToParent = useCallback(() => {
|
|
||||||
if (initializedRef.current) return;
|
|
||||||
initializedRef.current = true;
|
|
||||||
|
|
||||||
if (savedSiteDescription) onSiteDescriptionChange(savedSiteDescription);
|
|
||||||
|
|
||||||
const initialTitle = savedSiteTitle ?? projectName;
|
|
||||||
if (initialTitle !== siteTitle) setSiteTitle(initialTitle);
|
|
||||||
onSiteTitleChange(initialTitle);
|
|
||||||
}, [savedSiteDescription, savedSiteTitle, siteTitle, projectName, onSiteDescriptionChange, onSiteTitleChange]);
|
|
||||||
|
|
||||||
|
// Initialize nsec on mount
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
stableSyncToParent();
|
if (!initialized.current) {
|
||||||
}, [stableSyncToParent]);
|
initialized.current = true;
|
||||||
|
if (savedNsec) {
|
||||||
|
// If we have a saved nsec, notify parent immediately
|
||||||
|
onNsecChange(savedNsec);
|
||||||
|
} else if (!nsec) {
|
||||||
|
// Generate a new nsec if none exists
|
||||||
|
const sk = generateSecretKey();
|
||||||
|
const newNsec = nip19.nsecEncode(sk);
|
||||||
|
setNsec(newNsec);
|
||||||
|
onNsecChange(newNsec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [savedNsec, nsec, onNsecChange]);
|
||||||
|
|
||||||
const handleSiteTitleChange = (value: string) => {
|
// Update npub when nsec changes
|
||||||
setSiteTitle(value);
|
useEffect(() => {
|
||||||
onSiteTitleChange(value);
|
if (nsec) {
|
||||||
|
try {
|
||||||
|
const decoded = nip19.decode(nsec);
|
||||||
|
if (decoded.type === 'nsec') {
|
||||||
|
const pk = getPublicKey(decoded.data);
|
||||||
|
const npubEncoded = nip19.npubEncode(pk);
|
||||||
|
setNpub(npubEncoded);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
setNpub('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [nsec]);
|
||||||
|
|
||||||
|
const handleNsecChange = (value: string) => {
|
||||||
|
setNsec(value);
|
||||||
|
onNsecChange(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSiteDescriptionChange = (value: string) => {
|
const handleGenerateNew = () => {
|
||||||
setSiteDescription(value);
|
const sk = generateSecretKey();
|
||||||
onSiteDescriptionChange(value);
|
const newNsec = nip19.nsecEncode(sk);
|
||||||
|
setNsec(newNsec);
|
||||||
|
onNsecChange(newNsec);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fullDomain = npub ? `${npub}.${gateway}` : `npub1...${gateway}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
|
|
||||||
{/* Migration notice */}
|
|
||||||
{savedNsec && (
|
|
||||||
<Alert>
|
|
||||||
<AlertCircle className="h-4 w-4" />
|
|
||||||
<AlertDescription>
|
|
||||||
<strong>Site identity is changing.</strong> This project was previously deployed with a
|
|
||||||
dedicated private key. Going forward, it will deploy under your Nostr identity. The old
|
|
||||||
site will remain at its original address until overwritten.
|
|
||||||
</AlertDescription>
|
|
||||||
</Alert>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Site title */}
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="nsite-title">Site Title</Label>
|
<Label>Site URL</Label>
|
||||||
<Input
|
<p className="text-sm font-mono bg-muted p-2 rounded-md break-all">
|
||||||
id="nsite-title"
|
{fullDomain}
|
||||||
value={siteTitle}
|
</p>
|
||||||
onChange={(e) => handleSiteTitleChange(e.target.value)}
|
|
||||||
placeholder="My Nostr Site"
|
|
||||||
/>
|
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
Shown by nsite gateways and directories. Included as a title tag in the manifest.
|
Each site has a unique Nostr keypair
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Site description */}
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="nsite-description">Description <span className="text-muted-foreground font-normal">(optional)</span></Label>
|
<Label htmlFor="nsite-nsec">Site Private Key (nsec)</Label>
|
||||||
<Textarea
|
<div className="flex gap-2">
|
||||||
id="nsite-description"
|
<PasswordInput
|
||||||
value={siteDescription}
|
id="nsite-nsec"
|
||||||
onChange={(e) => handleSiteDescriptionChange(e.target.value)}
|
value={nsec}
|
||||||
placeholder="A short description of this site…"
|
onChange={(e) => handleNsecChange(e.target.value)}
|
||||||
rows={3}
|
placeholder="nsec1..."
|
||||||
/>
|
className="flex-1"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="outline"
|
||||||
|
size="icon"
|
||||||
|
onClick={handleGenerateNew}
|
||||||
|
title="Generate new key"
|
||||||
|
>
|
||||||
|
<RefreshCw className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
Included as a description tag in the manifest.
|
Keep this private key secure. It's used to sign site metadata.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -54,28 +54,19 @@ export function GitSyncButton({ projectId, className }: GitSyncButtonProps) {
|
|||||||
prevIsGitActionOccurring.current = isGitActionOccurring;
|
prevIsGitActionOccurring.current = isGitActionOccurring;
|
||||||
}, [isGitActionOccurring, hasError]);
|
}, [isGitActionOccurring, hasError]);
|
||||||
|
|
||||||
// Determine if the user has altered the project (made commits beyond the initial state).
|
|
||||||
// - Template projects (no clonedAtOid): altered when totalCommits > 1 (beyond the initial template commit)
|
|
||||||
// - Cloned projects (has clonedAtOid): altered when the latest commit differs from the clone point
|
|
||||||
const isProjectAltered = !isGitStatusLoading && gitStatus && (() => {
|
|
||||||
if (gitStatus.clonedAtOid) {
|
|
||||||
return gitStatus.latestCommit !== null && gitStatus.latestCommit.oid !== gitStatus.clonedAtOid;
|
|
||||||
}
|
|
||||||
return gitStatus.totalCommits > 1;
|
|
||||||
})();
|
|
||||||
|
|
||||||
// Check if we need to show the warning popover
|
// Check if we need to show the warning popover
|
||||||
const needsRemote = isProjectAltered &&
|
const needsRemote = !isGitStatusLoading && gitStatus &&
|
||||||
!gitStatus?.remotes.find(r => r.name === 'origin');
|
!gitStatus.remotes.find(r => r.name === 'origin') &&
|
||||||
|
gitStatus.totalCommits > 1;
|
||||||
|
|
||||||
// Show warning popover when purple indicator is visible (only if not dismissed)
|
// Show warning popover when purple indicator is visible (only if not dismissed)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (needsRemote && !warningDismissed.current) {
|
if (needsRemote && !warningDismissed.current && gitStatus.totalCommits > 1) {
|
||||||
setShowWarningPopover(true);
|
setShowWarningPopover(true);
|
||||||
} else {
|
} else {
|
||||||
setShowWarningPopover(false);
|
setShowWarningPopover(false);
|
||||||
}
|
}
|
||||||
}, [needsRemote]);
|
}, [gitStatus?.totalCommits, needsRemote]);
|
||||||
|
|
||||||
// Handle button click - dismiss warning popover permanently
|
// Handle button click - dismiss warning popover permanently
|
||||||
const handleButtonClick = () => {
|
const handleButtonClick = () => {
|
||||||
@@ -105,18 +96,19 @@ export function GitSyncButton({ projectId, className }: GitSyncButtonProps) {
|
|||||||
|
|
||||||
if (isGitStatusLoading || !gitStatus) return null;
|
if (isGitStatusLoading || !gitStatus) return null;
|
||||||
|
|
||||||
const hasOrigin = !!gitStatus.remotes.find(r => r.name === 'origin');
|
const originRemote = gitStatus.remotes.find(r => r.name === 'origin');
|
||||||
|
const hasRemote = !!originRemote;
|
||||||
|
|
||||||
const { remoteBranchExists, ahead, behind } = gitStatus;
|
const { remoteBranchExists, ahead, behind, totalCommits } = gitStatus;
|
||||||
|
|
||||||
// Yellow indicator: unsynced changes (ahead or behind remote) - third priority
|
// Yellow indicator: unsynced changes (ahead or behind remote) - third priority
|
||||||
const hasUnsyncedChanges = hasOrigin && remoteBranchExists && (ahead > 0 || behind > 0);
|
const hasUnsyncedChanges = hasRemote && remoteBranchExists && (ahead > 0 || behind > 0);
|
||||||
if (hasUnsyncedChanges) {
|
if (hasUnsyncedChanges) {
|
||||||
return <IndicatorDot color="yellow" />;
|
return <IndicatorDot color="yellow" />;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Purple indicator: project altered but no origin remote configured - lowest priority
|
// Purple indicator: no remote configured, but has commits - lowest priority
|
||||||
const needsRemote = isProjectAltered && !hasOrigin;
|
const needsRemote = !hasRemote && totalCommits > 1;
|
||||||
if (needsRemote) {
|
if (needsRemote) {
|
||||||
return <IndicatorDot color="primary" />;
|
return <IndicatorDot color="primary" />;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import { useGitAutosync } from '@/hooks/useGitAutosync';
|
|||||||
import { ArrowUp } from 'lucide-react';
|
import { ArrowUp } from 'lucide-react';
|
||||||
import { ForcePushDialog } from './ForcePushDialog';
|
import { ForcePushDialog } from './ForcePushDialog';
|
||||||
import { SyncStepError } from './SyncStepError';
|
import { SyncStepError } from './SyncStepError';
|
||||||
import { useProjectDeploySettings } from '@/hooks/useProjectDeploySettings';
|
|
||||||
|
|
||||||
// Helper function to convert kebab-case to Title Case
|
// Helper function to convert kebab-case to Title Case
|
||||||
function kebabToTitleCase(str: string): string {
|
function kebabToTitleCase(str: string): string {
|
||||||
@@ -58,7 +57,6 @@ export function ConfigureRepoStep({
|
|||||||
const { mutateAsync: publishEvent } = useNostrPublish();
|
const { mutateAsync: publishEvent } = useNostrPublish();
|
||||||
const { fs } = useFS();
|
const { fs } = useFS();
|
||||||
const { config } = useAppContext();
|
const { config } = useAppContext();
|
||||||
const { settings: projectDeploySettings } = useProjectDeploySettings(projectId);
|
|
||||||
|
|
||||||
// Auto-update repo name when repo identifier changes (unless manually edited)
|
// Auto-update repo name when repo identifier changes (unless manually edited)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -171,15 +169,6 @@ export function ConfigureRepoStep({
|
|||||||
tTags.push(template.name);
|
tTags.push(template.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get deployment URL from project settings if available
|
|
||||||
let webUrls: string[] | undefined;
|
|
||||||
if (projectDeploySettings.currentProvider) {
|
|
||||||
const currentProviderConfig = projectDeploySettings.providers[projectDeploySettings.currentProvider];
|
|
||||||
if (currentProviderConfig?.url) {
|
|
||||||
webUrls = [currentProviderConfig.url];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the repository announcement event
|
// Create the repository announcement event
|
||||||
const eventTemplate = createRepositoryAnnouncementEvent({
|
const eventTemplate = createRepositoryAnnouncementEvent({
|
||||||
repoId: repoIdentifier,
|
repoId: repoIdentifier,
|
||||||
@@ -187,7 +176,6 @@ export function ConfigureRepoStep({
|
|||||||
cloneUrls: [...cloneUrls],
|
cloneUrls: [...cloneUrls],
|
||||||
relays: [...relays],
|
relays: [...relays],
|
||||||
tTags,
|
tTags,
|
||||||
webUrls,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Publish the event
|
// Publish the event
|
||||||
|
|||||||
@@ -68,10 +68,6 @@ export interface AppConfig {
|
|||||||
sentryEnabled: boolean;
|
sentryEnabled: boolean;
|
||||||
/** System prompt EJS template */
|
/** System prompt EJS template */
|
||||||
systemPrompt?: string;
|
systemPrompt?: string;
|
||||||
/** Plausible Analytics domain (empty string = disabled). */
|
|
||||||
plausibleDomain: string;
|
|
||||||
/** Plausible Analytics API endpoint (empty string = use default). */
|
|
||||||
plausibleEndpoint: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AppContextType {
|
export interface AppContextType {
|
||||||
|
|||||||
@@ -1,104 +0,0 @@
|
|||||||
import { useNostr } from '@nostrify/react';
|
|
||||||
import { useQuery } from '@tanstack/react-query';
|
|
||||||
import { useEffect, useState } from 'react';
|
|
||||||
import type { NostrEvent } from '@nostrify/nostrify';
|
|
||||||
|
|
||||||
import { useFS } from '@/hooks/useFS';
|
|
||||||
import { useCurrentUser } from '@/hooks/useCurrentUser';
|
|
||||||
import { DotAI } from '@/lib/DotAI';
|
|
||||||
|
|
||||||
interface UseAppEventOptions {
|
|
||||||
/** Project working directory (e.g. /projects/<id>) */
|
|
||||||
cwd: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hook to fetch the kind 31990 app event associated with this project.
|
|
||||||
* Reads the stored "a" coordinate from .git/shakespeare/app.json,
|
|
||||||
* then queries relays for the matching event.
|
|
||||||
*/
|
|
||||||
export function useAppEvent({ cwd }: UseAppEventOptions) {
|
|
||||||
const { nostr } = useNostr();
|
|
||||||
const { fs } = useFS();
|
|
||||||
const { user } = useCurrentUser();
|
|
||||||
const [aTag, setATag] = useState<string | null>(null);
|
|
||||||
const [isLoadingConfig, setIsLoadingConfig] = useState(true);
|
|
||||||
|
|
||||||
// Read the stored "a" coordinate on mount
|
|
||||||
useEffect(() => {
|
|
||||||
const loadConfig = async () => {
|
|
||||||
try {
|
|
||||||
const dotAI = new DotAI(fs, cwd);
|
|
||||||
const config = await dotAI.readAppConfig();
|
|
||||||
setATag(config?.a ?? null);
|
|
||||||
} catch {
|
|
||||||
setATag(null);
|
|
||||||
} finally {
|
|
||||||
setIsLoadingConfig(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
loadConfig();
|
|
||||||
}, [fs, cwd]);
|
|
||||||
|
|
||||||
// Parse the "a" coordinate into filter components
|
|
||||||
const parsed = aTag ? parseATag(aTag) : null;
|
|
||||||
|
|
||||||
const query = useQuery<NostrEvent | null>({
|
|
||||||
queryKey: ['app-event', aTag],
|
|
||||||
queryFn: async ({ signal }) => {
|
|
||||||
if (!parsed) return null;
|
|
||||||
|
|
||||||
const events = await nostr.query(
|
|
||||||
[{
|
|
||||||
kinds: [parsed.kind],
|
|
||||||
authors: [parsed.pubkey],
|
|
||||||
'#d': [parsed.dTag],
|
|
||||||
limit: 1,
|
|
||||||
}],
|
|
||||||
{ signal: AbortSignal.any([signal, AbortSignal.timeout(5000)]) },
|
|
||||||
);
|
|
||||||
|
|
||||||
if (events.length === 0) return null;
|
|
||||||
|
|
||||||
// Return the most recent event
|
|
||||||
return events.reduce((latest, current) =>
|
|
||||||
current.created_at > latest.created_at ? current : latest,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
enabled: !!parsed && !isLoadingConfig,
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
/** The stored "a" coordinate (e.g. "31990:<pubkey>:<d-tag>") */
|
|
||||||
aTag,
|
|
||||||
/** Set the "a" coordinate (updates local state; caller must persist) */
|
|
||||||
setATag,
|
|
||||||
/** The fetched kind 31990 event, or null */
|
|
||||||
event: query.data ?? null,
|
|
||||||
/** Whether the config or event is still loading */
|
|
||||||
isLoading: isLoadingConfig || query.isLoading,
|
|
||||||
/** Whether there is an existing app event for this project */
|
|
||||||
hasApp: !!aTag,
|
|
||||||
/** The current user's pubkey */
|
|
||||||
userPubkey: user?.pubkey,
|
|
||||||
/** Refetch the event from relays */
|
|
||||||
refetch: query.refetch,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Parse a Nostr "a" coordinate string into its components */
|
|
||||||
function parseATag(a: string): { kind: number; pubkey: string; dTag: string } | null {
|
|
||||||
const parts = a.split(':');
|
|
||||||
if (parts.length < 3) return null;
|
|
||||||
|
|
||||||
const kind = parseInt(parts[0], 10);
|
|
||||||
if (isNaN(kind)) return null;
|
|
||||||
|
|
||||||
const pubkey = parts[1];
|
|
||||||
const dTag = parts.slice(2).join(':'); // d-tag may contain colons
|
|
||||||
|
|
||||||
if (!pubkey || dTag === undefined) return null;
|
|
||||||
|
|
||||||
return { kind, pubkey, dTag };
|
|
||||||
}
|
|
||||||
@@ -80,8 +80,6 @@ describe('useGenerateProjectInfo', () => {
|
|||||||
fsPathTemplates: '/templates',
|
fsPathTemplates: '/templates',
|
||||||
sentryDsn: '',
|
sentryDsn: '',
|
||||||
sentryEnabled: false,
|
sentryEnabled: false,
|
||||||
plausibleDomain: '',
|
|
||||||
plausibleEndpoint: '',
|
|
||||||
};
|
};
|
||||||
mockUseAppContext.mockReturnValue({
|
mockUseAppContext.mockReturnValue({
|
||||||
config,
|
config,
|
||||||
@@ -244,8 +242,6 @@ describe('useGenerateProjectInfo', () => {
|
|||||||
fsPathTemplates: '/templates',
|
fsPathTemplates: '/templates',
|
||||||
sentryDsn: '',
|
sentryDsn: '',
|
||||||
sentryEnabled: false,
|
sentryEnabled: false,
|
||||||
plausibleDomain: '',
|
|
||||||
plausibleEndpoint: '',
|
|
||||||
};
|
};
|
||||||
mockUseAppContext.mockReturnValue({
|
mockUseAppContext.mockReturnValue({
|
||||||
config,
|
config,
|
||||||
|
|||||||
@@ -54,8 +54,6 @@ function createWrapper(corsProxy: string) {
|
|||||||
fsPathTemplates: '/templates',
|
fsPathTemplates: '/templates',
|
||||||
sentryDsn: '',
|
sentryDsn: '',
|
||||||
sentryEnabled: false,
|
sentryEnabled: false,
|
||||||
plausibleDomain: '',
|
|
||||||
plausibleEndpoint: '',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return createElement(
|
return createElement(
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ interface GitStatus {
|
|||||||
ahead: number;
|
ahead: number;
|
||||||
behind: number;
|
behind: number;
|
||||||
remoteBranchExists: boolean;
|
remoteBranchExists: boolean;
|
||||||
clonedAtOid: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useGitStatus(projectId: string | null) {
|
export function useGitStatus(projectId: string | null) {
|
||||||
@@ -62,7 +61,6 @@ export function useGitStatus(projectId: string | null) {
|
|||||||
ahead: 0,
|
ahead: 0,
|
||||||
behind: 0,
|
behind: 0,
|
||||||
remoteBranchExists: false,
|
remoteBranchExists: false,
|
||||||
clonedAtOid: null,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +83,6 @@ export function useGitStatus(projectId: string | null) {
|
|||||||
ahead: 0,
|
ahead: 0,
|
||||||
behind: 0,
|
behind: 0,
|
||||||
remoteBranchExists: false,
|
remoteBranchExists: false,
|
||||||
clonedAtOid: null,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,17 +168,6 @@ export function useGitStatus(projectId: string | null) {
|
|||||||
console.warn('Could not get remotes:', error);
|
console.warn('Could not get remotes:', error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get clonedAt OID (set when project was cloned from an external repo)
|
|
||||||
let clonedAtOid: string | null = null;
|
|
||||||
try {
|
|
||||||
const value = await git.getConfig({ dir: cwd, path: 'shakespeare.clonedAt' });
|
|
||||||
if (typeof value === 'string' && value.length > 0) {
|
|
||||||
clonedAtOid = value;
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// Config key doesn't exist, that's fine
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get git status to see what files have changed
|
// Get git status to see what files have changed
|
||||||
const statusMatrix = await git.statusMatrix({
|
const statusMatrix = await git.statusMatrix({
|
||||||
dir: cwd,
|
dir: cwd,
|
||||||
@@ -288,7 +274,6 @@ export function useGitStatus(projectId: string | null) {
|
|||||||
ahead,
|
ahead,
|
||||||
behind,
|
behind,
|
||||||
remoteBranchExists,
|
remoteBranchExists,
|
||||||
clonedAtOid,
|
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error checking git status:', error);
|
console.error('Error checking git status:', error);
|
||||||
@@ -304,7 +289,6 @@ export function useGitStatus(projectId: string | null) {
|
|||||||
ahead: 0,
|
ahead: 0,
|
||||||
behind: 0,
|
behind: 0,
|
||||||
remoteBranchExists: false,
|
remoteBranchExists: false,
|
||||||
clonedAtOid: null,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,14 +15,7 @@ const nsiteProjectConfigSchema = z.object({
|
|||||||
type: z.literal('nsite'),
|
type: z.literal('nsite'),
|
||||||
url: z.string(),
|
url: z.string(),
|
||||||
data: z.object({
|
data: z.object({
|
||||||
/** Kept optional — only present on configs created before the signer migration */
|
nsec: z.string(),
|
||||||
nsec: z.string().optional(),
|
|
||||||
siteTitle: z.string().optional(),
|
|
||||||
siteDescription: z.string().optional(),
|
|
||||||
/** Named-site dTag identifier (kind 35128). */
|
|
||||||
dTag: z.string().optional(),
|
|
||||||
/** @deprecated — Shakespeare always deploys named sites now. Kept for backward compat. */
|
|
||||||
siteType: z.enum(['named', 'root']).optional(),
|
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ export function useUploadFile() {
|
|||||||
const uploader = new BlossomUploader({
|
const uploader = new BlossomUploader({
|
||||||
servers: [
|
servers: [
|
||||||
'https://blossom.primal.net/',
|
'https://blossom.primal.net/',
|
||||||
'https://blossom.ditto.pub/',
|
|
||||||
],
|
],
|
||||||
signer: user.signer,
|
signer: user.signer,
|
||||||
});
|
});
|
||||||
|
|||||||