Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b22a19e6e |
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,3 @@
|
|||||||
# Sentry
|
|
||||||
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="****************************************"
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ yarn-error.log*
|
|||||||
pnpm-debug.log*
|
pnpm-debug.log*
|
||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
|
|
||||||
deploy.sh
|
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
dist-ssr
|
dist-ssr
|
||||||
@@ -16,9 +15,6 @@ dist-ssr
|
|||||||
*.apk
|
*.apk
|
||||||
*.aab
|
*.aab
|
||||||
|
|
||||||
# Electron build output
|
|
||||||
electron-dist
|
|
||||||
|
|
||||||
# Editor directories and files
|
# Editor directories and files
|
||||||
.idea
|
.idea
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|||||||
@@ -1,28 +1,15 @@
|
|||||||
image: node:25
|
image: node:22
|
||||||
|
|
||||||
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,199 +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"
|
|
||||||
--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
|
|
||||||
RELAY_URLS: "wss://relay.zapstore.dev,wss://relay.ditto.pub"
|
|
||||||
BLOSSOM_URL: "https://blossom.ditto.pub"
|
|
||||||
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.
|
||||||
@@ -37,16 +33,17 @@ This architecture allows Shakespeare to provide a full development environment e
|
|||||||
|
|
||||||
Shakespeare provides AI agents with specialized tools for project development (note: these are different from the tools available during Shakespeare's own development). These tools are defined in `src/lib/tools/`:
|
Shakespeare provides AI agents with specialized tools for project development (note: these are different from the tools available during Shakespeare's own development). These tools are defined in `src/lib/tools/`:
|
||||||
|
|
||||||
- **ShellTool**: Execute shell commands in the virtual browser environment
|
- **ShellTool**: Execute shell commands in the virtual filesystem environment
|
||||||
- **TextEditorViewTool**: Read file contents and view directory structures
|
- **TextEditorViewTool**: Read file contents and view directory structures
|
||||||
- **TextEditorWriteTool**: Create or overwrite files with new content
|
- **TextEditorWriteTool**: Create or overwrite files with new content
|
||||||
- **TextEditorStrReplaceTool**: Replace strings in files
|
- **TextEditorStrReplaceTool**: Replace strings in files
|
||||||
- **BuildProjectTool**: Build and compile projects
|
- **BuildProjectTool**: Build and compile projects
|
||||||
|
- **TypecheckTool**: Run TypeScript type checking
|
||||||
- **NpmAddPackageTool**: Add npm packages to projects
|
- **NpmAddPackageTool**: Add npm packages to projects
|
||||||
- **NpmRemovePackageTool**: Remove npm packages from projects
|
- **NpmRemovePackageTool**: Remove npm packages from projects
|
||||||
- **GitCommitTool**: Commit changes to Git repositories
|
- **GitCommitTool**: Commit changes to Git repositories
|
||||||
- **WebFetchTool**: Fetch and read web pages with support for markdown, text, and HTML formats
|
- **DeployProjectTool**: Deploy projects to hosting platforms
|
||||||
- **WebSearchTool**: Search the web using Exa AI for real-time web searches
|
- **ReadWebpageTool**: Fetch and read web pages
|
||||||
- **NostrReadNipTool**: Read Nostr protocol NIP documents
|
- **NostrReadNipTool**: Read Nostr protocol NIP documents
|
||||||
- **NostrReadKindTool**: Read Nostr event kind documentation
|
- **NostrReadKindTool**: Read Nostr event kind documentation
|
||||||
- **NostrReadTagTool**: Read Nostr tag documentation
|
- **NostrReadTagTool**: Read Nostr tag documentation
|
||||||
@@ -54,9 +51,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
|
||||||
@@ -86,7 +80,6 @@ Shakespeare provides full Git functionality in the browser using `isomorphic-git
|
|||||||
- **LightningFSAdapter**: Adapts LightningFS to the unified JSRuntimeFS interface
|
- **LightningFSAdapter**: Adapts LightningFS to the unified JSRuntimeFS interface
|
||||||
- **GitCommitTool**: AI tool for automated commits with staging and validation
|
- **GitCommitTool**: AI tool for automated commits with staging and validation
|
||||||
- **useGitStatus Hook**: Real-time Git status monitoring (updates every 5 seconds)
|
- **useGitStatus Hook**: Real-time Git status monitoring (updates every 5 seconds)
|
||||||
- **useGitFetch Hook**: Automatic remote fetch
|
|
||||||
- **ProjectsManager**: Handles project creation, Git initialization, and template cloning
|
- **ProjectsManager**: Handles project creation, Git initialization, and template cloning
|
||||||
|
|
||||||
#### Core Features
|
#### Core Features
|
||||||
@@ -115,30 +108,6 @@ Shakespeare provides full Git functionality in the browser using `isomorphic-git
|
|||||||
|
|
||||||
Git operations happen transparently in the background, providing professional version control without requiring Git knowledge from users.
|
Git operations happen transparently in the background, providing professional version control without requiring Git knowledge from users.
|
||||||
|
|
||||||
### Gift Card Redemption
|
|
||||||
|
|
||||||
Shakespeare supports automatic gift card redemption via URL parameters. Users can click shareable gift card links to instantly redeem AI credits.
|
|
||||||
|
|
||||||
**URL Format:**
|
|
||||||
```
|
|
||||||
/giftcard#baseURL=<providerBaseURL>&code=<giftcardCode>
|
|
||||||
```
|
|
||||||
|
|
||||||
**Flow:**
|
|
||||||
1. User clicks gift card link (e.g., from email or social media)
|
|
||||||
2. Shakespeare displays a dialog showing the credit amount
|
|
||||||
3. URL is rewritten to `/` for privacy (removes gift card code from history)
|
|
||||||
4. If user is not logged in or provider is not configured, a multi-step wizard guides them through setup
|
|
||||||
5. User can switch between Nostr accounts before redeeming
|
|
||||||
6. Credits are added to the user's account via NIP-98 authenticated API call
|
|
||||||
|
|
||||||
**Components:**
|
|
||||||
- `GiftCardRedeemDialog`: Main dialog handling the entire redemption flow
|
|
||||||
- Integrates with existing login/signup dialogs and provider configuration
|
|
||||||
- Automatically matches provider baseURL against configured providers and presets
|
|
||||||
|
|
||||||
See `GIFTCARD_REDEMPTION.md` for detailed documentation.
|
|
||||||
|
|
||||||
## AI Message Format
|
## AI Message Format
|
||||||
|
|
||||||
Shakespeare uses OpenAI-compatible messages for communication between users and AI assistants. The message format follows these conventions:
|
Shakespeare uses OpenAI-compatible messages for communication between users and AI assistants. The message format follows these conventions:
|
||||||
@@ -215,7 +184,6 @@ This project is a Nostr client application built with React 18.x, TailwindCSS 3.
|
|||||||
- `useGitSettings`: Manage Git credentials and repository settings
|
- `useGitSettings`: Manage Git credentials and repository settings
|
||||||
- `useSessionManager`: Access session management for AI chat sessions
|
- `useSessionManager`: Access session management for AI chat sessions
|
||||||
- `useGitStatus`: Real-time Git repository status monitoring
|
- `useGitStatus`: Real-time Git repository status monitoring
|
||||||
- `useGitFetch`: Automatic remote fetch
|
|
||||||
- `useProjects`: Project management and CRUD operations
|
- `useProjects`: Project management and CRUD operations
|
||||||
- `useProjectsManager`: Advanced project operations (creation, cloning, building, ZIP import)
|
- `useProjectsManager`: Advanced project operations (creation, cloning, building, ZIP import)
|
||||||
- `useTheme`: Theme management
|
- `useTheme`: Theme management
|
||||||
@@ -236,11 +204,11 @@ This project is a Nostr client application built with React 18.x, TailwindCSS 3.
|
|||||||
- Unix-style commands: `cat`, `cd`, `cp`, `find`, `grep`, `ls`, `mkdir`, `mv`, `rm`, etc.
|
- Unix-style commands: `cat`, `cd`, `cp`, `find`, `grep`, `ls`, `mkdir`, `mv`, `rm`, etc.
|
||||||
- `/src/lib/tools/`: AI tool implementations for project development
|
- `/src/lib/tools/`: AI tool implementations for project development
|
||||||
- File operations: `TextEditorViewTool`, `TextEditorWriteTool`, `TextEditorStrReplaceTool`
|
- File operations: `TextEditorViewTool`, `TextEditorWriteTool`, `TextEditorStrReplaceTool`
|
||||||
- Project tools: `BuildProjectTool`
|
- Project tools: `BuildProjectTool`, `TypecheckTool`, `DeployProjectTool`
|
||||||
- Package management: `NpmAddPackageTool`, `NpmRemovePackageTool`
|
- Package management: `NpmAddPackageTool`, `NpmRemovePackageTool`
|
||||||
- Git integration: `GitCommitTool`
|
- Git integration: `GitCommitTool`
|
||||||
- Shell access: `ShellTool`
|
- Shell access: `ShellTool`
|
||||||
- Web access: `WebFetchTool`, `WebSearchTool`
|
- Web access: `ReadWebpageTool`
|
||||||
- Nostr tools: `NostrReadNipTool`, `NostrFetchEventTool`, `NostrGenerateKindTool`, etc.
|
- Nostr tools: `NostrReadNipTool`, `NostrFetchEventTool`, `NostrGenerateKindTool`, etc.
|
||||||
- `/src/contexts/`: React context providers
|
- `/src/contexts/`: React context providers
|
||||||
- `AppContext`: Global app configuration and theme
|
- `AppContext`: Global app configuration and theme
|
||||||
@@ -1095,19 +1063,12 @@ The project includes an `AppProvider` that manages global application state incl
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
const defaultConfig: AppConfig = {
|
const defaultConfig: AppConfig = {
|
||||||
theme: "system",
|
theme: "light",
|
||||||
relayMetadata: {
|
relayUrl: "wss://relay.nostr.band",
|
||||||
relays: [
|
|
||||||
{ url: 'wss://relay.ditto.pub', read: true, write: true },
|
|
||||||
{ url: 'wss://relay.primal.net', read: true, write: true },
|
|
||||||
],
|
|
||||||
updatedAt: 0,
|
|
||||||
},
|
|
||||||
// ... other config options
|
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
The app uses NIP-65 relay lists for managing multiple relays with read/write permissions. Configuration is persisted in local storage.
|
Preset relays are available including Ditto, Nostr.Band, Damus, and Primal. The app uses local storage to persist user preferences.
|
||||||
|
|
||||||
## Routing
|
## Routing
|
||||||
|
|
||||||
@@ -1161,12 +1122,11 @@ The router includes automatic scroll-to-top functionality and a 404 NotFound pag
|
|||||||
|
|
||||||
### Empty States and No Content Found
|
### Empty States and No Content Found
|
||||||
|
|
||||||
When no content is found (empty search results, no data available, etc.), display a minimalist empty state that guides users to take action or provides helpful context.
|
When no content is found (empty search results, no data available, etc.), display a minimalist empty state with the `RelaySelector` component. This allows users to easily switch relays to discover content from different sources.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
|
import { RelaySelector } from '@/components/RelaySelector';
|
||||||
import { Card, CardContent } from '@/components/ui/card';
|
import { Card, CardContent } from '@/components/ui/card';
|
||||||
import { Button } from '@/components/ui/button';
|
|
||||||
import { Link } from 'react-router-dom';
|
|
||||||
|
|
||||||
// Empty state example
|
// Empty state example
|
||||||
<div className="col-span-full">
|
<div className="col-span-full">
|
||||||
@@ -1174,64 +1134,24 @@ import { Link } from 'react-router-dom';
|
|||||||
<CardContent className="py-12 px-8 text-center">
|
<CardContent className="py-12 px-8 text-center">
|
||||||
<div className="max-w-sm mx-auto space-y-6">
|
<div className="max-w-sm mx-auto space-y-6">
|
||||||
<p className="text-muted-foreground">
|
<p className="text-muted-foreground">
|
||||||
No results found. Configure your relays to discover more content.
|
No results found. Try another relay?
|
||||||
</p>
|
</p>
|
||||||
<Button asChild variant="outline">
|
<RelaySelector className="w-full" />
|
||||||
<Link to="/settings/nostr">Manage Relays</Link>
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
```
|
```
|
||||||
|
|
||||||
## CRITICAL Design Standards
|
## Design Customization
|
||||||
|
|
||||||
- Create breathtaking, immersive designs that feel like bespoke masterpieces, rivaling the polish of Apple, Stripe, or luxury brands
|
**Tailor the site's look and feel based on the user's specific request.** This includes:
|
||||||
- Designs must be production-ready, fully featured, with no placeholders unless explicitly requested, ensuring every element serves a functional and aesthetic purpose
|
|
||||||
- Avoid generic or templated aesthetics at all costs; every design must have a unique, brand-specific visual signature that feels custom-crafted
|
|
||||||
- Headers must be dynamic, immersive, and storytelling-driven, using layered visuals, motion, and symbolic elements to reflect the brand’s identity—never use simple “icon and text” combos
|
|
||||||
- Incorporate purposeful, lightweight animations for scroll reveals, micro-interactions (e.g., hover, click, transitions), and section transitions to create a sense of delight and fluidity
|
|
||||||
|
|
||||||
### Design Principles
|
- **Color schemes**: Incorporate the user's color preferences when specified, and choose an appropriate scheme that matches the application's purpose and aesthetic
|
||||||
|
- **Typography**: Choose fonts that match the requested aesthetic (modern, elegant, playful, etc.)
|
||||||
- Achieve Apple-level refinement with meticulous attention to detail, ensuring designs evoke strong emotions (e.g., wonder, inspiration, energy) through color, motion, and composition
|
- **Layout**: Follow the requested structure (3-column, sidebar, grid, etc.)
|
||||||
- Deliver fully functional interactive components with intuitive feedback states, ensuring every element has a clear purpose and enhances user engagement
|
- **Component styling**: Use appropriate border radius, shadows, and spacing for the desired feel
|
||||||
- Use custom illustrations, 3D elements, or symbolic visuals instead of generic stock imagery to create a unique brand narrative; stock imagery, when required, must be sourced exclusively from Pexels (NEVER Unsplash) and align with the design’s emotional tone
|
- **Interactive elements**: Style buttons, forms, and hover states to match the theme
|
||||||
- Ensure designs feel alive and modern with dynamic elements like gradients, glows, or parallax effects, avoiding static or flat aesthetics
|
|
||||||
- Before finalizing, ask: "Would this design make Apple or Stripe designers pause and take notice?" If not, iterate until it does
|
|
||||||
|
|
||||||
### Avoid Generic Design
|
|
||||||
|
|
||||||
- No basic layouts (e.g., text-on-left, image-on-right) without significant custom polish, such as dynamic backgrounds, layered visuals, or interactive elements
|
|
||||||
- No simplistic headers; they must be immersive, animated, and reflective of the brand’s core identity and mission
|
|
||||||
- No designs that could be mistaken for free templates or overused patterns; every element must feel intentional and tailored
|
|
||||||
|
|
||||||
### Interaction Patterns
|
|
||||||
|
|
||||||
- Use progressive disclosure for complex forms or content to guide users intuitively and reduce cognitive load
|
|
||||||
- Incorporate contextual menus, smart tooltips, and visual cues to enhance navigation and usability
|
|
||||||
- Implement drag-and-drop, hover effects, and transitions with clear, dynamic visual feedback to elevate the user experience
|
|
||||||
- Support power users with keyboard shortcuts, ARIA labels, and focus states for accessibility and efficiency
|
|
||||||
- Add subtle parallax effects or scroll-triggered animations to create depth and engagement without overwhelming the user
|
|
||||||
|
|
||||||
### Technical Requirements
|
|
||||||
|
|
||||||
- Curated color FRpalette (3-5 evocative colors + neutrals) that aligns with the brand’s emotional tone and creates a memorable impact
|
|
||||||
- Ensure a minimum 4.5:1 contrast ratio for all text and interactive elements to meet accessibility standards
|
|
||||||
- Use expressive, readable fonts (18px+ for body text, 40px+ for headlines) with a clear hierarchy; pair a modern sans-serif (e.g., Inter) with an elegant serif (e.g., Playfair Display) for personality
|
|
||||||
- Design for full responsiveness, ensuring flawless performance and aesthetics across all screen sizes (mobile, tablet, desktop)
|
|
||||||
- Adhere to WCAG 2.1 AA guidelines, including keyboard navigation, screen reader support, and reduced motion options
|
|
||||||
- Follow an 8px grid system for consistent spacing, padding, and alignment to ensure visual harmony
|
|
||||||
- Add depth with subtle shadows, gradients, glows, and rounded corners (e.g., 16px radius) to create a polished, modern aesthetic
|
|
||||||
- Optimize animations and interactions to be lightweight and performant, ensuring smooth experiences across devices
|
|
||||||
|
|
||||||
### Components
|
|
||||||
|
|
||||||
- Design reusable, modular components with consistent styling, behavior, and feedback states (e.g., hover, active, focus, error)
|
|
||||||
- Include purposeful animations (e.g., scale-up on hover, fade-in on scroll) to guide attention and enhance interactivity without distraction
|
|
||||||
- Ensure full accessibility support with keyboard navigation, ARIA labels, and visible focus states (e.g., a glowing outline in an accent color)
|
|
||||||
- Use custom icons or illustrations for components to reinforce the brand’s visual identity
|
|
||||||
|
|
||||||
### Adding Fonts
|
### Adding Fonts
|
||||||
|
|
||||||
@@ -1296,7 +1216,6 @@ When users specify color schemes:
|
|||||||
- Follow shadcn/ui patterns for component variants
|
- Follow shadcn/ui patterns for component variants
|
||||||
- Implement responsive design with Tailwind breakpoints
|
- Implement responsive design with Tailwind breakpoints
|
||||||
- Add hover and focus states for interactive elements
|
- Add hover and focus states for interactive elements
|
||||||
- **Use `hover:bg-muted` for hover states on clickable cards/buttons** - provides subtle, accessible feedback without overpowering the design (avoid `hover:bg-accent` or `hover:bg-secondary` which can be too strong)
|
|
||||||
|
|
||||||
## Writing Tests vs Running Tests
|
## Writing Tests vs Running Tests
|
||||||
|
|
||||||
|
|||||||
@@ -1,90 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
## [9.11.3] - 2026-04-12
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- App publish dialog now appears on mobile devices
|
|
||||||
- Changelog available offline via ServiceWorker precache
|
|
||||||
|
|
||||||
## [9.11.2] - 2026-04-06
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Derive private preview subdomains with HMAC to prevent cross-project origin collisions on iframe.diy
|
|
||||||
|
|
||||||
## [9.11.1] - 2026-04-05
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
- Switch preview pane to iframe.diy for improved reliability and compatibility
|
|
||||||
- New users start with OpenCode Zen pre-configured for a zero-setup first experience
|
|
||||||
- Default nsite gateway changed to shakespeare.to with vanity subdomain support
|
|
||||||
- Update default Blossom servers and relay lists across deployments and uploads
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Default settings no longer override existing users' recently used models
|
|
||||||
- Showcase card clone URLs now use proper Nostr URI encoding
|
|
||||||
- Service worker no longer blocks SvelteKit nsite routes
|
|
||||||
|
|
||||||
## [9.11.0] - 2026-04-03
|
|
||||||
|
|
||||||
### Added
|
|
||||||
- Upload a banner image for your app directly from the App dialog
|
|
||||||
- T-tag editor in the App dialog Advanced section for tagging your app by category
|
|
||||||
- Delete App button in the App dialog Advanced section when editing an existing app
|
|
||||||
- Ngit repo and nsite deployment address fields in the App dialog Advanced section
|
|
||||||
- Auto-fill app name, description, and images from your project's OG tags and web manifest on first publish
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
- Redesigned App dialog with an overlapping banner and avatar card layout
|
|
||||||
- Reorganized App dialog Advanced section into General, Handlers, and Tags tabs
|
|
||||||
- Showcase cards now show banner and icon images, and require both to appear in the showcase
|
|
||||||
- Validation summary above the Save button replaces per-field "Required" labels
|
|
||||||
- Updated showcase curator to the Shakespeare Builders community list
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Upgrade Nostrify to fix bunker connection issues
|
|
||||||
|
|
||||||
## [9.10.4] - 2026-04-02
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Fix Android splash screen showing logo masked to white silhouette instead of full color
|
|
||||||
|
|
||||||
## [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
|
|
||||||
@@ -10,7 +10,6 @@ https://shakespeare.diy
|
|||||||
|
|
||||||
- **Use any AI provider** OpenAI, Anthropic, OpenRouter, xAI, ZAI, Deepseek, and more
|
- **Use any AI provider** OpenAI, Anthropic, OpenRouter, xAI, ZAI, Deepseek, and more
|
||||||
- **Buy credits anonymously** with Nostr and Lightning ⚡
|
- **Buy credits anonymously** with Nostr and Lightning ⚡
|
||||||
- **Redeem gift cards** with shareable links for instant credits
|
|
||||||
- **Runs entirely in the browser** No backend required
|
- **Runs entirely in the browser** No backend required
|
||||||
|
|
||||||
## How it Works
|
## How it Works
|
||||||
@@ -29,14 +28,6 @@ Shakespeare can work on any type of project. But it is specialized to build Reac
|
|||||||
|
|
||||||
Shakespeare is proudly Open Source software licensed under the GNU AGPLv3. The purpose of Shakespeare is to provide a free and open platform for building AI applications that respects user privacy and freedom.
|
Shakespeare is proudly Open Source software licensed under the GNU AGPLv3. The purpose of Shakespeare is to provide a free and open platform for building AI applications that respects user privacy and freedom.
|
||||||
|
|
||||||
## Mirrors
|
|
||||||
|
|
||||||
Shakespeare is available on the following URLs:
|
|
||||||
|
|
||||||
- [shakespeare.diy](https://shakespeare.diy)
|
|
||||||
- [shakespeare-diy.github.io](https://shakespeare-diy.github.io)
|
|
||||||
- [shakespeare-b0b9c8.gitlab.io](https://shakespeare-b0b9c8.gitlab.io)
|
|
||||||
|
|
||||||
## Alternatives
|
## Alternatives
|
||||||
|
|
||||||
- [goose](https://github.com/block/goose) - open-source desktop app and cli utilizing your full computer for AI tasks
|
- [goose](https://github.com/block/goose) - open-source desktop app and cli utilizing your full computer for AI tasks
|
||||||
|
|||||||
@@ -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,83 +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="#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,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;
|
|
||||||
@@ -15,7 +15,6 @@ The OAuth system consists of three main components:
|
|||||||
- **GitHub** - Git repository hosting (with PKCE support)
|
- **GitHub** - Git repository hosting (with PKCE support)
|
||||||
- **Netlify** - Static site deployment
|
- **Netlify** - Static site deployment
|
||||||
- **Vercel** - Static site deployment
|
- **Vercel** - Static site deployment
|
||||||
- **OpenRouter** - AI model routing (with PKCE support)
|
|
||||||
|
|
||||||
## File Structure
|
## File Structure
|
||||||
|
|
||||||
@@ -25,13 +24,11 @@ src/
|
|||||||
│ ├── useOAuth.ts # Generic OAuth hook (core logic)
|
│ ├── useOAuth.ts # Generic OAuth hook (core logic)
|
||||||
│ ├── useGitHubOAuth.ts # GitHub-specific configuration
|
│ ├── useGitHubOAuth.ts # GitHub-specific configuration
|
||||||
│ ├── useNetlifyOAuth.ts # Netlify-specific configuration
|
│ ├── useNetlifyOAuth.ts # Netlify-specific configuration
|
||||||
│ ├── useVercelOAuth.ts # Vercel-specific configuration
|
│ └── useVercelOAuth.ts # Vercel-specific configuration
|
||||||
│ └── useOpenRouterOAuth.ts # OpenRouter-specific configuration
|
|
||||||
├── pages/
|
├── pages/
|
||||||
│ ├── GitHubOAuth.tsx # GitHub OAuth callback page
|
│ ├── GitHubOAuth.tsx # GitHub OAuth callback page
|
||||||
│ ├── NetlifyOAuth.tsx # Netlify OAuth callback page
|
│ ├── NetlifyOAuth.tsx # Netlify OAuth callback page
|
||||||
│ ├── VercelOAuth.tsx # Vercel OAuth callback page
|
│ └── VercelOAuth.tsx # Vercel OAuth callback page
|
||||||
│ └── OpenRouterOAuth.tsx # OpenRouter OAuth callback page
|
|
||||||
└── AppRouter.tsx # Routes for OAuth callbacks
|
└── AppRouter.tsx # Routes for OAuth callbacks
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -193,7 +190,6 @@ const config: OAuthConfig = {
|
|||||||
- ✅ GitHub - Supports PKCE (enabled)
|
- ✅ GitHub - Supports PKCE (enabled)
|
||||||
- ❌ Netlify - Doesn't support PKCE (disabled)
|
- ❌ Netlify - Doesn't support PKCE (disabled)
|
||||||
- ❌ Vercel - Doesn't support PKCE (disabled)
|
- ❌ Vercel - Doesn't support PKCE (disabled)
|
||||||
- ✅ OpenRouter - Requires PKCE (enabled)
|
|
||||||
|
|
||||||
### Scope Parameter
|
### Scope Parameter
|
||||||
|
|
||||||
@@ -203,42 +199,6 @@ The `scope` parameter is optional in the OAuth configuration. Some providers (li
|
|||||||
- ✅ GitHub - Uses scopes (e.g., `repo workflow`)
|
- ✅ GitHub - Uses scopes (e.g., `repo workflow`)
|
||||||
- ❌ Netlify - No scope parameter (permissions set in app settings)
|
- ❌ Netlify - No scope parameter (permissions set in app settings)
|
||||||
- ✅ Vercel - Uses scopes (e.g., `deployments:write projects:read`)
|
- ✅ Vercel - Uses scopes (e.g., `deployments:write projects:read`)
|
||||||
- ❌ OpenRouter - No scope parameter (uses PKCE for authorization)
|
|
||||||
|
|
||||||
### OpenRouter Custom OAuth Implementation
|
|
||||||
|
|
||||||
OpenRouter uses a custom OAuth flow that differs from the standard OAuth 2.0 specification. Instead of using the generic `useOAuth` hook, it has a dedicated `useOpenRouterOAuth` hook with the following key differences:
|
|
||||||
|
|
||||||
1. **No Client Credentials**: OpenRouter doesn't require client ID or client secret - it uses PKCE only
|
|
||||||
2. **Authorization URL**: Uses `callback_url` parameter instead of `redirect_uri`
|
|
||||||
3. **Token Exchange**: Posts to `/api/v1/auth/keys` with a simplified request body
|
|
||||||
4. **Response Format**: Returns `{ key }` instead of standard `{ access_token }`
|
|
||||||
5. **PKCE Required**: Must use PKCE with S256 code challenge method
|
|
||||||
6. **No User Info**: Doesn't provide a user info endpoint after authentication
|
|
||||||
7. **No Environment Variables**: No configuration needed - works out of the box
|
|
||||||
|
|
||||||
**Authorization URL Format:**
|
|
||||||
```
|
|
||||||
https://openrouter.ai/auth?callback_url=<REDIRECT_URI>&code_challenge=<CHALLENGE>&code_challenge_method=S256
|
|
||||||
```
|
|
||||||
|
|
||||||
**Token Exchange Request:**
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"code": "<CODE_FROM_QUERY_PARAM>",
|
|
||||||
"code_verifier": "<CODE_VERIFIER>",
|
|
||||||
"code_challenge_method": "S256"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Token Exchange Response:**
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"key": "sk-or-v1-..."
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
This custom implementation is fully contained in `useOpenRouterOAuth.ts` and doesn't rely on the generic OAuth hook. Unlike other providers, OpenRouter's OAuth doesn't require any environment variables or application registration - it works immediately without configuration.
|
|
||||||
|
|
||||||
## Adding a New OAuth Provider
|
## Adding a New OAuth Provider
|
||||||
|
|
||||||
@@ -284,7 +244,7 @@ export function useNewProviderOAuth() {
|
|||||||
redirectUri: window.location.origin + '/oauth/newprovider',
|
redirectUri: window.location.origin + '/oauth/newprovider',
|
||||||
usePKCE: false, // Set to true if provider supports PKCE
|
usePKCE: false, // Set to true if provider supports PKCE
|
||||||
getUserInfo: async (accessToken: string, corsProxy: string) => {
|
getUserInfo: async (accessToken: string, corsProxy: string) => {
|
||||||
const userUrl = proxyUrl({ template: corsProxy, url: 'https://api.provider.com/user' });
|
const userUrl = proxyUrl(corsProxy, 'https://api.provider.com/user');
|
||||||
const userResponse = await fetch(userUrl, {
|
const userResponse = await fetch(userUrl, {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': `Bearer ${accessToken}`,
|
'Authorization': `Bearer ${accessToken}`,
|
||||||
|
|||||||
@@ -1,274 +0,0 @@
|
|||||||
# Shakespeare Plugins System
|
|
||||||
|
|
||||||
Shakespeare now includes a comprehensive plugins system that allows you to extend the AI's capabilities with reusable skills.
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
Plugins are Git repositories that can contain **skills** - specialized AI workflows that help the AI assistant perform specific tasks more effectively. Skills are automatically discovered and made available to the AI through the `skill` tool.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- **Git-based plugins**: Clone plugins from any Git repository (GitHub, GitLab, etc.)
|
|
||||||
- **Automatic skill discovery**: Skills are automatically found and registered from all installed plugins
|
|
||||||
- **Configurable storage**: Plugin directory is configurable in System Settings
|
|
||||||
- **Sync support**: Pull latest changes from plugin repositories
|
|
||||||
- **Delete support**: Remove plugins when no longer needed
|
|
||||||
- **AI integration**: Skills are automatically included in the system prompt and accessible via the `skill` tool
|
|
||||||
|
|
||||||
## User Interface
|
|
||||||
|
|
||||||
### AI Settings Page (`/settings/ai`)
|
|
||||||
|
|
||||||
The AI Settings page now includes a **Plugins** section with:
|
|
||||||
|
|
||||||
1. **Add Plugin**: Clone a new plugin by entering its Git URL
|
|
||||||
2. **Plugin List**: View all installed plugins with their skills
|
|
||||||
3. **Sync**: Pull latest changes from a plugin's Git repository
|
|
||||||
4. **Delete**: Remove a plugin and all its skills
|
|
||||||
|
|
||||||
### System Settings Page (`/settings/system`)
|
|
||||||
|
|
||||||
The System Settings page includes a **Filesystem Paths** section where you can configure:
|
|
||||||
|
|
||||||
- **Plugins Directory**: Path where plugins are stored (default: `/plugins`)
|
|
||||||
|
|
||||||
## Plugin Structure
|
|
||||||
|
|
||||||
A plugin is a Git repository with the following structure:
|
|
||||||
|
|
||||||
```
|
|
||||||
my-plugin/
|
|
||||||
├── skills/
|
|
||||||
│ ├── skill1/
|
|
||||||
│ │ └── SKILL.md
|
|
||||||
│ ├── skill2/
|
|
||||||
│ │ └── SKILL.md
|
|
||||||
│ └── ...
|
|
||||||
└── README.md (optional)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Skill Format
|
|
||||||
|
|
||||||
Each skill is defined by a `SKILL.md` file with YAML frontmatter:
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
---
|
|
||||||
name: skillname
|
|
||||||
description: A brief description of what this skill does
|
|
||||||
---
|
|
||||||
|
|
||||||
# Skill Content
|
|
||||||
|
|
||||||
The rest of the file contains instructions, examples, and context
|
|
||||||
that will be provided to the AI when this skill is invoked.
|
|
||||||
|
|
||||||
This can include:
|
|
||||||
- Step-by-step workflows
|
|
||||||
- Code examples
|
|
||||||
- Best practices
|
|
||||||
- Domain-specific knowledge
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Required Frontmatter Fields
|
|
||||||
|
|
||||||
- **`name`**: Skill identifier (must be lowercase alphanumeric with hyphens, e.g., `myskill`, `skill-123`, `condition-based-waiting`)
|
|
||||||
- **`description`**: Human-readable description of what the skill does
|
|
||||||
|
|
||||||
#### Skill Name Validation
|
|
||||||
|
|
||||||
Skill names must:
|
|
||||||
- Contain only lowercase letters (a-z), numbers (0-9), and hyphens (-)
|
|
||||||
- No spaces, underscores, uppercase letters, or other special characters
|
|
||||||
- Examples: ✅ `myskill`, `skill-123`, `condition-based-waiting` | ❌ `My-Skill`, `skill_name`, `SKILL`
|
|
||||||
|
|
||||||
## How It Works
|
|
||||||
|
|
||||||
### For Users
|
|
||||||
|
|
||||||
1. **Add a Plugin**:
|
|
||||||
- Go to Settings > AI
|
|
||||||
- Scroll to the Plugins section
|
|
||||||
- Click "Add Plugin"
|
|
||||||
- Enter the Git URL (e.g., `https://github.com/user/shakespeare-skills.git`)
|
|
||||||
- Click "Add Plugin"
|
|
||||||
|
|
||||||
2. **View Skills**:
|
|
||||||
- Installed plugins show the number of skills they contain
|
|
||||||
- Expand a plugin to see all its skills with descriptions
|
|
||||||
|
|
||||||
3. **Sync a Plugin**:
|
|
||||||
- Click the "Sync" button next to a plugin to pull latest changes
|
|
||||||
- Useful when the plugin repository is updated with new skills
|
|
||||||
|
|
||||||
4. **Delete a Plugin**:
|
|
||||||
- Click the "Delete" button next to a plugin to remove it
|
|
||||||
- All skills from that plugin will no longer be available
|
|
||||||
|
|
||||||
### For the AI
|
|
||||||
|
|
||||||
The AI assistant automatically:
|
|
||||||
|
|
||||||
1. **Discovers Skills**: All skills from installed plugins are scanned on startup
|
|
||||||
2. **Includes in System Prompt**: Skills are listed in the system prompt with their names, descriptions, and paths
|
|
||||||
3. **Enforces Usage**: The system prompt instructs the AI to use skills whenever applicable
|
|
||||||
4. **Accesses via Tool**: The AI calls the `skill` tool with a skill name to load its content
|
|
||||||
|
|
||||||
Example AI workflow:
|
|
||||||
```
|
|
||||||
User: "Help me build a Nostr marketplace"
|
|
||||||
|
|
||||||
AI: [Sees "nostrmarket" skill in system prompt]
|
|
||||||
[Calls skill tool with name="nostrmarket"]
|
|
||||||
[Receives SKILL.md content with marketplace implementation guide]
|
|
||||||
[Follows the skill's instructions to build the marketplace]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Technical Implementation
|
|
||||||
|
|
||||||
### Key Files
|
|
||||||
|
|
||||||
- **`src/lib/plugins.ts`**: Core plugin and skill management functions
|
|
||||||
- **`src/lib/tools/SkillTool.ts`**: AI tool for loading skill content
|
|
||||||
- **`src/hooks/usePlugins.ts`**: React hook for plugin CRUD operations
|
|
||||||
- **`src/components/PluginsSection.tsx`**: UI component for managing plugins
|
|
||||||
- **`src/lib/system.ts`**: Updated to include skills in system prompt
|
|
||||||
|
|
||||||
### API
|
|
||||||
|
|
||||||
#### `getPlugins(fs, pluginsPath)`
|
|
||||||
Returns array of plugin names (directory basenames).
|
|
||||||
|
|
||||||
#### `getAllSkills(fs, pluginsPath)`
|
|
||||||
Returns array of all skills from all plugins.
|
|
||||||
|
|
||||||
#### `findSkill(fs, pluginsPath, skillName)`
|
|
||||||
Finds a skill by name across all plugins.
|
|
||||||
|
|
||||||
#### `readSkillContent(fs, skill)`
|
|
||||||
Reads the SKILL.md content for a skill.
|
|
||||||
|
|
||||||
#### `deletePlugin(fs, pluginsPath, pluginName)`
|
|
||||||
Recursively deletes a plugin directory.
|
|
||||||
|
|
||||||
### Skill Tool
|
|
||||||
|
|
||||||
The `SkillTool` is exposed to the AI as the `skill` function:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
{
|
|
||||||
name: "skill",
|
|
||||||
description: "Load and execute a skill from the configured plugins",
|
|
||||||
parameters: {
|
|
||||||
name: "The name of the skill to execute"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
When called, it:
|
|
||||||
1. Searches all plugins for a skill with the matching name
|
|
||||||
2. Returns the full SKILL.md content
|
|
||||||
3. Includes metadata (plugin name, description, path)
|
|
||||||
|
|
||||||
### Storage
|
|
||||||
|
|
||||||
Plugins are stored in the configured plugins directory:
|
|
||||||
|
|
||||||
- **Browser**: `/plugins` (IndexedDB via LightningFS)
|
|
||||||
|
|
||||||
## System Prompt Integration
|
|
||||||
|
|
||||||
The system prompt now includes a **Skills** section that:
|
|
||||||
|
|
||||||
1. Lists all available skills with their names, descriptions, plugins, and paths
|
|
||||||
2. Instructs the AI to use skills whenever applicable
|
|
||||||
3. Provides the Settings > AI URL for users to configure skills
|
|
||||||
4. Includes this section even when no skills are configured (to inform users about the feature)
|
|
||||||
|
|
||||||
Example system prompt section:
|
|
||||||
|
|
||||||
```
|
|
||||||
## Skills
|
|
||||||
|
|
||||||
You have access to the following skills. **Skills MUST be used whenever applicable** by calling the `skill` tool with the skill name.
|
|
||||||
|
|
||||||
Available skills:
|
|
||||||
|
|
||||||
- **nostrmarket**: Build a Nostr marketplace application
|
|
||||||
- Plugin: nostr-skills
|
|
||||||
- Path: /plugins/nostr-skills/skills/nostrmarket
|
|
||||||
|
|
||||||
**Important**: When a task matches a skill's description, you MUST use that skill by calling the skill tool. Skills contain specialized workflows and best practices for specific tasks.
|
|
||||||
|
|
||||||
Users can configure skills in Settings > AI (https://shakespeare.diy/settings/ai) by adding plugins that contain skills.
|
|
||||||
```
|
|
||||||
|
|
||||||
## Creating Your Own Plugin
|
|
||||||
|
|
||||||
1. **Create a Git repository** with the plugin structure
|
|
||||||
2. **Add skills** in the `skills/` directory
|
|
||||||
3. **Write SKILL.md files** with frontmatter and content
|
|
||||||
4. **Push to GitHub/GitLab** or any Git hosting service
|
|
||||||
5. **Share the Git URL** with others to install your plugin
|
|
||||||
|
|
||||||
### Example Plugin Repository
|
|
||||||
|
|
||||||
```
|
|
||||||
my-shakespeare-skills/
|
|
||||||
├── README.md
|
|
||||||
└── skills/
|
|
||||||
├── webdesign/
|
|
||||||
│ └── SKILL.md
|
|
||||||
└── database/
|
|
||||||
└── SKILL.md
|
|
||||||
```
|
|
||||||
|
|
||||||
**skills/webdesign/SKILL.md**:
|
|
||||||
```markdown
|
|
||||||
---
|
|
||||||
name: webdesign
|
|
||||||
description: Create beautiful, modern web designs with best practices
|
|
||||||
---
|
|
||||||
|
|
||||||
# Web Design Skill
|
|
||||||
|
|
||||||
When designing web interfaces, follow these principles:
|
|
||||||
|
|
||||||
1. **Use a consistent color palette** (3-5 colors + neutrals)
|
|
||||||
2. **Implement proper spacing** (8px grid system)
|
|
||||||
3. **Choose readable fonts** (18px+ for body text)
|
|
||||||
4. **Ensure accessibility** (WCAG 2.1 AA compliance)
|
|
||||||
|
|
||||||
[... detailed instructions ...]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
### Plugins Directory Path
|
|
||||||
|
|
||||||
Configure in **Settings > System > Filesystem Paths**:
|
|
||||||
|
|
||||||
- Default: `/plugins`
|
|
||||||
- Custom: Any absolute path
|
|
||||||
|
|
||||||
Changes take effect immediately.
|
|
||||||
|
|
||||||
## Limitations
|
|
||||||
|
|
||||||
- Plugins must be Git repositories (no ZIP uploads)
|
|
||||||
- Skills must be in `skills/` subdirectory
|
|
||||||
- Skill names must be alphanumeric lowercase only
|
|
||||||
- Each skill must have a `SKILL.md` file with required frontmatter
|
|
||||||
- No automatic skill updates (users must manually sync)
|
|
||||||
|
|
||||||
## Future Enhancements
|
|
||||||
|
|
||||||
Potential future features:
|
|
||||||
|
|
||||||
- Plugin marketplace/registry
|
|
||||||
- Automatic skill updates
|
|
||||||
- Skill versioning
|
|
||||||
- Skill dependencies
|
|
||||||
- Plugin configuration files
|
|
||||||
- Skill categories/tags
|
|
||||||
- Skill search functionality
|
|
||||||
- Plugin publishing workflow
|
|
||||||
@@ -8,7 +8,7 @@ import htmlParser from "@html-eslint/parser";
|
|||||||
import customRules from "./eslint-rules/index.js";
|
import customRules from "./eslint-rules/index.js";
|
||||||
|
|
||||||
export default tseslint.config(
|
export default tseslint.config(
|
||||||
{ ignores: ["dist", "android"] },
|
{ ignores: ["dist"] },
|
||||||
{
|
{
|
||||||
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
||||||
files: ["**/*.{ts,tsx}"],
|
files: ["**/*.{ts,tsx}"],
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<meta property="og:title" content="Shakespeare - Open Source AI Builder">
|
<meta property="og:title" content="Shakespeare - Open Source AI Builder">
|
||||||
<meta property="og:description" content="Build custom apps with AI assistance using Shakespeare, an open-source development environment">
|
<meta property="og:description" content="Build custom apps with AI assistance using Shakespeare, an open-source development environment">
|
||||||
<meta property="og:image" content="https://shakespeare.diy/og-image.png">
|
<meta property="og:image" content="https://shakespeare.diy/og-image.png">
|
||||||
<meta http-equiv="content-security-policy" content="default-src 'none'; script-src 'self' 'unsafe-eval' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; frame-src 'self' https:; font-src 'self'; worker-src 'self' blob:; base-uri 'self'; manifest-src 'self'; connect-src 'self' blob: https: http: wss: ws:; img-src 'self' data: blob: https:; media-src 'self' https:">
|
<meta http-equiv="content-security-policy" content="default-src 'none'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; frame-src 'self' https:; font-src 'self'; base-uri 'self'; manifest-src 'self'; connect-src 'self' blob: https: http: wss: ws:; img-src 'self' data: blob: https:; media-src 'self' https:">
|
||||||
<link rel="icon" type="image/png" href="/shakespeare-192x192.png">
|
<link rel="icon" type="image/png" href="/shakespeare-192x192.png">
|
||||||
<link rel="apple-touch-icon" href="/shakespeare-192x192.png" sizes="192x192">
|
<link rel="apple-touch-icon" href="/shakespeare-192x192.png" sizes="192x192">
|
||||||
<meta name="theme-color" content="#2b0037">
|
<meta name="theme-color" content="#2b0037">
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://opencode.ai/config.json",
|
|
||||||
"mcp": {
|
|
||||||
"nostr": {
|
|
||||||
"type": "local",
|
|
||||||
"command": ["npx", "-y", "@nostrbook/mcp@latest"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "shakespeare.diy",
|
"name": "mkstack",
|
||||||
"description": "Build custom apps with AI assistance using Shakespeare, an open-source development environment",
|
"private": true,
|
||||||
"homepage": "https://shakespeare.diy",
|
"version": "0.0.0",
|
||||||
"license": "AGPL-3.0-or-later",
|
|
||||||
"version": "9.11.3",
|
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"author": {
|
|
||||||
"name": "shakespeare.diy",
|
|
||||||
"email": "[email protected]"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://gitlab.com/soapbox-pub/shakespeare.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"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",
|
"deploy": "npm run build && npx -y nostr-deploy-cli deploy --skip-setup"
|
||||||
"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",
|
|
||||||
"@mozilla/readability": "^0.6.0",
|
"@mozilla/readability": "^0.6.0",
|
||||||
"@nostrify/nostrify": "^0.51.1",
|
"@nostrify/nostrify": "npm:@jsr/nostrify__nostrify@^0.46.5",
|
||||||
"@nostrify/react": "^0.4.1",
|
"@nostrify/react": "npm:@jsr/nostrify__react@^0.2.9",
|
||||||
"@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",
|
||||||
@@ -65,11 +48,12 @@
|
|||||||
"@radix-ui/react-toggle": "^1.1.0",
|
"@radix-ui/react-toggle": "^1.1.0",
|
||||||
"@radix-ui/react-toggle-group": "^1.1.0",
|
"@radix-ui/react-toggle-group": "^1.1.0",
|
||||||
"@radix-ui/react-tooltip": "^1.1.4",
|
"@radix-ui/react-tooltip": "^1.1.4",
|
||||||
"@sentry/react": "^10.22.0",
|
|
||||||
"@std/encoding": "npm:@jsr/std__encoding@^1.0.10",
|
"@std/encoding": "npm:@jsr/std__encoding@^1.0.10",
|
||||||
"@tanstack/react-query": "^5.56.2",
|
"@tanstack/react-query": "^5.56.2",
|
||||||
"@unhead/addons": "^2.0.10",
|
"@unhead/addons": "^2.0.10",
|
||||||
"@unhead/react": "^2.0.10",
|
"@unhead/react": "^2.0.10",
|
||||||
|
"@webpm/store": "file:../webpm/packages/store",
|
||||||
|
"@webpm/webpm": "file:../webpm/packages/webpm",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
@@ -77,26 +61,24 @@
|
|||||||
"decimal.js": "^10.6.0",
|
"decimal.js": "^10.6.0",
|
||||||
"embla-carousel-react": "^8.3.0",
|
"embla-carousel-react": "^8.3.0",
|
||||||
"esbuild-wasm": "^0.25.8",
|
"esbuild-wasm": "^0.25.8",
|
||||||
"gray-matter": "^4.0.3",
|
"fflate": "^0.8.2",
|
||||||
"i18next": "^25.5.2",
|
"i18next": "^25.5.2",
|
||||||
"ignore": "^7.0.5",
|
"ignore": "^7.0.5",
|
||||||
"input-otp": "^1.2.4",
|
"input-otp": "^1.2.4",
|
||||||
"isomorphic-git": "^1.32.1",
|
"isomorphic-git": "^1.32.1",
|
||||||
"jsonc-parser": "^3.3.1",
|
"jsonc-parser": "^3.3.1",
|
||||||
"jszip": "^3.10.1",
|
"jszip": "^3.10.1",
|
||||||
"lucide-react": "^0.562.0",
|
"lucide-react": "^0.525.0",
|
||||||
"mime": "^4.1.0",
|
"mime": "^4.1.0",
|
||||||
"nostr-tools": "^2.15.2",
|
"nostr-tools": "^2.15.2",
|
||||||
"nunjucks": "^3.2.4",
|
"openai": "^5.15.0",
|
||||||
"openai": "^6.16.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",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"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-hook-form": "^7.53.0",
|
||||||
"react-hook-form": "^7.71.1",
|
|
||||||
"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",
|
||||||
@@ -107,17 +89,16 @@
|
|||||||
"tailwind-merge": "^2.5.2",
|
"tailwind-merge": "^2.5.2",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"tailwindcss-safe-area": "^0.8.0",
|
"tailwindcss-safe-area": "^0.8.0",
|
||||||
|
"tar-stream": "^3.1.7",
|
||||||
"turndown": "^7.2.1",
|
"turndown": "^7.2.1",
|
||||||
"uri-templates": "^0.2.0",
|
"uri-templates": "^0.2.0",
|
||||||
"use-stick-to-bottom": "^1.1.1",
|
"use-stick-to-bottom": "^1.1.1",
|
||||||
"vaul": "^0.9.3",
|
"vaul": "^0.9.3",
|
||||||
|
"vite-plugin-node-polyfills": "^0.24.0",
|
||||||
"webln": "^0.3.2",
|
"webln": "^0.3.2",
|
||||||
"workbox-window": "^7.3.0",
|
"zod": "^3.25.76"
|
||||||
"zod": "^4.3.6"
|
|
||||||
},
|
},
|
||||||
"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",
|
||||||
@@ -125,10 +106,8 @@
|
|||||||
"@testing-library/jest-dom": "^6.6.3",
|
"@testing-library/jest-dom": "^6.6.3",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/react": "^16.3.0",
|
||||||
"@testing-library/user-event": "^14.6.1",
|
"@testing-library/user-event": "^14.6.1",
|
||||||
"@types/jsdom": "^27.0.0",
|
|
||||||
"@types/jszip": "^3.4.0",
|
"@types/jszip": "^3.4.0",
|
||||||
"@types/node": "^22.5.5",
|
"@types/node": "^22.5.5",
|
||||||
"@types/nunjucks": "^3.2.6",
|
|
||||||
"@types/path-browserify": "^1.0.3",
|
"@types/path-browserify": "^1.0.3",
|
||||||
"@types/prismjs": "^1.26.5",
|
"@types/prismjs": "^1.26.5",
|
||||||
"@types/qrcode": "^1.5.5",
|
"@types/qrcode": "^1.5.5",
|
||||||
@@ -148,7 +127,6 @@
|
|||||||
"typescript": "^5.5.3",
|
"typescript": "^5.5.3",
|
||||||
"typescript-eslint": "^8.0.1",
|
"typescript-eslint": "^8.0.1",
|
||||||
"vite": "^6.3.5",
|
"vite": "^6.3.5",
|
||||||
"vite-plugin-pwa": "^1.1.0",
|
|
||||||
"vitest": "^3.1.4"
|
"vitest": "^3.1.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
## [9.11.3] - 2026-04-12
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- App publish dialog now appears on mobile devices
|
|
||||||
- Changelog available offline via ServiceWorker precache
|
|
||||||
|
|
||||||
## [9.11.2] - 2026-04-06
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Derive private preview subdomains with HMAC to prevent cross-project origin collisions on iframe.diy
|
|
||||||
|
|
||||||
## [9.11.1] - 2026-04-05
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
- Switch preview pane to iframe.diy for improved reliability and compatibility
|
|
||||||
- New users start with OpenCode Zen pre-configured for a zero-setup first experience
|
|
||||||
- Default nsite gateway changed to shakespeare.to with vanity subdomain support
|
|
||||||
- Update default Blossom servers and relay lists across deployments and uploads
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Default settings no longer override existing users' recently used models
|
|
||||||
- Showcase card clone URLs now use proper Nostr URI encoding
|
|
||||||
- Service worker no longer blocks SvelteKit nsite routes
|
|
||||||
|
|
||||||
## [9.11.0] - 2026-04-03
|
|
||||||
|
|
||||||
### Added
|
|
||||||
- Upload a banner image for your app directly from the App dialog
|
|
||||||
- T-tag editor in the App dialog Advanced section for tagging your app by category
|
|
||||||
- Delete App button in the App dialog Advanced section when editing an existing app
|
|
||||||
- Ngit repo and nsite deployment address fields in the App dialog Advanced section
|
|
||||||
- Auto-fill app name, description, and images from your project's OG tags and web manifest on first publish
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
- Redesigned App dialog with an overlapping banner and avatar card layout
|
|
||||||
- Reorganized App dialog Advanced section into General, Handlers, and Tags tabs
|
|
||||||
- Showcase cards now show banner and icon images, and require both to appear in the showcase
|
|
||||||
- Validation summary above the Save button replaces per-field "Required" labels
|
|
||||||
- Updated showcase curator to the Shakespeare Builders community list
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Upgrade Nostrify to fix bunker connection issues
|
|
||||||
|
|
||||||
## [9.10.4] - 2026-04-02
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Fix Android splash screen showing logo masked to white silhouette instead of full color
|
|
||||||
|
|
||||||
## [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,2 +1 @@
|
|||||||
/assets/* /assets/:splat 200
|
/* /index.html 200
|
||||||
/* /index.html 200
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// Shakespeare Service Worker
|
||||||
|
// Simple passthrough fetch handler
|
||||||
|
|
||||||
|
self.addEventListener('install', (event) => {
|
||||||
|
console.log('[ServiceWorker] Install');
|
||||||
|
self.skipWaiting();
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('activate', (event) => {
|
||||||
|
console.log('[ServiceWorker] Activate');
|
||||||
|
event.waitUntil(self.clients.claim());
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('fetch', (event) => {
|
||||||
|
// Passthrough: just fetch the request normally
|
||||||
|
});
|
||||||
@@ -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)"
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
/**
|
|
||||||
* Favicon Proxy Service
|
|
||||||
*
|
|
||||||
* Proxies favicon requests to DuckDuckGo's favicon service.
|
|
||||||
* This allows fetching favicons for any domain without CORS issues.
|
|
||||||
*
|
|
||||||
* Usage: GET /favicon?url=https://example.com
|
|
||||||
* Returns: The favicon image for the specified domain
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default {
|
|
||||||
async fetch(request: Request): Promise<Response> {
|
|
||||||
const requestUrl = new URL(request.url);
|
|
||||||
const targetUrl = requestUrl.searchParams.get('url');
|
|
||||||
|
|
||||||
if (!targetUrl) {
|
|
||||||
return new Response('Missing url parameter', { status: 400 });
|
|
||||||
}
|
|
||||||
|
|
||||||
let url: URL;
|
|
||||||
try {
|
|
||||||
url = new URL(targetUrl);
|
|
||||||
} catch {
|
|
||||||
return new Response('Invalid url parameter', { status: 400 });
|
|
||||||
}
|
|
||||||
|
|
||||||
let hostname = url.hostname;
|
|
||||||
|
|
||||||
// Strip `ai.` and `api.` subdomains for a better chance at finding a favicon
|
|
||||||
hostname = hostname.replace(/^(ai\.|api\.)/, '');
|
|
||||||
|
|
||||||
// GitHub hack: neutral color for light/dark mode
|
|
||||||
if (hostname === 'github.com') {
|
|
||||||
const svg = await (await fetch('https://github.githubassets.com/favicons/favicon.svg')).text();
|
|
||||||
return new Response(svg.replaceAll('#24292E', '#808080'), {
|
|
||||||
headers: { 'Content-Type': 'image/svg+xml' },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// AI-provider-specific hacks
|
|
||||||
if (url.host === 'localhost:11434' || url.origin === '127.0.0.1:11434') {
|
|
||||||
hostname = 'ollama.com';
|
|
||||||
} else if (url.host === 'localhost:45554' || url.origin === '127.0.0.1:45554') {
|
|
||||||
hostname = 'claude.ai';
|
|
||||||
} else if (url.host === 'generativelanguage.googleapis.com') {
|
|
||||||
hostname = 'gemini.google.com';
|
|
||||||
} else if (url.host === 'z.ai') {
|
|
||||||
hostname = 'docs.z.ai';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deployment-provider-specific hacks
|
|
||||||
if (url.host === 'backboard.railway.com') {
|
|
||||||
hostname = 'railway.com';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch the favicon from DuckDuckGo's service
|
|
||||||
return fetch(`https://external-content.duckduckgo.com/ip3/${hostname}.ico`);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -160,6 +160,16 @@ consistent handling of both text and binary data across the messaging protocol.
|
|||||||
**Parameters:** None
|
**Parameters:** None
|
||||||
**Result:** None (notification only)
|
**Result:** None (notification only)
|
||||||
|
|
||||||
|
#### `goBack`
|
||||||
|
**Purpose:** Navigate back in the iframe's history
|
||||||
|
**Parameters:** None
|
||||||
|
**Result:** None (notification only)
|
||||||
|
|
||||||
|
#### `goForward`
|
||||||
|
**Purpose:** Navigate forward in the iframe's history
|
||||||
|
**Parameters:** None
|
||||||
|
**Result:** None (notification only)
|
||||||
|
|
||||||
#### `updateNavigationState`
|
#### `updateNavigationState`
|
||||||
**Purpose:** Update parent about iframe's current navigation state
|
**Purpose:** Update parent about iframe's current navigation state
|
||||||
**Parameters:**
|
**Parameters:**
|
||||||
|
|||||||
@@ -193,6 +193,12 @@ class NavigationHandler {
|
|||||||
case "refresh":
|
case "refresh":
|
||||||
this.handleRefresh();
|
this.handleRefresh();
|
||||||
break;
|
break;
|
||||||
|
case "goBack":
|
||||||
|
this.handleGoBack();
|
||||||
|
break;
|
||||||
|
case "goForward":
|
||||||
|
this.handleGoForward();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -280,6 +286,14 @@ class NavigationHandler {
|
|||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleGoBack() {
|
||||||
|
window.history.back();
|
||||||
|
}
|
||||||
|
|
||||||
|
handleGoForward() {
|
||||||
|
window.history.forward();
|
||||||
|
}
|
||||||
|
|
||||||
updateNavigationState() {
|
updateNavigationState() {
|
||||||
// Use tracked semantic path, fallback to current location if needed
|
// Use tracked semantic path, fallback to current location if needed
|
||||||
const semanticPath = this.currentSemanticPath || this.extractSemanticPath(window.location);
|
const semanticPath = this.currentSemanticPath || this.extractSemanticPath(window.location);
|
||||||
|
|||||||
@@ -138,10 +138,18 @@ self.addEventListener("fetch", (event) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let iframe client system files and common assets be handled normally
|
// Let iframe client system files be handled normally
|
||||||
|
if (url.pathname.startsWith("/_") || url.pathname === "/sw.js") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let root path be handled normally (loads the iframe client page)
|
||||||
|
if (url.pathname === "/") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let iframe client assets be handled normally (anything in _iframe-client directory and common assets)
|
||||||
if (url.pathname.startsWith("/_iframe-client/") ||
|
if (url.pathname.startsWith("/_iframe-client/") ||
|
||||||
url.pathname === "/sw.js" ||
|
|
||||||
url.pathname === "/" ||
|
|
||||||
url.pathname === "/favicon.ico" ||
|
url.pathname === "/favicon.ico" ||
|
||||||
url.pathname === "/manifest.webmanifest") {
|
url.pathname === "/manifest.webmanifest") {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -12,17 +12,16 @@ export default {
|
|||||||
return new Response(null, {
|
return new Response(null, {
|
||||||
status: 200,
|
status: 200,
|
||||||
headers: {
|
headers: {
|
||||||
"access-control-allow-origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
"access-control-allow-methods": "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS",
|
"Access-Control-Allow-Methods": "GET,HEAD,POST,OPTIONS",
|
||||||
"access-control-allow-headers": "*", // Or specify specific headers
|
"Access-Control-Allow-Headers": "*", // Or specify specific headers
|
||||||
"access-control-max-age": "86400", // Cache preflight for 24 hours
|
"Access-Control-Max-Age": "86400", // Cache preflight for 24 hours
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const headers = new Headers(request.headers);
|
const headers = new Headers(request.headers);
|
||||||
headers.set('user-agent', 'Shakespeare Proxy <https://proxy.shakespeare.diy/>');
|
headers.set('User-Agent', 'Shakespeare Proxy <https://proxy.shakespeare.diy/>');
|
||||||
headers.delete('origin');
|
|
||||||
|
|
||||||
const targetResponse = await fetch(target, {
|
const targetResponse = await fetch(target, {
|
||||||
method: request.method,
|
method: request.method,
|
||||||
@@ -32,9 +31,9 @@ export default {
|
|||||||
|
|
||||||
const response = new Response(targetResponse.body, targetResponse);
|
const response = new Response(targetResponse.body, targetResponse);
|
||||||
|
|
||||||
response.headers.set("access-control-allow-origin", "*");
|
response.headers.set("Access-Control-Allow-Origin", "*");
|
||||||
response.headers.set("access-control-allow-methods", "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS");
|
response.headers.set("Access-Control-Allow-Methods", "GET,HEAD,POST,OPTIONS");
|
||||||
response.headers.set("access-control-allow-headers", "*");
|
response.headers.set("Access-Control-Allow-Headers", "*");
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
})
|
||||||
@@ -7,29 +7,20 @@ import { InferSeoMetaPlugin } from '@unhead/addons';
|
|||||||
import { Suspense, useEffect } from 'react';
|
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 { 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 { 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';
|
||||||
import { SessionManagerProvider } from '@/components/SessionManagerProvider';
|
import { SessionManagerProvider } from '@/components/SessionManagerProvider';
|
||||||
import { FSProvider } from '@/components/FSProvider';
|
import { FSProvider } from '@/components/FSProvider';
|
||||||
import { ConsoleErrorProvider } from '@/components/ConsoleErrorProvider';
|
import { ConsoleErrorProvider } from '@/components/ConsoleErrorProvider';
|
||||||
import { GitSyncProvider } from '@/components/GitSyncProvider';
|
|
||||||
import { LightningFSAdapter } from '@/lib/LightningFSAdapter';
|
import { LightningFSAdapter } from '@/lib/LightningFSAdapter';
|
||||||
import { cleanupTmpDirectory } from '@/lib/tmpCleanup';
|
import { cleanupTmpDirectory } from '@/lib/tmpCleanup';
|
||||||
import { DynamicFavicon } from '@/components/DynamicFavicon';
|
import { DynamicFavicon } from '@/components/DynamicFavicon';
|
||||||
import { OfflineIndicator } from '@/components/OfflineIndicator';
|
|
||||||
import { PWAUpdatePrompt } from '@/components/PWAUpdatePrompt';
|
|
||||||
import { ErrorBoundary } from '@/components/ErrorBoundary';
|
|
||||||
import { LockdownModeDetector } from '@/components/LockdownModeDetector';
|
|
||||||
|
|
||||||
|
|
||||||
import AppRouter from './AppRouter';
|
import AppRouter from './AppRouter';
|
||||||
|
|
||||||
@@ -51,126 +42,72 @@ const queryClient = new QueryClient({
|
|||||||
|
|
||||||
const defaultConfig: AppConfig = {
|
const defaultConfig: AppConfig = {
|
||||||
theme: "system",
|
theme: "system",
|
||||||
relayMetadata: {
|
relayUrl: "wss://relay.ditto.pub",
|
||||||
relays: [
|
projectTemplate: "https://gitlab.com/soapbox-pub/mkstack.git",
|
||||||
{ url: 'wss://relay.ditto.pub', read: true, write: true },
|
esmUrl: "https://esm.shakespeare.diy",
|
||||||
{ url: 'wss://relay.damus.io', read: true, write: true },
|
|
||||||
{ url: 'wss://relay.primal.net', read: true, write: true },
|
|
||||||
],
|
|
||||||
updatedAt: 0,
|
|
||||||
},
|
|
||||||
graspMetadata: {
|
|
||||||
relays: [
|
|
||||||
{ url: 'wss://git.shakespeare.diy/' },
|
|
||||||
{ url: 'wss://relay.ngit.dev/' },
|
|
||||||
],
|
|
||||||
updatedAt: 0,
|
|
||||||
},
|
|
||||||
templates: [
|
|
||||||
{
|
|
||||||
name: "MKStack",
|
|
||||||
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",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
esmUrl: "https://esm.sh",
|
|
||||||
corsProxy: "https://proxy.shakespeare.diy/?url={href}",
|
corsProxy: "https://proxy.shakespeare.diy/?url={href}",
|
||||||
gitProxyOrigins: ["https://github.com", "https://gitlab.com"],
|
faviconUrl: "https://external-content.duckduckgo.com/ip3/{hostname}.ico",
|
||||||
faviconUrl: "https://favicon.shakespeare.diy/?url={href}",
|
|
||||||
ngitWebUrl: "https://nostrhub.io/{naddr}",
|
|
||||||
previewDomain: "local-shakespeare.dev",
|
previewDomain: "local-shakespeare.dev",
|
||||||
showcaseEnabled: true,
|
showcaseEnabled: true,
|
||||||
showcaseCurator: "naddr1qvzqqqr4xqpzq7q6z5ns2hm5c8msyv83qwzxpxe52j8c4d4q5m92wsp9sflelkh9qqjrvdrxxajnqvny95mkyc33956xvwfk94sn2vek94sn2et9ve3kycfexfnryvty32j",
|
showcaseModerator: "npub1jvnpg4c6ljadf5t6ry0w9q0rnm4mksde87kglkrc993z46c39axsgq89sc",
|
||||||
fsPathProjects: "/projects",
|
ngitServers: ["git.shakespeare.diy", "relay.ngit.dev"],
|
||||||
fsPathConfig: "/config",
|
|
||||||
fsPathTmp: "/tmp",
|
|
||||||
fsPathPlugins: "/plugins",
|
|
||||||
fsPathTemplates: "/templates",
|
|
||||||
sentryDsn: import.meta.env.VITE_SENTRY_DSN || "",
|
|
||||||
sentryEnabled: true,
|
|
||||||
plausibleDomain: import.meta.env.VITE_PLAUSIBLE_DOMAIN || "",
|
|
||||||
plausibleEndpoint: import.meta.env.VITE_PLAUSIBLE_ENDPOINT || "",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialize filesystem adapter
|
const presetRelays = [
|
||||||
// Use LightningFS (IndexedDB-backed virtual filesystem)
|
{ url: 'wss://relay.ditto.pub', name: 'Ditto' },
|
||||||
const fs = new LightningFSAdapter(new LightningFS('shakespeare-fs').promises);
|
{ url: 'wss://relay.nostr.band', name: 'Nostr.Band' },
|
||||||
|
{ url: 'wss://relay.damus.io', name: 'Damus' },
|
||||||
|
{ url: 'wss://relay.primal.net', name: 'Primal' },
|
||||||
|
];
|
||||||
|
|
||||||
// Component to handle filesystem initialization and cleanup on startup
|
// Initialize LightningFS
|
||||||
// Ensures tmp directory exists and removes files older than 1 hour
|
const lightningFS = new LightningFS('shakespeare-fs');
|
||||||
|
const fs = new LightningFSAdapter(lightningFS.promises);
|
||||||
|
|
||||||
|
// Component to handle filesystem cleanup on startup
|
||||||
|
// Automatically removes files older than 1 hour from /tmp directory
|
||||||
function FSCleanupHandler() {
|
function FSCleanupHandler() {
|
||||||
const { config } = useAppContext();
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Ensure tmp directory exists before cleanup
|
// Run cleanup on application startup to remove stale temporary files
|
||||||
const initializeAndCleanup = async () => {
|
// This helps prevent the VFS from accumulating old files over time
|
||||||
try {
|
cleanupTmpDirectory(fs).catch(console.error);
|
||||||
// Create tmp directory if it doesn't exist
|
}, []);
|
||||||
try {
|
|
||||||
await fs.stat(config.fsPathTmp);
|
|
||||||
} catch {
|
|
||||||
// Directory doesn't exist, create it
|
|
||||||
await fs.mkdir(config.fsPathTmp);
|
|
||||||
console.log(`Created ${config.fsPathTmp} directory`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run cleanup to remove stale temporary files
|
|
||||||
// This helps prevent the VFS from accumulating old files over time
|
|
||||||
await cleanupTmpDirectory(fs, config.fsPathTmp);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(`Error during filesystem initialization:`, error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
initializeAndCleanup();
|
|
||||||
}, [config.fsPathTmp]);
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function App() {
|
export function App() {
|
||||||
return (
|
return (
|
||||||
<ErrorBoundary>
|
<UnheadProvider head={head}>
|
||||||
<UnheadProvider head={head}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<QueryClientProvider client={queryClient}>
|
<AppProvider storageKey="nostr:app-config" defaultConfig={defaultConfig} presetRelays={presetRelays}>
|
||||||
<AppProvider storageKey="nostr:app-config" defaultConfig={defaultConfig}>
|
<FSProvider fs={fs}>
|
||||||
<PlausibleProvider>
|
<FSCleanupHandler />
|
||||||
<SentryProvider>
|
<ConsoleErrorProvider>
|
||||||
<FSProvider fs={fs}>
|
<NostrLoginProvider storageKey='nostr:login'>
|
||||||
<ConsoleErrorProvider>
|
<NostrProvider>
|
||||||
<FSCleanupHandler />
|
<AISettingsProvider>
|
||||||
<NostrLoginProvider storageKey='nostr:login'>
|
<GitSettingsProvider>
|
||||||
<NostrProvider>
|
<DeploySettingsProvider>
|
||||||
<NostrSync />
|
<SessionManagerProvider>
|
||||||
<AISettingsProvider>
|
<TooltipProvider>
|
||||||
<GitSettingsProvider>
|
<Toaster />
|
||||||
<DeploySettingsProvider>
|
<DynamicFavicon />
|
||||||
<GitSyncProvider>
|
<Suspense>
|
||||||
<SessionManagerProvider>
|
<AppRouter />
|
||||||
<TooltipProvider>
|
</Suspense>
|
||||||
<DynamicFavicon />
|
</TooltipProvider>
|
||||||
<OfflineIndicator />
|
</SessionManagerProvider>
|
||||||
<PWAUpdatePrompt />
|
</DeploySettingsProvider>
|
||||||
<LockdownModeDetector />
|
</GitSettingsProvider>
|
||||||
<Suspense>
|
</AISettingsProvider>
|
||||||
<AppRouter />
|
</NostrProvider>
|
||||||
</Suspense>
|
</NostrLoginProvider>
|
||||||
</TooltipProvider>
|
</ConsoleErrorProvider>
|
||||||
</SessionManagerProvider>
|
</FSProvider>
|
||||||
</GitSyncProvider>
|
</AppProvider>
|
||||||
</DeploySettingsProvider>
|
</QueryClientProvider>
|
||||||
</GitSettingsProvider>
|
</UnheadProvider>
|
||||||
</AISettingsProvider>
|
|
||||||
</NostrProvider>
|
|
||||||
</NostrLoginProvider>
|
|
||||||
</ConsoleErrorProvider>
|
|
||||||
</FSProvider>
|
|
||||||
</SentryProvider>
|
|
||||||
</PlausibleProvider>
|
|
||||||
</AppProvider>
|
|
||||||
</QueryClientProvider>
|
|
||||||
</UnheadProvider>
|
|
||||||
</ErrorBoundary>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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";
|
||||||
@@ -20,29 +18,23 @@ import AboutSettings from "./pages/AboutSettings";
|
|||||||
import GitHubOAuth from "./pages/GitHubOAuth";
|
import GitHubOAuth from "./pages/GitHubOAuth";
|
||||||
import NetlifyOAuth from "./pages/NetlifyOAuth";
|
import NetlifyOAuth from "./pages/NetlifyOAuth";
|
||||||
import VercelOAuth from "./pages/VercelOAuth";
|
import VercelOAuth from "./pages/VercelOAuth";
|
||||||
import OpenRouterOAuth from "./pages/OpenRouterOAuth";
|
|
||||||
import { NIP19Page } from "./pages/NIP19Page";
|
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 />
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<Index />} />
|
<Route path="/" element={<Index />} />
|
||||||
<Route path="/giftcard" element={<Index />} />
|
|
||||||
<Route path="/clone" element={<Clone />} />
|
<Route path="/clone" element={<Clone />} />
|
||||||
<Route path="/oauth/github" element={<GitHubOAuth />} />
|
<Route path="/oauth/github" element={<GitHubOAuth />} />
|
||||||
<Route path="/oauth/netlify" element={<NetlifyOAuth />} />
|
<Route path="/oauth/netlify" element={<NetlifyOAuth />} />
|
||||||
<Route path="/oauth/vercel" element={<VercelOAuth />} />
|
<Route path="/oauth/vercel" element={<VercelOAuth />} />
|
||||||
<Route path="/oauth/openrouter" element={<OpenRouterOAuth />} />
|
|
||||||
<Route path="/settings" element={<SettingsLayout />}>
|
<Route path="/settings" element={<SettingsLayout />}>
|
||||||
<Route index element={<Settings />} />
|
<Route index element={<Settings />} />
|
||||||
<Route path="preferences" element={<Preferences />} />
|
<Route path="preferences" element={<Preferences />} />
|
||||||
@@ -54,7 +46,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,11 +1,9 @@
|
|||||||
import { memo, useState } from 'react';
|
import { memo, useState } from 'react';
|
||||||
import { Streamdown } from 'streamdown';
|
import { Streamdown } from 'streamdown';
|
||||||
import { Lightbulb, Loader2 } from 'lucide-react';
|
import { Wrench, Eye, FileText, Edit, Package, PackageMinus, GitCommit, BookOpen, Download, Hash, Tag, Network, List, Plus, Terminal, Globe, CheckCircle, Lightbulb, Loader2, Logs } from 'lucide-react';
|
||||||
import type { AIMessage } from '@/lib/SessionManager';
|
import type { AIMessage } from '@/lib/SessionManager';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { UserMessage } from '@/components/UserMessage';
|
import { UserMessage } from '@/components/UserMessage';
|
||||||
import { ImageLightbox } from '@/components/ImageLightbox';
|
|
||||||
import { ToolCallDisplay } from '@/components/ToolCallDisplay';
|
|
||||||
import OpenAI from 'openai';
|
import OpenAI from 'openai';
|
||||||
import { useTheme } from '@/hooks/useTheme';
|
import { useTheme } from '@/hooks/useTheme';
|
||||||
import { isEmptyMessage } from '@/lib/isEmptyMessage';
|
import { isEmptyMessage } from '@/lib/isEmptyMessage';
|
||||||
@@ -19,17 +17,15 @@ interface AIMessageItemProps {
|
|||||||
message: AIMessage;
|
message: AIMessage;
|
||||||
isCurrentlyLoading?: boolean;
|
isCurrentlyLoading?: boolean;
|
||||||
toolCall?: OpenAI.Chat.Completions.ChatCompletionMessageToolCall | undefined; // Tool call data passed from the assistant message
|
toolCall?: OpenAI.Chat.Completions.ChatCompletionMessageToolCall | undefined; // Tool call data passed from the assistant message
|
||||||
projectId: string; // Current project ID for path display
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AIMessageItem = memo(({
|
export const AIMessageItem = memo(({
|
||||||
message,
|
message,
|
||||||
isCurrentlyLoading = false,
|
isCurrentlyLoading = false,
|
||||||
toolCall,
|
toolCall,
|
||||||
projectId,
|
|
||||||
}: AIMessageItemProps) => {
|
}: AIMessageItemProps) => {
|
||||||
|
const [isToolExpanded, setIsToolExpanded] = useState(false);
|
||||||
const [isReasoningExpanded, setIsReasoningExpanded] = useState(false);
|
const [isReasoningExpanded, setIsReasoningExpanded] = useState(false);
|
||||||
const [expandedImageUrl, setExpandedImageUrl] = useState<string | null>(null);
|
|
||||||
const { displayTheme } = useTheme();
|
const { displayTheme } = useTheme();
|
||||||
|
|
||||||
// Get content to display
|
// Get content to display
|
||||||
@@ -51,11 +47,150 @@ export const AIMessageItem = memo(({
|
|||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Get tool info including icon and title
|
||||||
|
const getToolInfo = () => {
|
||||||
|
if (message.role === 'tool' && toolCall) {
|
||||||
|
if (toolCall.type === 'function') {
|
||||||
|
const toolName = toolCall.function.name;
|
||||||
|
let args;
|
||||||
|
|
||||||
|
try {
|
||||||
|
args = JSON.parse(toolCall.function.arguments);
|
||||||
|
} catch {
|
||||||
|
args = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate icons and titles based on tool name and arguments
|
||||||
|
switch (toolName) {
|
||||||
|
case 'shell':
|
||||||
|
return {
|
||||||
|
icon: Terminal,
|
||||||
|
title: args.command ? args.command : 'Shell Command'
|
||||||
|
};
|
||||||
|
case 'text_editor_view': {
|
||||||
|
const title = args.path
|
||||||
|
? (args.start_line || args.end_line
|
||||||
|
? `Viewed ${args.path} (lines ${args.start_line || 1}-${args.end_line || 'end'})`
|
||||||
|
: `Viewed ${args.path}`)
|
||||||
|
: 'Viewed File';
|
||||||
|
return { icon: Eye, title };
|
||||||
|
}
|
||||||
|
case 'text_editor_write':
|
||||||
|
return {
|
||||||
|
icon: FileText,
|
||||||
|
title: args.path ? `Wrote ${args.path}` : 'Wrote File'
|
||||||
|
};
|
||||||
|
case 'text_editor_str_replace':
|
||||||
|
return {
|
||||||
|
icon: Edit,
|
||||||
|
title: args.path ? `Edited ${args.path}` : 'Edited File'
|
||||||
|
};
|
||||||
|
case 'npm_add_package': {
|
||||||
|
const installTitle = args.name
|
||||||
|
? (args.dev ? `Installed ${args.name} (dev)` : `Installed ${args.name}`)
|
||||||
|
: 'Installed Package';
|
||||||
|
return { icon: Package, title: installTitle };
|
||||||
|
}
|
||||||
|
case 'npm_remove_package':
|
||||||
|
return {
|
||||||
|
icon: PackageMinus,
|
||||||
|
title: args.name ? `Removed ${args.name}` : 'Removed Package'
|
||||||
|
};
|
||||||
|
case 'git_commit':
|
||||||
|
return {
|
||||||
|
icon: GitCommit,
|
||||||
|
title: args.message ? `Committed: ${args.message}` : 'Committed Changes'
|
||||||
|
};
|
||||||
|
case 'build_project':
|
||||||
|
return {
|
||||||
|
icon: Package,
|
||||||
|
title: 'Built Project'
|
||||||
|
};
|
||||||
|
case 'nostr_read_nip':
|
||||||
|
return {
|
||||||
|
icon: BookOpen,
|
||||||
|
title: args.nip ? `Read NIP-${args.nip}` : 'Read NIP'
|
||||||
|
};
|
||||||
|
case 'nostr_fetch_event':
|
||||||
|
return {
|
||||||
|
icon: Download,
|
||||||
|
title: args.identifier ? `Fetched ${args.identifier.slice(0, 16)}...` : 'Fetched Event'
|
||||||
|
};
|
||||||
|
case 'nostr_read_kind':
|
||||||
|
return {
|
||||||
|
icon: Hash,
|
||||||
|
title: args.kind !== undefined ? `Read Kind ${args.kind}` : 'Read Kind'
|
||||||
|
};
|
||||||
|
case 'nostr_read_tag':
|
||||||
|
return {
|
||||||
|
icon: Tag,
|
||||||
|
title: args.tag ? `Read Tag "${args.tag}"` : 'Read Tag'
|
||||||
|
};
|
||||||
|
case 'nostr_read_protocol':
|
||||||
|
return {
|
||||||
|
icon: Network,
|
||||||
|
title: args.doc ? `Read Protocol: ${args.doc}` : 'Read Protocol'
|
||||||
|
};
|
||||||
|
case 'nostr_read_nips_index':
|
||||||
|
return {
|
||||||
|
icon: List,
|
||||||
|
title: 'Read NIPs Index'
|
||||||
|
};
|
||||||
|
case 'nostr_generate_kind':
|
||||||
|
return {
|
||||||
|
icon: Plus,
|
||||||
|
title: args.range ? `Generated ${args.range} kind` : 'Generated Kind'
|
||||||
|
};
|
||||||
|
case 'deploy_project':
|
||||||
|
return {
|
||||||
|
icon: Globe,
|
||||||
|
title: args.deployServer ? `Deployed to ${args.deployServer}` : 'Deployed Project'
|
||||||
|
};
|
||||||
|
case 'typecheck':
|
||||||
|
return {
|
||||||
|
icon: CheckCircle,
|
||||||
|
title: 'TypeScript'
|
||||||
|
};
|
||||||
|
case 'read_console_messages':
|
||||||
|
return {
|
||||||
|
icon: Logs,
|
||||||
|
title: 'Read Console'
|
||||||
|
};
|
||||||
|
default:
|
||||||
|
return {
|
||||||
|
icon: Wrench,
|
||||||
|
title: toolName.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback to extracting from content
|
||||||
|
if (message.role === 'tool') {
|
||||||
|
const content = getContent();
|
||||||
|
const lines = content.split('\n');
|
||||||
|
const firstLine = lines[0];
|
||||||
|
|
||||||
|
if (firstLine && firstLine.length < 100) {
|
||||||
|
return {
|
||||||
|
icon: Wrench,
|
||||||
|
title: firstLine.replace(/^(Error |Tool |Executing |Result: )/i, '').trim()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return { icon: Wrench, title: 'Tool Result' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return { icon: Wrench, title: 'Tool' };
|
||||||
|
};
|
||||||
|
|
||||||
// Special rendering for tool messages
|
// Special rendering for tool messages
|
||||||
if (message.role === 'tool') {
|
if (message.role === 'tool') {
|
||||||
const content = getContent();
|
const content = getContent();
|
||||||
|
const toolInfo = getToolInfo();
|
||||||
|
const IconComponent = toolInfo.icon;
|
||||||
|
|
||||||
// Get tool call arguments
|
// Get tool call arguments for special rendering
|
||||||
let toolArgs: Record<string, unknown> = {};
|
let toolArgs: Record<string, unknown> = {};
|
||||||
let toolName = '';
|
let toolName = '';
|
||||||
if (toolCall?.type === 'function') {
|
if (toolCall?.type === 'function') {
|
||||||
@@ -67,75 +202,101 @@ export const AIMessageItem = memo(({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Special rendering for tools
|
||||||
|
const renderSpecialContent = () => {
|
||||||
|
if (toolName === 'text_editor_write' && toolArgs.file_text) {
|
||||||
|
return (
|
||||||
|
<div className="mt-1 p-3 bg-muted/30 rounded border text-xs">
|
||||||
|
<div className="whitespace-pre-wrap break-words font-mono">
|
||||||
|
{toolArgs.file_text as string}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toolName === 'text_editor_str_replace' && toolArgs.old_str && toolArgs.new_str) {
|
||||||
|
const oldLines = (toolArgs.old_str as string).split('\n');
|
||||||
|
const newLines = (toolArgs.new_str as string).split('\n');
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="mt-1 p-3 bg-muted/30 rounded border text-xs font-mono">
|
||||||
|
<div className="space-y-1">
|
||||||
|
{/* Old content (removed) */}
|
||||||
|
<div className="space-y-0">
|
||||||
|
{oldLines.map((line, index) => (
|
||||||
|
<div key={`old-${index}`} className="flex">
|
||||||
|
<span className="text-red-500 select-none mr-2">-</span>
|
||||||
|
<span className="bg-red-50 dark:bg-red-950/30 text-red-700 dark:text-red-300 flex-1 whitespace-pre-wrap break-words">
|
||||||
|
{line}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* New content (added) */}
|
||||||
|
<div className="space-y-0">
|
||||||
|
{newLines.map((line, index) => (
|
||||||
|
<div key={`new-${index}`} className="flex">
|
||||||
|
<span className="text-green-500 select-none mr-2">+</span>
|
||||||
|
<span className="bg-green-50 dark:bg-green-950/30 text-green-700 dark:text-green-300 flex-1 whitespace-pre-wrap break-words">
|
||||||
|
{line}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default rendering for other tools
|
||||||
|
return (
|
||||||
|
<div className="mt-1 p-3 bg-muted/30 rounded border text-xs">
|
||||||
|
<div className="whitespace-pre-wrap break-words font-mono">
|
||||||
|
{content}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Regular tool message rendering
|
||||||
return (
|
return (
|
||||||
<ToolCallDisplay
|
<div className="-mt-2"> {/* -mt-2 to make it snug with the previous assistant message */}
|
||||||
toolName={toolName}
|
<button
|
||||||
toolArgs={toolArgs}
|
onClick={() => setIsToolExpanded(!isToolExpanded)}
|
||||||
state="completed"
|
className={cn(
|
||||||
result={content}
|
"w-full flex items-center gap-2 px-2 py-1 text-xs",
|
||||||
projectId={projectId}
|
"hover:bg-muted/30 rounded transition-colors duration-200"
|
||||||
/>
|
)}
|
||||||
|
>
|
||||||
|
<IconComponent className="h-3 w-3 text-muted-foreground flex-shrink-0" />
|
||||||
|
<span className="text-muted-foreground font-medium truncate flex-1 text-left">
|
||||||
|
{toolInfo.title}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{isToolExpanded && renderSpecialContent()}
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regular rendering for non-tool messages
|
// Regular rendering for non-tool messages
|
||||||
if (message.role === 'user') {
|
if (message.role === 'user') {
|
||||||
// User messages: right-aligned bubble without avatar/name
|
// User messages: right-aligned bubble without avatar/name
|
||||||
// Extract text and image parts from message content
|
const userContent = typeof message.content === 'string'
|
||||||
const contentArray = Array.isArray(message.content) ? message.content : null;
|
? message.content
|
||||||
|
: Array.isArray(message.content)
|
||||||
// Extract image URLs from content array
|
? message.content.filter(part => part.type === 'text') as OpenAI.Chat.Completions.ChatCompletionContentPartText[]
|
||||||
const imageUrls = contentArray
|
: '';
|
||||||
? contentArray
|
|
||||||
.filter(part => part.type === 'image_url')
|
|
||||||
.map(part => (part as OpenAI.Chat.Completions.ChatCompletionContentPartImage).image_url.url)
|
|
||||||
: [];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="flex justify-end py-6">
|
||||||
<div className="flex justify-end py-6">
|
<div className="max-w-[80%] bg-secondary rounded-2xl rounded-br-md px-4 py-3">
|
||||||
<div className="max-w-[80%] bg-secondary rounded-2xl rounded-br-md px-4 py-3">
|
<div className="text-sm break-words">
|
||||||
<div className="text-sm break-words space-y-2">
|
<UserMessage content={userContent} />
|
||||||
{/* Render text content and attachments first */}
|
|
||||||
<UserMessage content={message.content} />
|
|
||||||
{/* Render images after text and attachments */}
|
|
||||||
{imageUrls.length > 0 && (
|
|
||||||
<div className="space-y-2">
|
|
||||||
{imageUrls.map((url, index) => (
|
|
||||||
<div
|
|
||||||
key={index}
|
|
||||||
className="rounded-lg overflow-hidden border border-border cursor-pointer hover:opacity-90 transition-opacity"
|
|
||||||
onClick={() => setExpandedImageUrl(url)}
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src={url}
|
|
||||||
alt={`User uploaded image ${index + 1}`}
|
|
||||||
className="max-w-full h-auto max-h-96 object-contain"
|
|
||||||
loading="lazy"
|
|
||||||
onError={(e) => {
|
|
||||||
// Fallback if image fails to load
|
|
||||||
const target = e.target as HTMLImageElement;
|
|
||||||
target.style.display = 'none';
|
|
||||||
const fallback = document.createElement('div');
|
|
||||||
fallback.className = 'p-2 text-xs text-muted-foreground bg-muted rounded';
|
|
||||||
fallback.textContent = `Image failed to load: ${url}`;
|
|
||||||
target.parentElement?.appendChild(fallback);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{/* Image expansion lightbox */}
|
|
||||||
<ImageLightbox
|
|
||||||
imageUrl={expandedImageUrl}
|
|
||||||
onClose={() => setExpandedImageUrl(null)}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +310,7 @@ export const AIMessageItem = memo(({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Assistant messages: left-aligned without avatar/name
|
// Assistant messages: left-aligned without avatar/name
|
||||||
const assistantContent = (
|
return (
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<div className="text-sm space-y-3">
|
<div className="text-sm space-y-3">
|
||||||
@@ -207,18 +368,6 @@ export const AIMessageItem = memo(({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{assistantContent}
|
|
||||||
|
|
||||||
{/* Image expansion lightbox */}
|
|
||||||
<ImageLightbox
|
|
||||||
imageUrl={expandedImageUrl}
|
|
||||||
onClose={() => setExpandedImageUrl(null)}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AIMessageItem.displayName = 'AIMessageItem';
|
AIMessageItem.displayName = 'AIMessageItem';
|
||||||
@@ -36,27 +36,17 @@ describe('AISettingsProvider', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should initialize with OpenCode defaults for new users (no providers)', async () => {
|
it('should initialize with empty recentlyUsedModels array', async () => {
|
||||||
const { result } = renderHook(() => useAISettings(), {
|
const { result } = renderHook(() => useAISettings(), {
|
||||||
wrapper: ({ children }) => <TestApp>{children}</TestApp>,
|
wrapper: ({ children }) => <TestApp>{children}</TestApp>,
|
||||||
});
|
});
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
// New users with no providers get OPENCODE_DEFAULT_SETTINGS with big-pickle
|
expect(result.current.settings.recentlyUsedModels).toEqual([]);
|
||||||
expect(result.current.settings.providers).toHaveLength(1);
|
|
||||||
expect(result.current.settings.providers[0].id).toBe('opencode');
|
|
||||||
expect(result.current.settings.recentlyUsedModels).toEqual(['opencode/big-pickle']);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add recently used models correctly', async () => {
|
it('should add recently used models correctly', async () => {
|
||||||
// Simulate existing user with a provider configured
|
|
||||||
const { readAISettings } = await import('@/lib/configUtils');
|
|
||||||
vi.mocked(readAISettings).mockResolvedValue({
|
|
||||||
providers: [{ id: 'openrouter', name: 'OpenRouter', baseURL: 'https://openrouter.ai/api/v1', apiKey: 'test-key' }],
|
|
||||||
recentlyUsedModels: [],
|
|
||||||
});
|
|
||||||
|
|
||||||
const { result } = renderHook(() => useAISettings(), {
|
const { result } = renderHook(() => useAISettings(), {
|
||||||
wrapper: ({ children }) => <TestApp>{children}</TestApp>,
|
wrapper: ({ children }) => <TestApp>{children}</TestApp>,
|
||||||
});
|
});
|
||||||
@@ -75,13 +65,6 @@ describe('AISettingsProvider', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should move existing model to front when used again', async () => {
|
it('should move existing model to front when used again', async () => {
|
||||||
// Simulate existing user with a provider configured
|
|
||||||
const { readAISettings } = await import('@/lib/configUtils');
|
|
||||||
vi.mocked(readAISettings).mockResolvedValue({
|
|
||||||
providers: [{ id: 'openrouter', name: 'OpenRouter', baseURL: 'https://openrouter.ai/api/v1', apiKey: 'test-key' }],
|
|
||||||
recentlyUsedModels: [],
|
|
||||||
});
|
|
||||||
|
|
||||||
const { result } = renderHook(() => useAISettings(), {
|
const { result } = renderHook(() => useAISettings(), {
|
||||||
wrapper: ({ children }) => <TestApp>{children}</TestApp>,
|
wrapper: ({ children }) => <TestApp>{children}</TestApp>,
|
||||||
});
|
});
|
||||||
@@ -116,13 +99,6 @@ describe('AISettingsProvider', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should limit recently used models to 10 items', async () => {
|
it('should limit recently used models to 10 items', async () => {
|
||||||
// Simulate existing user with a provider configured
|
|
||||||
const { readAISettings } = await import('@/lib/configUtils');
|
|
||||||
vi.mocked(readAISettings).mockResolvedValue({
|
|
||||||
providers: [{ id: 'openrouter', name: 'OpenRouter', baseURL: 'https://openrouter.ai/api/v1', apiKey: 'test-key' }],
|
|
||||||
recentlyUsedModels: [],
|
|
||||||
});
|
|
||||||
|
|
||||||
const { result } = renderHook(() => useAISettings(), {
|
const { result } = renderHook(() => useAISettings(), {
|
||||||
wrapper: ({ children }) => <TestApp>{children}</TestApp>,
|
wrapper: ({ children }) => <TestApp>{children}</TestApp>,
|
||||||
});
|
});
|
||||||
@@ -149,7 +125,6 @@ describe('AISettingsProvider', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
id: 'openrouter',
|
id: 'openrouter',
|
||||||
name: 'OpenRouter',
|
|
||||||
baseURL: 'https://openrouter.ai/api/v1',
|
baseURL: 'https://openrouter.ai/api/v1',
|
||||||
apiKey: 'test-key'
|
apiKey: 'test-key'
|
||||||
}
|
}
|
||||||
@@ -171,13 +146,6 @@ describe('AISettingsProvider', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should invalidate provider-models query when updateSettings is called with providers', async () => {
|
it('should invalidate provider-models query when updateSettings is called with providers', async () => {
|
||||||
// Simulate existing user with a provider configured
|
|
||||||
const { readAISettings } = await import('@/lib/configUtils');
|
|
||||||
vi.mocked(readAISettings).mockResolvedValue({
|
|
||||||
providers: [{ id: 'openrouter', name: 'OpenRouter', baseURL: 'https://openrouter.ai/api/v1', apiKey: 'test-key' }],
|
|
||||||
recentlyUsedModels: [],
|
|
||||||
});
|
|
||||||
|
|
||||||
// Mock the QueryClient.invalidateQueries method
|
// Mock the QueryClient.invalidateQueries method
|
||||||
const mockInvalidateQueries = vi.fn();
|
const mockInvalidateQueries = vi.fn();
|
||||||
|
|
||||||
@@ -205,7 +173,6 @@ describe('AISettingsProvider', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
id: 'test-provider',
|
id: 'test-provider',
|
||||||
name: 'Test Provider',
|
|
||||||
baseURL: 'https://api.test.com/v1',
|
baseURL: 'https://api.test.com/v1',
|
||||||
apiKey: 'test-key'
|
apiKey: 'test-key'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,43 +1,40 @@
|
|||||||
import { useQueryClient } from '@tanstack/react-query';
|
import { useQueryClient } from '@tanstack/react-query';
|
||||||
import { ReactNode, useState, useEffect } from 'react';
|
import { ReactNode, useState, useEffect } from 'react';
|
||||||
import { AISettingsContext, type AISettings, type AIProvider, type MCPServer, type AISettingsContextType } from '@/contexts/AISettingsContext';
|
import { AISettingsContext, type AISettings, type AIProvider, type AISettingsContextType } from '@/contexts/AISettingsContext';
|
||||||
import { useFS } from '@/hooks/useFS';
|
import { useFS } from '@/hooks/useFS';
|
||||||
import { useFSPaths } from '@/hooks/useFSPaths';
|
|
||||||
import { readAISettings, writeAISettings } from '@/lib/configUtils';
|
import { readAISettings, writeAISettings } from '@/lib/configUtils';
|
||||||
import { EMPTY_AI_SETTINGS, OPENCODE_DEFAULT_SETTINGS } from '@/lib/opencode-defaults';
|
|
||||||
|
|
||||||
interface AISettingsProviderProps {
|
interface AISettingsProviderProps {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DEFAULT_SETTINGS: AISettings = {
|
||||||
|
providers: [],
|
||||||
|
recentlyUsedModels: [],
|
||||||
|
};
|
||||||
|
|
||||||
export function AISettingsProvider({ children }: AISettingsProviderProps) {
|
export function AISettingsProvider({ children }: AISettingsProviderProps) {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const { fs } = useFS();
|
const { fs } = useFS();
|
||||||
const { configPath } = useFSPaths();
|
const [settings, setSettings] = useState<AISettings>(DEFAULT_SETTINGS);
|
||||||
const [settings, setSettings] = useState<AISettings>(EMPTY_AI_SETTINGS);
|
|
||||||
const [isInitialized, setIsInitialized] = useState(false);
|
const [isInitialized, setIsInitialized] = useState(false);
|
||||||
|
|
||||||
// Initialize settings from VFS on mount
|
// Initialize settings from VFS on mount
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const initializeSettings = async () => {
|
const initializeSettings = async () => {
|
||||||
try {
|
try {
|
||||||
const loaded = await readAISettings(fs, configPath);
|
const settings = await readAISettings(fs);
|
||||||
// Only apply OpenCode defaults for genuinely new users (no providers configured)
|
setSettings(settings);
|
||||||
if (loaded.providers.length === 0) {
|
|
||||||
setSettings(OPENCODE_DEFAULT_SETTINGS);
|
|
||||||
} else {
|
|
||||||
setSettings(loaded);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to initialize AI settings:', error);
|
console.error('Failed to initialize AI settings:', error);
|
||||||
setSettings(EMPTY_AI_SETTINGS);
|
setSettings(DEFAULT_SETTINGS);
|
||||||
} finally {
|
} finally {
|
||||||
setIsInitialized(true);
|
setIsInitialized(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
initializeSettings();
|
initializeSettings();
|
||||||
}, [fs, configPath]);
|
}, [fs]);
|
||||||
|
|
||||||
// Save settings to VFS whenever they change (but not during initialization)
|
// Save settings to VFS whenever they change (but not during initialization)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -45,14 +42,14 @@ export function AISettingsProvider({ children }: AISettingsProviderProps) {
|
|||||||
|
|
||||||
const saveSettings = async () => {
|
const saveSettings = async () => {
|
||||||
try {
|
try {
|
||||||
await writeAISettings(fs, settings, configPath);
|
await writeAISettings(fs, settings);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to save AI settings:', error);
|
console.error('Failed to save AI settings:', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}, [fs, settings, isInitialized, configPath]);
|
}, [fs, settings, isInitialized]);
|
||||||
|
|
||||||
const updateSettings = (newSettings: Partial<AISettings>) => {
|
const updateSettings = (newSettings: Partial<AISettings>) => {
|
||||||
setSettings(prev => ({ ...prev, ...newSettings }));
|
setSettings(prev => ({ ...prev, ...newSettings }));
|
||||||
@@ -129,29 +126,7 @@ export function AISettingsProvider({ children }: AISettingsProviderProps) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const setMCPServer = (name: string, server: MCPServer) => {
|
|
||||||
setSettings(prev => ({
|
|
||||||
...prev,
|
|
||||||
mcpServers: {
|
|
||||||
...(prev.mcpServers || {}),
|
|
||||||
[name]: server,
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
};
|
|
||||||
|
|
||||||
const removeMCPServer = (name: string) => {
|
|
||||||
setSettings(prev => {
|
|
||||||
const newMCPServers = { ...(prev.mcpServers || {}) };
|
|
||||||
delete newMCPServers[name];
|
|
||||||
return {
|
|
||||||
...prev,
|
|
||||||
mcpServers: newMCPServers,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const isConfigured = settings.providers.length > 0;
|
const isConfigured = settings.providers.length > 0;
|
||||||
const isLoading = !isInitialized;
|
|
||||||
|
|
||||||
const contextValue: AISettingsContextType = {
|
const contextValue: AISettingsContextType = {
|
||||||
settings,
|
settings,
|
||||||
@@ -160,10 +135,7 @@ export function AISettingsProvider({ children }: AISettingsProviderProps) {
|
|||||||
removeProvider,
|
removeProvider,
|
||||||
setProviders,
|
setProviders,
|
||||||
addRecentlyUsedModel,
|
addRecentlyUsedModel,
|
||||||
setMCPServer,
|
|
||||||
removeMCPServer,
|
|
||||||
isConfigured,
|
isConfigured,
|
||||||
isLoading,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { Button } from '@/components/ui/button';
|
|||||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { useAICredits } from '@/hooks/useAICredits';
|
import { useAICredits } from '@/hooks/useAICredits';
|
||||||
import { AI_PROVIDER_PRESETS, type PresetProvider } from '@/lib/aiProviderPresets';
|
import { getShakespeareProvider } from '@/lib/aiProviderPresets';
|
||||||
|
|
||||||
interface Act1DialogProps {
|
interface Act1DialogProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@@ -14,15 +14,6 @@ interface Act1DialogProps {
|
|||||||
|
|
||||||
type DialogStep = 'welcome' | 'migration' | 'credits' | 'conclusion';
|
type DialogStep = 'welcome' | 'migration' | 'credits' | 'conclusion';
|
||||||
|
|
||||||
// Helper function to get the Shakespeare provider preset
|
|
||||||
function getShakespeareProvider(): PresetProvider {
|
|
||||||
const shakespeare = AI_PROVIDER_PRESETS.find(preset => preset.id === "shakespeare");
|
|
||||||
if (!shakespeare) {
|
|
||||||
throw new Error("Shakespeare provider preset not found");
|
|
||||||
}
|
|
||||||
return shakespeare;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function Act1Dialog({ open, onOpenChange }: Act1DialogProps) {
|
export function Act1Dialog({ open, onOpenChange }: Act1DialogProps) {
|
||||||
const [step, setStep] = useState<DialogStep>('welcome');
|
const [step, setStep] = useState<DialogStep>('welcome');
|
||||||
const { data: creditsData } = useAICredits(getShakespeareProvider());
|
const { data: creditsData } = useAICredits(getShakespeareProvider());
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
import {
|
||||||
|
DropdownMenu,
|
||||||
|
DropdownMenuContent,
|
||||||
|
DropdownMenuItem,
|
||||||
|
DropdownMenuTrigger,
|
||||||
|
} from '@/components/ui/dropdown-menu';
|
||||||
|
import {
|
||||||
|
GitBranch,
|
||||||
|
MoreHorizontal,
|
||||||
|
MessageSquarePlus,
|
||||||
|
History,
|
||||||
|
Folder,
|
||||||
|
Rocket,
|
||||||
|
} from 'lucide-react';
|
||||||
|
import { GitHistoryDialog } from '@/components/ai/GitHistoryDialog';
|
||||||
|
import { GitDialog } from '@/components/GitDialog';
|
||||||
|
import { DeployDialog } from '@/components/DeployDialog';
|
||||||
|
|
||||||
|
interface ActionsMenuProps {
|
||||||
|
projectId: string;
|
||||||
|
projectName: string;
|
||||||
|
onNewChat: () => void;
|
||||||
|
onProjectDetails?: () => void;
|
||||||
|
isLoading?: boolean;
|
||||||
|
isBuildLoading?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
onFirstInteraction?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ActionsMenu({
|
||||||
|
projectId,
|
||||||
|
projectName,
|
||||||
|
onNewChat,
|
||||||
|
onProjectDetails,
|
||||||
|
isLoading = false,
|
||||||
|
isBuildLoading = false,
|
||||||
|
disabled = false,
|
||||||
|
onFirstInteraction: _onFirstInteraction,
|
||||||
|
}: ActionsMenuProps) {
|
||||||
|
const [gitHistoryOpen, setGitHistoryOpen] = useState(false);
|
||||||
|
const [gitDialogOpen, setGitDialogOpen] = useState(false);
|
||||||
|
const [deployDialogOpen, setDeployDialogOpen] = useState(false);
|
||||||
|
|
||||||
|
const isAnyLoading = isLoading || isBuildLoading;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger asChild>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
className="h-8 w-8 p-0"
|
||||||
|
disabled={disabled}
|
||||||
|
>
|
||||||
|
<MoreHorizontal className="h-4 w-4" />
|
||||||
|
<span className="sr-only">Open menu</span>
|
||||||
|
</Button>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent align="end" className="w-48">
|
||||||
|
<DropdownMenuItem
|
||||||
|
onClick={onNewChat}
|
||||||
|
disabled={isLoading}
|
||||||
|
className="gap-2"
|
||||||
|
>
|
||||||
|
<MessageSquarePlus className="h-4 w-4" />
|
||||||
|
New Chat
|
||||||
|
</DropdownMenuItem>
|
||||||
|
|
||||||
|
<DropdownMenuItem
|
||||||
|
onClick={() => setGitHistoryOpen(true)}
|
||||||
|
disabled={isAnyLoading}
|
||||||
|
className="gap-2"
|
||||||
|
>
|
||||||
|
<History className="h-4 w-4" />
|
||||||
|
Rollback
|
||||||
|
</DropdownMenuItem>
|
||||||
|
|
||||||
|
<DropdownMenuItem
|
||||||
|
onClick={() => setGitDialogOpen(true)}
|
||||||
|
disabled={isAnyLoading}
|
||||||
|
className="gap-2"
|
||||||
|
>
|
||||||
|
<GitBranch className="h-4 w-4" />
|
||||||
|
Repository
|
||||||
|
</DropdownMenuItem>
|
||||||
|
|
||||||
|
<DropdownMenuItem
|
||||||
|
onClick={() => setDeployDialogOpen(true)}
|
||||||
|
disabled={isAnyLoading}
|
||||||
|
className="gap-2"
|
||||||
|
>
|
||||||
|
<Rocket className="h-4 w-4" />
|
||||||
|
Deploy
|
||||||
|
</DropdownMenuItem>
|
||||||
|
|
||||||
|
<DropdownMenuItem
|
||||||
|
onClick={onProjectDetails}
|
||||||
|
disabled={isAnyLoading}
|
||||||
|
className="gap-2"
|
||||||
|
>
|
||||||
|
<Folder className="h-4 w-4" />
|
||||||
|
Project Details
|
||||||
|
</DropdownMenuItem>
|
||||||
|
|
||||||
|
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
|
||||||
|
{/* Dialogs */}
|
||||||
|
<GitDialog
|
||||||
|
projectId={projectId}
|
||||||
|
open={gitDialogOpen}
|
||||||
|
onOpenChange={setGitDialogOpen}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<GitHistoryDialog
|
||||||
|
projectId={projectId}
|
||||||
|
open={gitHistoryOpen}
|
||||||
|
onOpenChange={setGitHistoryOpen}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<DeployDialog
|
||||||
|
projectId={projectId}
|
||||||
|
projectName={projectName}
|
||||||
|
open={deployDialogOpen}
|
||||||
|
onOpenChange={setDeployDialogOpen}
|
||||||
|
/>
|
||||||
|
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,219 +0,0 @@
|
|||||||
import { useState } from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { Bot, ChevronDown } from 'lucide-react';
|
|
||||||
import { Button } from '@/components/ui/button';
|
|
||||||
import { Checkbox } from '@/components/ui/checkbox';
|
|
||||||
import { ExternalInput } from '@/components/ui/external-input';
|
|
||||||
import {
|
|
||||||
Dialog,
|
|
||||||
DialogContent,
|
|
||||||
DialogDescription,
|
|
||||||
DialogHeader,
|
|
||||||
DialogTitle,
|
|
||||||
DialogFooter,
|
|
||||||
} from '@/components/ui/dialog';
|
|
||||||
import {
|
|
||||||
DropdownMenu,
|
|
||||||
DropdownMenuContent,
|
|
||||||
DropdownMenuItem,
|
|
||||||
DropdownMenuTrigger,
|
|
||||||
} from '@/components/ui/dropdown-menu';
|
|
||||||
import { ExternalFavicon } from '@/components/ExternalFavicon';
|
|
||||||
import { Link } from 'react-router-dom';
|
|
||||||
import type { PresetProvider } from '@/lib/aiProviderPresets';
|
|
||||||
|
|
||||||
interface OAuthHook {
|
|
||||||
isOAuthConfigured: boolean;
|
|
||||||
isLoading: boolean;
|
|
||||||
error: string | null;
|
|
||||||
initiateOAuth: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AddAIProviderDialogProps {
|
|
||||||
open: boolean;
|
|
||||||
onOpenChange: (open: boolean) => void;
|
|
||||||
preset: PresetProvider;
|
|
||||||
isLoggedIntoNostr: boolean;
|
|
||||||
oauthHook?: OAuthHook | null;
|
|
||||||
forceManualEntry?: boolean;
|
|
||||||
onSetForceManualEntry?: (force: boolean) => void;
|
|
||||||
onAdd: (apiKey: string) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function AddAIProviderDialog({
|
|
||||||
open,
|
|
||||||
onOpenChange,
|
|
||||||
preset,
|
|
||||||
isLoggedIntoNostr,
|
|
||||||
oauthHook,
|
|
||||||
forceManualEntry = false,
|
|
||||||
onSetForceManualEntry,
|
|
||||||
onAdd,
|
|
||||||
}: AddAIProviderDialogProps) {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const [apiKey, setApiKey] = useState('');
|
|
||||||
const [termsAgreed, setTermsAgreed] = useState(false);
|
|
||||||
|
|
||||||
const showNostrLoginRequired = preset.nostr && !isLoggedIntoNostr;
|
|
||||||
const isOAuthConfigured = oauthHook?.isOAuthConfigured ?? false;
|
|
||||||
const isOAuthLoading = oauthHook?.isLoading ?? false;
|
|
||||||
const oauthError = oauthHook?.error ?? null;
|
|
||||||
|
|
||||||
const handleAdd = () => {
|
|
||||||
onAdd(apiKey);
|
|
||||||
setApiKey('');
|
|
||||||
onOpenChange(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Reset state when dialog closes
|
|
||||||
const handleOpenChange = (open: boolean) => {
|
|
||||||
if (!open) {
|
|
||||||
setApiKey('');
|
|
||||||
setTermsAgreed(false);
|
|
||||||
}
|
|
||||||
onOpenChange(open);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dialog open={open} onOpenChange={handleOpenChange}>
|
|
||||||
<DialogContent className="max-w-md">
|
|
||||||
<DialogHeader>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<ExternalFavicon
|
|
||||||
url={preset.baseURL}
|
|
||||||
size={20}
|
|
||||||
fallback={<Bot size={20} />}
|
|
||||||
/>
|
|
||||||
<DialogTitle>{preset.name}</DialogTitle>
|
|
||||||
</div>
|
|
||||||
<DialogDescription>
|
|
||||||
Add {preset.name} as your AI provider
|
|
||||||
</DialogDescription>
|
|
||||||
</DialogHeader>
|
|
||||||
|
|
||||||
<div className="space-y-4 py-4">
|
|
||||||
{showNostrLoginRequired ? (
|
|
||||||
<div className="space-y-2">
|
|
||||||
<p className="text-sm text-muted-foreground">
|
|
||||||
{t('loginToNostrRequired')}
|
|
||||||
</p>
|
|
||||||
<Button asChild className="w-full">
|
|
||||||
<Link to="/settings/nostr">
|
|
||||||
{t('goToNostrSettings')}
|
|
||||||
</Link>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
) : isOAuthConfigured && !forceManualEntry ? (
|
|
||||||
// Show OAuth button if OAuth is configured and not forced to manual
|
|
||||||
<div className="space-y-3">
|
|
||||||
<div className="flex gap-0">
|
|
||||||
<Button
|
|
||||||
onClick={() => oauthHook?.initiateOAuth()}
|
|
||||||
disabled={isOAuthLoading}
|
|
||||||
className="flex-1 rounded-r-none gap-2"
|
|
||||||
variant="default"
|
|
||||||
>
|
|
||||||
{isOAuthLoading ? (
|
|
||||||
<>
|
|
||||||
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white"></div>
|
|
||||||
Connecting...
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<span className="truncate text-ellipsis overflow-hidden">
|
|
||||||
Connect to {preset.name}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</Button>
|
|
||||||
<DropdownMenu>
|
|
||||||
<DropdownMenuTrigger asChild>
|
|
||||||
<Button
|
|
||||||
variant="default"
|
|
||||||
className="rounded-l-none border-l border-primary-foreground/20 px-2"
|
|
||||||
disabled={isOAuthLoading}
|
|
||||||
>
|
|
||||||
<ChevronDown className="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
</DropdownMenuTrigger>
|
|
||||||
<DropdownMenuContent align="end">
|
|
||||||
<DropdownMenuItem onClick={() => onSetForceManualEntry?.(true)}>
|
|
||||||
Enter API key
|
|
||||||
</DropdownMenuItem>
|
|
||||||
</DropdownMenuContent>
|
|
||||||
</DropdownMenu>
|
|
||||||
</div>
|
|
||||||
{oauthError && (
|
|
||||||
<p className="text-sm text-destructive">
|
|
||||||
{oauthError}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="space-y-3">
|
|
||||||
{!preset.nostr && preset.apiKeysURL && (
|
|
||||||
<ExternalInput
|
|
||||||
type="password"
|
|
||||||
placeholder={preset.id === "routstr" ? t('enterCashuToken') : t('enterApiKey')}
|
|
||||||
value={apiKey}
|
|
||||||
onChange={(e) => setApiKey(e.target.value)}
|
|
||||||
onKeyDown={(e) => {
|
|
||||||
if (e.key === 'Enter' && apiKey.trim() && termsAgreed) {
|
|
||||||
handleAdd();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
url={preset.apiKeysURL}
|
|
||||||
urlTitle="Get Key"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Terms of Service Agreement */}
|
|
||||||
<div className="flex items-center gap-1.5">
|
|
||||||
<Checkbox
|
|
||||||
id="agree-terms"
|
|
||||||
checked={termsAgreed}
|
|
||||||
onCheckedChange={(checked) => setTermsAgreed(checked === true)}
|
|
||||||
className="size-3 [&_svg]:size-3"
|
|
||||||
/>
|
|
||||||
<label
|
|
||||||
htmlFor="agree-terms"
|
|
||||||
className="text-xs text-muted-foreground leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer"
|
|
||||||
>
|
|
||||||
{t('agreeToTermsOfService', { providerName: preset.name })}{' '}
|
|
||||||
{preset.tosURL ? (
|
|
||||||
<a
|
|
||||||
href={preset.tosURL}
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="text-muted-foreground underline hover:text-foreground hover:no-underline"
|
|
||||||
onClick={(e) => e.stopPropagation()}
|
|
||||||
>
|
|
||||||
{t('termsOfService')}
|
|
||||||
</a>
|
|
||||||
) : (
|
|
||||||
t('termsOfService')
|
|
||||||
)}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{!showNostrLoginRequired && !(isOAuthConfigured && !forceManualEntry) && (
|
|
||||||
<DialogFooter>
|
|
||||||
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
|
||||||
{t('cancel')}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
onClick={handleAdd}
|
|
||||||
disabled={
|
|
||||||
!termsAgreed ||
|
|
||||||
(!!preset.apiKeysURL && !apiKey.trim())
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t('add')}
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
)}
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,241 +0,0 @@
|
|||||||
import { useState } from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { Check } from 'lucide-react';
|
|
||||||
import { Button } from '@/components/ui/button';
|
|
||||||
import { Input } from '@/components/ui/input';
|
|
||||||
import { PasswordInput } from '@/components/ui/password-input';
|
|
||||||
import { Label } from '@/components/ui/label';
|
|
||||||
import { Checkbox } from '@/components/ui/checkbox';
|
|
||||||
import {
|
|
||||||
Dialog,
|
|
||||||
DialogContent,
|
|
||||||
DialogDescription,
|
|
||||||
DialogHeader,
|
|
||||||
DialogTitle,
|
|
||||||
DialogFooter,
|
|
||||||
} from '@/components/ui/dialog';
|
|
||||||
import {
|
|
||||||
Select,
|
|
||||||
SelectContent,
|
|
||||||
SelectItem,
|
|
||||||
SelectTrigger,
|
|
||||||
SelectValue,
|
|
||||||
} from '@/components/ui/select';
|
|
||||||
import type { AIProvider } from '@/contexts/AISettingsContext';
|
|
||||||
|
|
||||||
interface AddCustomAIProviderDialogProps {
|
|
||||||
open: boolean;
|
|
||||||
onOpenChange: (open: boolean) => void;
|
|
||||||
onAdd: (provider: AIProvider) => void;
|
|
||||||
existingIds: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to generate ID from name
|
|
||||||
function generateIdFromName(name: string): string {
|
|
||||||
return name
|
|
||||||
.toLowerCase()
|
|
||||||
.replace(/[^a-z0-9]+/g, '-') // Replace non-alphanumeric chars with hyphens
|
|
||||||
.replace(/^-+|-+$/g, ''); // Remove leading/trailing hyphens
|
|
||||||
}
|
|
||||||
|
|
||||||
export function AddCustomAIProviderDialog({
|
|
||||||
open,
|
|
||||||
onOpenChange,
|
|
||||||
onAdd,
|
|
||||||
existingIds,
|
|
||||||
}: AddCustomAIProviderDialogProps) {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const [customProviderName, setCustomProviderName] = useState('');
|
|
||||||
const [customProviderId, setCustomProviderId] = useState('');
|
|
||||||
const [customIdManuallyEdited, setCustomIdManuallyEdited] = useState(false);
|
|
||||||
const [customBaseURL, setCustomBaseURL] = useState('');
|
|
||||||
const [customApiKey, setCustomApiKey] = useState('');
|
|
||||||
const [customAuthMethod, setCustomAuthMethod] = useState<'api-key' | 'nostr' | 'opensecret'>('api-key');
|
|
||||||
const [customOpenSecretUrl, setCustomOpenSecretUrl] = useState('');
|
|
||||||
const [customProxy, setCustomProxy] = useState(false);
|
|
||||||
|
|
||||||
const handleAdd = () => {
|
|
||||||
if (!customProviderName.trim() || !customProviderId.trim() || !customBaseURL.trim()) return;
|
|
||||||
|
|
||||||
const provider: AIProvider = {
|
|
||||||
id: customProviderId.trim(),
|
|
||||||
name: customProviderName.trim(),
|
|
||||||
baseURL: customBaseURL.trim(),
|
|
||||||
};
|
|
||||||
|
|
||||||
if (customAuthMethod === 'api-key' && customApiKey.trim()) {
|
|
||||||
provider.apiKey = customApiKey.trim();
|
|
||||||
} else if (customAuthMethod === 'nostr') {
|
|
||||||
provider.nostr = true;
|
|
||||||
} else if (customAuthMethod === 'opensecret') {
|
|
||||||
provider.openSecret = customOpenSecretUrl.trim();
|
|
||||||
if (customApiKey.trim()) {
|
|
||||||
provider.apiKey = customApiKey.trim();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (customProxy) {
|
|
||||||
provider.proxy = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
onAdd(provider);
|
|
||||||
|
|
||||||
// Reset form
|
|
||||||
setCustomProviderName('');
|
|
||||||
setCustomProviderId('');
|
|
||||||
setCustomIdManuallyEdited(false);
|
|
||||||
setCustomBaseURL('');
|
|
||||||
setCustomApiKey('');
|
|
||||||
setCustomAuthMethod('api-key');
|
|
||||||
setCustomOpenSecretUrl('');
|
|
||||||
setCustomProxy(false);
|
|
||||||
|
|
||||||
onOpenChange(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const isValid = customProviderName.trim() &&
|
|
||||||
customProviderId.trim() &&
|
|
||||||
customBaseURL.trim() &&
|
|
||||||
(customAuthMethod !== 'opensecret' || customOpenSecretUrl.trim()) &&
|
|
||||||
!existingIds.includes(customProviderId.trim());
|
|
||||||
|
|
||||||
const idExists = existingIds.includes(customProviderId.trim());
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
||||||
<DialogContent className="max-w-md max-h-[90vh] overflow-y-auto">
|
|
||||||
<DialogHeader>
|
|
||||||
<DialogTitle>{t('addCustomProvider')}</DialogTitle>
|
|
||||||
<DialogDescription>
|
|
||||||
Configure a custom AI provider with your own settings
|
|
||||||
</DialogDescription>
|
|
||||||
</DialogHeader>
|
|
||||||
|
|
||||||
<div className="space-y-4 py-4">
|
|
||||||
<div className="grid grid-cols-2 gap-3">
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-name">
|
|
||||||
{t('name')} <span className="text-destructive">*</span>
|
|
||||||
</Label>
|
|
||||||
<Input
|
|
||||||
id="custom-name"
|
|
||||||
placeholder="e.g., My Custom API"
|
|
||||||
value={customProviderName}
|
|
||||||
onChange={(e) => {
|
|
||||||
const newName = e.target.value;
|
|
||||||
setCustomProviderName(newName);
|
|
||||||
|
|
||||||
// Auto-generate ID from name if ID hasn't been manually edited
|
|
||||||
if (!customIdManuallyEdited) {
|
|
||||||
setCustomProviderId(generateIdFromName(newName));
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-id">
|
|
||||||
{t('id')} <span className="text-destructive">*</span>
|
|
||||||
</Label>
|
|
||||||
<Input
|
|
||||||
id="custom-id"
|
|
||||||
placeholder="e.g., my-custom-api"
|
|
||||||
value={customProviderId}
|
|
||||||
onChange={(e) => {
|
|
||||||
setCustomProviderId(e.target.value);
|
|
||||||
setCustomIdManuallyEdited(true);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-baseurl">
|
|
||||||
{t('baseUrl')} <span className="text-destructive">*</span>
|
|
||||||
</Label>
|
|
||||||
<Input
|
|
||||||
id="custom-baseurl"
|
|
||||||
placeholder="https://api.example.com/v1"
|
|
||||||
value={customBaseURL}
|
|
||||||
onChange={(e) => setCustomBaseURL(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-auth">{t('authentication')}</Label>
|
|
||||||
<Select
|
|
||||||
value={customAuthMethod}
|
|
||||||
onValueChange={(value: 'api-key' | 'nostr' | 'opensecret') => {
|
|
||||||
setCustomAuthMethod(value);
|
|
||||||
if (value === 'nostr') {
|
|
||||||
setCustomApiKey(''); // Clear API key when switching to Nostr auth
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<SelectTrigger>
|
|
||||||
<SelectValue />
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
|
||||||
<SelectItem value="api-key">{t('apiKey')}</SelectItem>
|
|
||||||
<SelectItem value="nostr">Nostr</SelectItem>
|
|
||||||
<SelectItem value="opensecret">OpenSecret</SelectItem>
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{customAuthMethod === 'opensecret' && (
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-opensecret-url">
|
|
||||||
OpenSecret API URL <span className="text-destructive">*</span>
|
|
||||||
</Label>
|
|
||||||
<Input
|
|
||||||
id="custom-opensecret-url"
|
|
||||||
placeholder="https://enclave.trymaple.ai"
|
|
||||||
value={customOpenSecretUrl}
|
|
||||||
onChange={(e) => setCustomOpenSecretUrl(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{(customAuthMethod === 'api-key' || customAuthMethod === 'opensecret') && (
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-apikey">{t('apiKey')}</Label>
|
|
||||||
<PasswordInput
|
|
||||||
id="custom-apikey"
|
|
||||||
placeholder={t('enterApiKey') + ' (optional)'}
|
|
||||||
value={customApiKey}
|
|
||||||
onChange={(e) => setCustomApiKey(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Checkbox
|
|
||||||
id="custom-proxy"
|
|
||||||
checked={customProxy}
|
|
||||||
onCheckedChange={(checked) => setCustomProxy(checked === true)}
|
|
||||||
/>
|
|
||||||
<Label htmlFor="custom-proxy" className="cursor-pointer">
|
|
||||||
{t('useCorsProxy')}
|
|
||||||
</Label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{idExists && (
|
|
||||||
<p className="text-sm text-destructive">
|
|
||||||
{t('providerExists')}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<DialogFooter>
|
|
||||||
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
|
||||||
{t('cancel')}
|
|
||||||
</Button>
|
|
||||||
<Button onClick={handleAdd} disabled={!isValid}>
|
|
||||||
<Check className="h-4 w-4 mr-2" />
|
|
||||||
{t('addCustomProviderButton')}
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
import { useState } from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { Check } from 'lucide-react';
|
|
||||||
import { Button } from '@/components/ui/button';
|
|
||||||
import { Input } from '@/components/ui/input';
|
|
||||||
import { PasswordInput } from '@/components/ui/password-input';
|
|
||||||
import { Label } from '@/components/ui/label';
|
|
||||||
import {
|
|
||||||
Dialog,
|
|
||||||
DialogContent,
|
|
||||||
DialogDescription,
|
|
||||||
DialogHeader,
|
|
||||||
DialogTitle,
|
|
||||||
DialogFooter,
|
|
||||||
} from '@/components/ui/dialog';
|
|
||||||
|
|
||||||
interface AddCustomGitCredentialDialogProps {
|
|
||||||
open: boolean;
|
|
||||||
onOpenChange: (open: boolean) => void;
|
|
||||||
onAdd: (credential: {
|
|
||||||
name: string;
|
|
||||||
origin: string;
|
|
||||||
username: string;
|
|
||||||
password: string;
|
|
||||||
}) => void;
|
|
||||||
existingOrigins: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export function AddCustomGitCredentialDialog({
|
|
||||||
open,
|
|
||||||
onOpenChange,
|
|
||||||
onAdd,
|
|
||||||
existingOrigins,
|
|
||||||
}: AddCustomGitCredentialDialogProps) {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const [customName, setCustomName] = useState('');
|
|
||||||
const [customOrigin, setCustomOrigin] = useState('');
|
|
||||||
const [customUsername, setCustomUsername] = useState('');
|
|
||||||
const [customPassword, setCustomPassword] = useState('');
|
|
||||||
|
|
||||||
const handleAdd = () => {
|
|
||||||
if (!customName.trim() || !customOrigin.trim() || !customUsername.trim() || !customPassword.trim()) return;
|
|
||||||
|
|
||||||
onAdd({
|
|
||||||
name: customName.trim(),
|
|
||||||
origin: customOrigin.trim(),
|
|
||||||
username: customUsername.trim(),
|
|
||||||
password: customPassword.trim(),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Reset form
|
|
||||||
setCustomName('');
|
|
||||||
setCustomOrigin('');
|
|
||||||
setCustomUsername('');
|
|
||||||
setCustomPassword('');
|
|
||||||
|
|
||||||
onOpenChange(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const isValid = customName.trim() &&
|
|
||||||
customOrigin.trim() &&
|
|
||||||
customUsername.trim() &&
|
|
||||||
customPassword.trim() &&
|
|
||||||
!existingOrigins.includes(customOrigin.trim());
|
|
||||||
|
|
||||||
const originExists = existingOrigins.includes(customOrigin.trim());
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
||||||
<DialogContent className="max-w-md">
|
|
||||||
<DialogHeader>
|
|
||||||
<DialogTitle>{t('addCustomProvider')}</DialogTitle>
|
|
||||||
<DialogDescription>
|
|
||||||
Configure a custom Git server with your credentials
|
|
||||||
</DialogDescription>
|
|
||||||
</DialogHeader>
|
|
||||||
|
|
||||||
<div className="space-y-4 py-4">
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-name">
|
|
||||||
{t('name')} <span className="text-destructive">*</span>
|
|
||||||
</Label>
|
|
||||||
<Input
|
|
||||||
id="custom-name"
|
|
||||||
placeholder="My Git Server"
|
|
||||||
value={customName}
|
|
||||||
onChange={(e) => setCustomName(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-origin">
|
|
||||||
{t('origin')} <span className="text-destructive">*</span>
|
|
||||||
</Label>
|
|
||||||
<Input
|
|
||||||
id="custom-origin"
|
|
||||||
placeholder="https://git.example.com"
|
|
||||||
value={customOrigin}
|
|
||||||
onChange={(e) => setCustomOrigin(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-username">
|
|
||||||
{t('username')} <span className="text-destructive">*</span>
|
|
||||||
</Label>
|
|
||||||
<Input
|
|
||||||
id="custom-username"
|
|
||||||
placeholder="git"
|
|
||||||
value={customUsername}
|
|
||||||
onChange={(e) => setCustomUsername(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-password">
|
|
||||||
{t('password')} <span className="text-destructive">*</span>
|
|
||||||
</Label>
|
|
||||||
<PasswordInput
|
|
||||||
id="custom-password"
|
|
||||||
placeholder={t('enterPassword')}
|
|
||||||
value={customPassword}
|
|
||||||
onChange={(e) => setCustomPassword(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{originExists && (
|
|
||||||
<p className="text-sm text-destructive">
|
|
||||||
{t('credentialsExist')}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<DialogFooter>
|
|
||||||
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
|
||||||
{t('cancel')}
|
|
||||||
</Button>
|
|
||||||
<Button onClick={handleAdd} disabled={!isValid}>
|
|
||||||
<Check className="h-4 w-4 mr-2" />
|
|
||||||
{t('addCustomProviderButton')}
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,381 +0,0 @@
|
|||||||
import { useState } from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { Check } from 'lucide-react';
|
|
||||||
import { UrlListEditor } from '@/components/UrlListEditor';
|
|
||||||
import { Button } from '@/components/ui/button';
|
|
||||||
import { Input } from '@/components/ui/input';
|
|
||||||
import { PasswordInput } from '@/components/ui/password-input';
|
|
||||||
import { Label } from '@/components/ui/label';
|
|
||||||
import { Checkbox } from '@/components/ui/checkbox';
|
|
||||||
import {
|
|
||||||
Dialog,
|
|
||||||
DialogContent,
|
|
||||||
DialogDescription,
|
|
||||||
DialogHeader,
|
|
||||||
DialogTitle,
|
|
||||||
DialogFooter,
|
|
||||||
} from '@/components/ui/dialog';
|
|
||||||
import {
|
|
||||||
Select,
|
|
||||||
SelectContent,
|
|
||||||
SelectItem,
|
|
||||||
SelectTrigger,
|
|
||||||
SelectValue,
|
|
||||||
} from '@/components/ui/select';
|
|
||||||
import type {
|
|
||||||
ShakespeareDeployProvider,
|
|
||||||
NetlifyProvider,
|
|
||||||
VercelProvider,
|
|
||||||
NsiteProvider,
|
|
||||||
CloudflareProvider,
|
|
||||||
DenoDeployProvider,
|
|
||||||
RailwayProvider,
|
|
||||||
} from '@/contexts/DeploySettingsContext';
|
|
||||||
|
|
||||||
// Type for provider without the 'id' field (will be generated)
|
|
||||||
type DeployProviderInput =
|
|
||||||
| Omit<ShakespeareDeployProvider, 'id'>
|
|
||||||
| Omit<NetlifyProvider, 'id'>
|
|
||||||
| Omit<VercelProvider, 'id'>
|
|
||||||
| Omit<NsiteProvider, 'id'>
|
|
||||||
| Omit<CloudflareProvider, 'id'>
|
|
||||||
| Omit<DenoDeployProvider, 'id'>
|
|
||||||
| Omit<RailwayProvider, 'id'>;
|
|
||||||
|
|
||||||
interface AddCustomProviderDialogProps {
|
|
||||||
open: boolean;
|
|
||||||
onOpenChange: (open: boolean) => void;
|
|
||||||
onAdd: (provider: DeployProviderInput) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function AddCustomProviderDialog({
|
|
||||||
open,
|
|
||||||
onOpenChange,
|
|
||||||
onAdd,
|
|
||||||
}: AddCustomProviderDialogProps) {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const [customProviderType, setCustomProviderType] = useState<'shakespeare' | 'netlify' | 'vercel' | 'nsite' | 'cloudflare' | 'deno' | 'railway' | ''>('');
|
|
||||||
const [customName, setCustomName] = useState('');
|
|
||||||
const [customApiKey, setCustomApiKey] = useState('');
|
|
||||||
const [customAccountId, setCustomAccountId] = useState('');
|
|
||||||
const [customOrganizationId, setCustomOrganizationId] = useState('');
|
|
||||||
const [customBaseURL, setCustomBaseURL] = useState('');
|
|
||||||
const [customBaseDomain, setCustomBaseDomain] = useState('');
|
|
||||||
const [customHost, setCustomHost] = useState('');
|
|
||||||
const [customProxy, setCustomProxy] = useState(false);
|
|
||||||
const [customGateway, setCustomGateway] = useState('');
|
|
||||||
const [customRelayUrls, setCustomRelayUrls] = useState<string[]>([]);
|
|
||||||
const [customBlossomServers, setCustomBlossomServers] = useState<string[]>([]);
|
|
||||||
|
|
||||||
const handleAdd = () => {
|
|
||||||
if (!customProviderType || !customName.trim()) return;
|
|
||||||
|
|
||||||
// Build provider object based on type
|
|
||||||
let provider: DeployProviderInput;
|
|
||||||
|
|
||||||
if (customProviderType === 'shakespeare') {
|
|
||||||
provider = {
|
|
||||||
type: 'shakespeare',
|
|
||||||
name: customName.trim(),
|
|
||||||
...(customHost?.trim() && { host: customHost.trim() }),
|
|
||||||
...(customProxy && { proxy: true }),
|
|
||||||
};
|
|
||||||
} else if (customProviderType === 'nsite') {
|
|
||||||
provider = {
|
|
||||||
type: 'nsite',
|
|
||||||
name: customName.trim(),
|
|
||||||
gateway: customGateway.trim() || 'shakespeare.to',
|
|
||||||
relayUrls: customRelayUrls.length > 0 ? customRelayUrls : ['wss://relay.ditto.pub'],
|
|
||||||
blossomServers: customBlossomServers.length > 0 ? customBlossomServers : ['https://blossom.ditto.pub/', 'https://blossom.dreamith.to/'],
|
|
||||||
};
|
|
||||||
} else if (customProviderType === 'netlify') {
|
|
||||||
if (!customApiKey.trim()) return;
|
|
||||||
provider = {
|
|
||||||
type: 'netlify',
|
|
||||||
name: customName.trim(),
|
|
||||||
apiKey: customApiKey.trim(),
|
|
||||||
...(customBaseURL?.trim() && { baseURL: customBaseURL.trim() }),
|
|
||||||
...(customProxy && { proxy: true }),
|
|
||||||
};
|
|
||||||
} else if (customProviderType === 'vercel') {
|
|
||||||
if (!customApiKey.trim()) return;
|
|
||||||
provider = {
|
|
||||||
type: 'vercel',
|
|
||||||
name: customName.trim(),
|
|
||||||
apiKey: customApiKey.trim(),
|
|
||||||
...(customBaseURL?.trim() && { baseURL: customBaseURL.trim() }),
|
|
||||||
...(customProxy && { proxy: true }),
|
|
||||||
};
|
|
||||||
} else if (customProviderType === 'cloudflare') {
|
|
||||||
if (!customApiKey.trim() || !customAccountId.trim()) return;
|
|
||||||
provider = {
|
|
||||||
type: 'cloudflare',
|
|
||||||
name: customName.trim(),
|
|
||||||
apiKey: customApiKey.trim(),
|
|
||||||
accountId: customAccountId.trim(),
|
|
||||||
...(customBaseURL?.trim() && { baseURL: customBaseURL.trim() }),
|
|
||||||
...(customBaseDomain?.trim() && { baseDomain: customBaseDomain.trim() }),
|
|
||||||
...(customProxy && { proxy: true }),
|
|
||||||
};
|
|
||||||
} else if (customProviderType === 'deno') {
|
|
||||||
if (!customApiKey.trim() || !customOrganizationId.trim()) return;
|
|
||||||
provider = {
|
|
||||||
type: 'deno',
|
|
||||||
name: customName.trim(),
|
|
||||||
apiKey: customApiKey.trim(),
|
|
||||||
organizationId: customOrganizationId.trim(),
|
|
||||||
...(customBaseURL?.trim() && { baseURL: customBaseURL.trim() }),
|
|
||||||
...(customBaseDomain?.trim() && { baseDomain: customBaseDomain.trim() }),
|
|
||||||
...(customProxy && { proxy: true }),
|
|
||||||
};
|
|
||||||
} else if (customProviderType === 'railway') {
|
|
||||||
if (!customApiKey.trim()) return;
|
|
||||||
provider = {
|
|
||||||
type: 'railway',
|
|
||||||
name: customName.trim(),
|
|
||||||
apiKey: customApiKey.trim(),
|
|
||||||
...(customBaseURL?.trim() && { baseURL: customBaseURL.trim() }),
|
|
||||||
...(customProxy && { proxy: true }),
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return; // Unknown type
|
|
||||||
}
|
|
||||||
|
|
||||||
onAdd(provider);
|
|
||||||
|
|
||||||
// Reset form
|
|
||||||
setCustomProviderType('');
|
|
||||||
setCustomName('');
|
|
||||||
setCustomApiKey('');
|
|
||||||
setCustomAccountId('');
|
|
||||||
setCustomOrganizationId('');
|
|
||||||
setCustomBaseURL('');
|
|
||||||
setCustomBaseDomain('');
|
|
||||||
setCustomHost('');
|
|
||||||
setCustomProxy(false);
|
|
||||||
setCustomGateway('');
|
|
||||||
setCustomRelayUrls([]);
|
|
||||||
setCustomBlossomServers([]);
|
|
||||||
|
|
||||||
onOpenChange(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const isValid = customProviderType && customName.trim() &&
|
|
||||||
(customProviderType === 'shakespeare' || customProviderType === 'nsite' ||
|
|
||||||
(customApiKey.trim() &&
|
|
||||||
(customProviderType !== 'cloudflare' || customAccountId.trim()) &&
|
|
||||||
(customProviderType !== 'deno' || customOrganizationId.trim()) &&
|
|
||||||
(customProviderType !== 'railway' || true)));
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
||||||
<DialogContent className="max-w-md max-h-[90vh] overflow-y-auto">
|
|
||||||
<DialogHeader>
|
|
||||||
<DialogTitle>{t('addCustomProvider')}</DialogTitle>
|
|
||||||
<DialogDescription>
|
|
||||||
Configure a custom deployment provider with your own settings
|
|
||||||
</DialogDescription>
|
|
||||||
</DialogHeader>
|
|
||||||
|
|
||||||
<div className="space-y-4 py-4">
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-provider-type">
|
|
||||||
{t('providerType')} <span className="text-destructive">*</span>
|
|
||||||
</Label>
|
|
||||||
<Select
|
|
||||||
value={customProviderType}
|
|
||||||
onValueChange={(value: 'shakespeare' | 'netlify' | 'vercel' | 'nsite' | 'cloudflare' | 'deno' | 'railway') => {
|
|
||||||
setCustomProviderType(value);
|
|
||||||
// Reset form when provider type changes
|
|
||||||
setCustomApiKey('');
|
|
||||||
setCustomAccountId('');
|
|
||||||
setCustomOrganizationId('');
|
|
||||||
setCustomBaseURL('');
|
|
||||||
setCustomBaseDomain('');
|
|
||||||
setCustomHost('');
|
|
||||||
setCustomProxy(false);
|
|
||||||
setCustomGateway('');
|
|
||||||
setCustomRelayUrls([]);
|
|
||||||
setCustomBlossomServers([]);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<SelectTrigger>
|
|
||||||
<SelectValue placeholder={t('selectProviderType')} />
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
|
||||||
<SelectItem value="shakespeare">Shakespeare Deploy</SelectItem>
|
|
||||||
<SelectItem value="nsite">nsite</SelectItem>
|
|
||||||
<SelectItem value="netlify">Netlify</SelectItem>
|
|
||||||
<SelectItem value="vercel">Vercel</SelectItem>
|
|
||||||
<SelectItem value="cloudflare">Cloudflare</SelectItem>
|
|
||||||
<SelectItem value="deno">Deno Deploy</SelectItem>
|
|
||||||
<SelectItem value="railway">Railway</SelectItem>
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{customProviderType && (
|
|
||||||
<>
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-name">
|
|
||||||
{t('providerName')} <span className="text-destructive">*</span>
|
|
||||||
</Label>
|
|
||||||
<Input
|
|
||||||
id="custom-name"
|
|
||||||
placeholder="e.g., My Production Deploy"
|
|
||||||
value={customName}
|
|
||||||
onChange={(e) => setCustomName(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{customProviderType === 'shakespeare' ? (
|
|
||||||
<>
|
|
||||||
<p className="text-sm text-muted-foreground">
|
|
||||||
{t('shakespeareDeployNostrAuth')}
|
|
||||||
</p>
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-host">Host (Optional)</Label>
|
|
||||||
<Input
|
|
||||||
id="custom-host"
|
|
||||||
placeholder="shakespeare.wtf"
|
|
||||||
value={customHost}
|
|
||||||
onChange={(e) => setCustomHost(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
) : customProviderType === 'nsite' ? (
|
|
||||||
<>
|
|
||||||
<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.
|
|
||||||
</p>
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-gateway">Gateway</Label>
|
|
||||||
<Input
|
|
||||||
id="custom-gateway"
|
|
||||||
placeholder="shakespeare.to"
|
|
||||||
value={customGateway}
|
|
||||||
onChange={(e) => setCustomGateway(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<UrlListEditor
|
|
||||||
label="Relay URLs"
|
|
||||||
items={customRelayUrls}
|
|
||||||
onChange={setCustomRelayUrls}
|
|
||||||
protocol="wss"
|
|
||||||
placeholder="relay.ditto.pub"
|
|
||||||
/>
|
|
||||||
<UrlListEditor
|
|
||||||
label="Blossom Servers"
|
|
||||||
items={customBlossomServers}
|
|
||||||
onChange={setCustomBlossomServers}
|
|
||||||
protocol="https"
|
|
||||||
placeholder="blossom.ditto.pub"
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
{customProviderType === 'cloudflare' && (
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-accountid">
|
|
||||||
Account ID <span className="text-destructive">*</span>
|
|
||||||
</Label>
|
|
||||||
<Input
|
|
||||||
id="custom-accountid"
|
|
||||||
placeholder="Enter Account ID"
|
|
||||||
value={customAccountId}
|
|
||||||
onChange={(e) => setCustomAccountId(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{customProviderType === 'deno' && (
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-organizationid">
|
|
||||||
Organization ID <span className="text-destructive">*</span>
|
|
||||||
</Label>
|
|
||||||
<Input
|
|
||||||
id="custom-organizationid"
|
|
||||||
placeholder="Enter Organization ID"
|
|
||||||
value={customOrganizationId}
|
|
||||||
onChange={(e) => setCustomOrganizationId(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-apikey">
|
|
||||||
{customProviderType === 'netlify' ? 'Personal Access Token' :
|
|
||||||
customProviderType === 'cloudflare' ? 'API Token' :
|
|
||||||
customProviderType === 'deno' ? 'Access Token' :
|
|
||||||
customProviderType === 'railway' ? 'API Token' :
|
|
||||||
'Access Token'} <span className="text-destructive">*</span>
|
|
||||||
</Label>
|
|
||||||
<PasswordInput
|
|
||||||
id="custom-apikey"
|
|
||||||
placeholder={t('enterApiKey')}
|
|
||||||
value={customApiKey}
|
|
||||||
onChange={(e) => setCustomApiKey(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-baseurl">Base URL (Optional)</Label>
|
|
||||||
<Input
|
|
||||||
id="custom-baseurl"
|
|
||||||
placeholder={
|
|
||||||
customProviderType === 'netlify'
|
|
||||||
? 'https://api.netlify.com/api/v1'
|
|
||||||
: customProviderType === 'vercel'
|
|
||||||
? 'https://api.vercel.com'
|
|
||||||
: customProviderType === 'deno'
|
|
||||||
? 'https://api.deno.com/v1'
|
|
||||||
: customProviderType === 'railway'
|
|
||||||
? 'https://backboard.railway.com'
|
|
||||||
: 'https://api.cloudflare.com/client/v4'
|
|
||||||
}
|
|
||||||
value={customBaseURL}
|
|
||||||
onChange={(e) => setCustomBaseURL(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{(customProviderType === 'cloudflare' || customProviderType === 'deno') && (
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<Label htmlFor="custom-basedomain">Base Domain (Optional)</Label>
|
|
||||||
<Input
|
|
||||||
id="custom-basedomain"
|
|
||||||
placeholder={customProviderType === 'cloudflare' ? 'workers.dev' : 'deno.dev'}
|
|
||||||
value={customBaseDomain}
|
|
||||||
onChange={(e) => setCustomBaseDomain(e.target.value)}
|
|
||||||
/>
|
|
||||||
<p className="text-xs text-muted-foreground">
|
|
||||||
{customProviderType === 'cloudflare'
|
|
||||||
? 'The domain suffix for deployed workers (e.g., workers.dev)'
|
|
||||||
: 'The domain suffix for deployed projects (e.g., deno.dev)'}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div className="flex items-center space-x-2">
|
|
||||||
<Checkbox
|
|
||||||
id="custom-proxy"
|
|
||||||
checked={customProxy}
|
|
||||||
onCheckedChange={(checked) => setCustomProxy(checked === true)}
|
|
||||||
/>
|
|
||||||
<Label htmlFor="custom-proxy" className="text-sm font-normal cursor-pointer">
|
|
||||||
Use CORS Proxy
|
|
||||||
</Label>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<DialogFooter>
|
|
||||||
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
|
||||||
{t('cancel')}
|
|
||||||
</Button>
|
|
||||||
<Button onClick={handleAdd} disabled={!isValid}>
|
|
||||||
<Check className="h-4 w-4 mr-2" />
|
|
||||||
{t('add')}
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,220 +0,0 @@
|
|||||||
import { useState } from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { Rocket, ChevronDown } from 'lucide-react';
|
|
||||||
import { Button } from '@/components/ui/button';
|
|
||||||
import { ExternalInput } from '@/components/ui/external-input';
|
|
||||||
import {
|
|
||||||
Dialog,
|
|
||||||
DialogContent,
|
|
||||||
DialogDescription,
|
|
||||||
DialogHeader,
|
|
||||||
DialogTitle,
|
|
||||||
DialogFooter,
|
|
||||||
} from '@/components/ui/dialog';
|
|
||||||
import {
|
|
||||||
DropdownMenu,
|
|
||||||
DropdownMenuContent,
|
|
||||||
DropdownMenuItem,
|
|
||||||
DropdownMenuTrigger,
|
|
||||||
} from '@/components/ui/dropdown-menu';
|
|
||||||
import { ExternalFavicon } from '@/components/ExternalFavicon';
|
|
||||||
import { Link } from 'react-router-dom';
|
|
||||||
import type { PresetDeployProvider } from '@/lib/deploy/types';
|
|
||||||
|
|
||||||
interface OAuthHook {
|
|
||||||
isOAuthConfigured: boolean;
|
|
||||||
isLoading: boolean;
|
|
||||||
error: string | null;
|
|
||||||
initiateOAuth: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AddDeployProviderDialogProps {
|
|
||||||
open: boolean;
|
|
||||||
onOpenChange: (open: boolean) => void;
|
|
||||||
preset: PresetDeployProvider;
|
|
||||||
isLoggedIntoNostr: boolean;
|
|
||||||
oauthHook: OAuthHook | null;
|
|
||||||
forceManualEntry: boolean;
|
|
||||||
onSetForceManualEntry: (force: boolean) => void;
|
|
||||||
onAdd: (apiKey: string, accountId?: string, organizationId?: string) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function AddDeployProviderDialog({
|
|
||||||
open,
|
|
||||||
onOpenChange,
|
|
||||||
preset,
|
|
||||||
isLoggedIntoNostr,
|
|
||||||
oauthHook,
|
|
||||||
forceManualEntry,
|
|
||||||
onSetForceManualEntry,
|
|
||||||
onAdd,
|
|
||||||
}: AddDeployProviderDialogProps) {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const [apiKey, setApiKey] = useState('');
|
|
||||||
const [accountId, setAccountId] = useState('');
|
|
||||||
const [organizationId, setOrganizationId] = useState('');
|
|
||||||
|
|
||||||
const showNostrLoginRequired = preset.requiresNostr && !isLoggedIntoNostr;
|
|
||||||
const isOAuthConfigured = oauthHook?.isOAuthConfigured ?? false;
|
|
||||||
const isOAuthLoading = oauthHook?.isLoading ?? false;
|
|
||||||
const oauthError = oauthHook?.error ?? null;
|
|
||||||
|
|
||||||
const handleAdd = () => {
|
|
||||||
onAdd(apiKey, accountId, organizationId);
|
|
||||||
setApiKey('');
|
|
||||||
setAccountId('');
|
|
||||||
setOrganizationId('');
|
|
||||||
onOpenChange(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
||||||
<DialogContent className="max-w-md">
|
|
||||||
<DialogHeader>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<ExternalFavicon
|
|
||||||
url={preset.baseURL}
|
|
||||||
size={20}
|
|
||||||
fallback={<Rocket size={20} />}
|
|
||||||
/>
|
|
||||||
<DialogTitle>{preset.name}</DialogTitle>
|
|
||||||
</div>
|
|
||||||
<DialogDescription>
|
|
||||||
{preset.description}
|
|
||||||
</DialogDescription>
|
|
||||||
</DialogHeader>
|
|
||||||
|
|
||||||
<div className="space-y-4 py-4">
|
|
||||||
{showNostrLoginRequired ? (
|
|
||||||
<div className="space-y-2">
|
|
||||||
<p className="text-sm text-muted-foreground">
|
|
||||||
{t('loginToNostrRequired')}
|
|
||||||
</p>
|
|
||||||
<Button asChild className="w-full">
|
|
||||||
<Link to="/settings/nostr">
|
|
||||||
{t('goToNostrSettings')}
|
|
||||||
</Link>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
) : isOAuthConfigured && !forceManualEntry ? (
|
|
||||||
// Show OAuth button if OAuth is configured and not forced to manual
|
|
||||||
<div className="space-y-3">
|
|
||||||
<div className="flex gap-0">
|
|
||||||
<Button
|
|
||||||
onClick={() => oauthHook?.initiateOAuth()}
|
|
||||||
disabled={isOAuthLoading}
|
|
||||||
className="flex-1 rounded-r-none gap-2"
|
|
||||||
variant="default"
|
|
||||||
>
|
|
||||||
{isOAuthLoading ? (
|
|
||||||
<>
|
|
||||||
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white"></div>
|
|
||||||
Connecting...
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<span className="truncate text-ellipsis overflow-hidden">
|
|
||||||
Connect to {preset.name}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</Button>
|
|
||||||
<DropdownMenu>
|
|
||||||
<DropdownMenuTrigger asChild>
|
|
||||||
<Button
|
|
||||||
variant="default"
|
|
||||||
className="rounded-l-none border-l border-primary-foreground/20 px-2"
|
|
||||||
disabled={isOAuthLoading}
|
|
||||||
>
|
|
||||||
<ChevronDown className="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
</DropdownMenuTrigger>
|
|
||||||
<DropdownMenuContent align="end">
|
|
||||||
<DropdownMenuItem onClick={() => onSetForceManualEntry(true)}>
|
|
||||||
Enter API key
|
|
||||||
</DropdownMenuItem>
|
|
||||||
</DropdownMenuContent>
|
|
||||||
</DropdownMenu>
|
|
||||||
</div>
|
|
||||||
{oauthError && (
|
|
||||||
<p className="text-sm text-destructive">
|
|
||||||
{oauthError}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
// Show manual token input
|
|
||||||
<div className="space-y-3">
|
|
||||||
{!preset.requiresNostr && preset.type !== 'nsite' && (
|
|
||||||
<>
|
|
||||||
{preset.type === 'cloudflare' && (
|
|
||||||
<ExternalInput
|
|
||||||
type="text"
|
|
||||||
placeholder={preset.accountIdLabel || 'Account ID'}
|
|
||||||
value={accountId}
|
|
||||||
onChange={(e) => setAccountId(e.target.value)}
|
|
||||||
onKeyDown={(e) => {
|
|
||||||
if (e.key === 'Enter' && apiKey.trim() && accountId.trim()) {
|
|
||||||
handleAdd();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
url={preset.accountIdURL}
|
|
||||||
urlTitle="Find ID"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{preset.type === 'deno' && (
|
|
||||||
<ExternalInput
|
|
||||||
type="text"
|
|
||||||
placeholder={preset.organizationIdLabel || 'Organization ID'}
|
|
||||||
value={organizationId}
|
|
||||||
onChange={(e) => setOrganizationId(e.target.value)}
|
|
||||||
onKeyDown={(e) => {
|
|
||||||
if (e.key === 'Enter' && apiKey.trim() && organizationId.trim()) {
|
|
||||||
handleAdd();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
url={preset.organizationIdURL}
|
|
||||||
urlTitle="Find ID"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<ExternalInput
|
|
||||||
type="password"
|
|
||||||
placeholder={preset.apiKeyLabel || t('enterApiKey')}
|
|
||||||
value={apiKey}
|
|
||||||
onChange={(e) => setApiKey(e.target.value)}
|
|
||||||
onKeyDown={(e) => {
|
|
||||||
if (e.key === 'Enter' && apiKey.trim() &&
|
|
||||||
(preset.type !== 'cloudflare' || accountId.trim()) &&
|
|
||||||
(preset.type !== 'deno' || organizationId.trim())) {
|
|
||||||
handleAdd();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
url={preset.apiKeyURL}
|
|
||||||
urlTitle="Get Key"
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{!showNostrLoginRequired && !(isOAuthConfigured && !forceManualEntry) && (
|
|
||||||
<DialogFooter>
|
|
||||||
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
|
||||||
{t('cancel')}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
onClick={handleAdd}
|
|
||||||
disabled={
|
|
||||||
(preset.requiresNostr && !isLoggedIntoNostr) ||
|
|
||||||
(!preset.requiresNostr && preset.type !== 'nsite' && !apiKey.trim()) ||
|
|
||||||
(preset.type === 'cloudflare' && !accountId.trim()) ||
|
|
||||||
(preset.type === 'deno' && !organizationId.trim())
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t('add')}
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
)}
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,162 +0,0 @@
|
|||||||
import { useState } from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { GitBranch, ChevronDown } from 'lucide-react';
|
|
||||||
import { Button } from '@/components/ui/button';
|
|
||||||
import { ExternalInput } from '@/components/ui/external-input';
|
|
||||||
import {
|
|
||||||
Dialog,
|
|
||||||
DialogContent,
|
|
||||||
DialogDescription,
|
|
||||||
DialogHeader,
|
|
||||||
DialogTitle,
|
|
||||||
DialogFooter,
|
|
||||||
} from '@/components/ui/dialog';
|
|
||||||
import {
|
|
||||||
DropdownMenu,
|
|
||||||
DropdownMenuContent,
|
|
||||||
DropdownMenuItem,
|
|
||||||
DropdownMenuTrigger,
|
|
||||||
} from '@/components/ui/dropdown-menu';
|
|
||||||
import { ExternalFavicon } from '@/components/ExternalFavicon';
|
|
||||||
|
|
||||||
interface PresetProvider {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
origin: string;
|
|
||||||
username: string;
|
|
||||||
tokenURL?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface OAuthHook {
|
|
||||||
initiateOAuth: () => void;
|
|
||||||
isLoading: boolean;
|
|
||||||
error: string | null;
|
|
||||||
isOAuthConfigured: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AddGitCredentialDialogProps {
|
|
||||||
open: boolean;
|
|
||||||
onOpenChange: (open: boolean) => void;
|
|
||||||
preset: PresetProvider;
|
|
||||||
oauthHook: OAuthHook | null;
|
|
||||||
forceManualEntry: boolean;
|
|
||||||
onSetForceManualEntry: (force: boolean) => void;
|
|
||||||
onAdd: (token: string) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function AddGitCredentialDialog({
|
|
||||||
open,
|
|
||||||
onOpenChange,
|
|
||||||
preset,
|
|
||||||
oauthHook,
|
|
||||||
forceManualEntry,
|
|
||||||
onSetForceManualEntry,
|
|
||||||
onAdd,
|
|
||||||
}: AddGitCredentialDialogProps) {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const [token, setToken] = useState('');
|
|
||||||
|
|
||||||
const isOAuthConfigured = oauthHook?.isOAuthConfigured ?? false;
|
|
||||||
const isOAuthLoading = oauthHook?.isLoading ?? false;
|
|
||||||
const oauthError = oauthHook?.error ?? null;
|
|
||||||
|
|
||||||
const handleAdd = () => {
|
|
||||||
onAdd(token);
|
|
||||||
setToken('');
|
|
||||||
onOpenChange(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
||||||
<DialogContent className="max-w-md">
|
|
||||||
<DialogHeader>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<ExternalFavicon
|
|
||||||
url={preset.origin}
|
|
||||||
size={20}
|
|
||||||
fallback={<GitBranch size={20} />}
|
|
||||||
/>
|
|
||||||
<DialogTitle>{preset.name}</DialogTitle>
|
|
||||||
</div>
|
|
||||||
<DialogDescription>
|
|
||||||
Add {preset.name} credentials for Git operations
|
|
||||||
</DialogDescription>
|
|
||||||
</DialogHeader>
|
|
||||||
|
|
||||||
<div className="space-y-4 py-4">
|
|
||||||
{isOAuthConfigured && !forceManualEntry ? (
|
|
||||||
// Show OAuth button if OAuth is configured and not forced to manual
|
|
||||||
<div className="space-y-3">
|
|
||||||
<div className="flex gap-0">
|
|
||||||
<Button
|
|
||||||
onClick={() => oauthHook?.initiateOAuth()}
|
|
||||||
disabled={isOAuthLoading}
|
|
||||||
className="flex-1 rounded-r-none gap-2"
|
|
||||||
variant="default"
|
|
||||||
>
|
|
||||||
{isOAuthLoading ? (
|
|
||||||
<>
|
|
||||||
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white"></div>
|
|
||||||
Connecting...
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<span className="truncate text-ellipsis overflow-hidden">
|
|
||||||
Connect to {preset.name}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</Button>
|
|
||||||
<DropdownMenu>
|
|
||||||
<DropdownMenuTrigger asChild>
|
|
||||||
<Button
|
|
||||||
variant="default"
|
|
||||||
className="rounded-l-none border-l border-primary-foreground/20 px-2"
|
|
||||||
disabled={isOAuthLoading}
|
|
||||||
>
|
|
||||||
<ChevronDown className="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
</DropdownMenuTrigger>
|
|
||||||
<DropdownMenuContent align="end">
|
|
||||||
<DropdownMenuItem onClick={() => onSetForceManualEntry(true)}>
|
|
||||||
Enter token manually
|
|
||||||
</DropdownMenuItem>
|
|
||||||
</DropdownMenuContent>
|
|
||||||
</DropdownMenu>
|
|
||||||
</div>
|
|
||||||
{oauthError && (
|
|
||||||
<p className="text-sm text-destructive">
|
|
||||||
{oauthError}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
// Show manual token input
|
|
||||||
<ExternalInput
|
|
||||||
type="password"
|
|
||||||
placeholder={t('enterToken')}
|
|
||||||
value={token}
|
|
||||||
onChange={(e) => setToken(e.target.value)}
|
|
||||||
onKeyDown={(e) => {
|
|
||||||
if (e.key === 'Enter' && token.trim()) {
|
|
||||||
handleAdd();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
url={preset.tokenURL}
|
|
||||||
urlTitle="Get Token"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{!(isOAuthConfigured && !forceManualEntry) && (
|
|
||||||
<DialogFooter>
|
|
||||||
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
|
||||||
{t('cancel')}
|
|
||||||
</Button>
|
|
||||||
<Button onClick={handleAdd} disabled={!token.trim()}>
|
|
||||||
{t('add')}
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
)}
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -2,13 +2,12 @@ import { describe, it, expect, vi } from 'vitest';
|
|||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
import { TestApp } from '@/test/TestApp';
|
import { TestApp } from '@/test/TestApp';
|
||||||
import { AddSharedProviderDialog } from './AddSharedProviderDialog';
|
import { AddProviderDialog } from './AddProviderDialog';
|
||||||
import type { AIProvider } from '@/contexts/AISettingsContext';
|
import type { AIProvider } from '@/contexts/AISettingsContext';
|
||||||
|
|
||||||
describe('AddSharedProviderDialog', () => {
|
describe('AddProviderDialog', () => {
|
||||||
const mockProvider: AIProvider = {
|
const mockProvider: AIProvider = {
|
||||||
id: 'test-provider',
|
id: 'test-provider',
|
||||||
name: 'Test Provider',
|
|
||||||
baseURL: 'https://api.test.com/v1',
|
baseURL: 'https://api.test.com/v1',
|
||||||
apiKey: 'sk-test-key-123',
|
apiKey: 'sk-test-key-123',
|
||||||
};
|
};
|
||||||
@@ -18,7 +17,7 @@ describe('AddSharedProviderDialog', () => {
|
|||||||
|
|
||||||
render(
|
render(
|
||||||
<TestApp>
|
<TestApp>
|
||||||
<AddSharedProviderDialog
|
<AddProviderDialog
|
||||||
open={true}
|
open={true}
|
||||||
onOpenChange={onOpenChange}
|
onOpenChange={onOpenChange}
|
||||||
provider={mockProvider}
|
provider={mockProvider}
|
||||||
@@ -26,9 +25,9 @@ describe('AddSharedProviderDialog', () => {
|
|||||||
</TestApp>
|
</TestApp>
|
||||||
);
|
);
|
||||||
|
|
||||||
// Provider name is displayed in the heading
|
// Provider name is used as the heading (fallback to id since it's not in presets)
|
||||||
expect(screen.getByRole('heading', { name: 'Test Provider' })).toBeInTheDocument();
|
expect(screen.getByRole('heading', { name: 'test-provider' })).toBeInTheDocument();
|
||||||
expect(screen.getByText(/Add Test Provider to your configuration/i)).toBeInTheDocument();
|
expect(screen.getByText(/Add test-provider to your configuration/i)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows add provider button for new provider', () => {
|
it('shows add provider button for new provider', () => {
|
||||||
@@ -36,7 +35,7 @@ describe('AddSharedProviderDialog', () => {
|
|||||||
|
|
||||||
render(
|
render(
|
||||||
<TestApp>
|
<TestApp>
|
||||||
<AddSharedProviderDialog
|
<AddProviderDialog
|
||||||
open={true}
|
open={true}
|
||||||
onOpenChange={onOpenChange}
|
onOpenChange={onOpenChange}
|
||||||
provider={mockProvider}
|
provider={mockProvider}
|
||||||
@@ -55,7 +54,7 @@ describe('AddSharedProviderDialog', () => {
|
|||||||
|
|
||||||
render(
|
render(
|
||||||
<TestApp>
|
<TestApp>
|
||||||
<AddSharedProviderDialog
|
<AddProviderDialog
|
||||||
open={true}
|
open={true}
|
||||||
onOpenChange={onOpenChange}
|
onOpenChange={onOpenChange}
|
||||||
provider={mockProvider}
|
provider={mockProvider}
|
||||||
@@ -74,7 +73,7 @@ describe('AddSharedProviderDialog', () => {
|
|||||||
|
|
||||||
render(
|
render(
|
||||||
<TestApp>
|
<TestApp>
|
||||||
<AddSharedProviderDialog
|
<AddProviderDialog
|
||||||
open={true}
|
open={true}
|
||||||
onOpenChange={onOpenChange}
|
onOpenChange={onOpenChange}
|
||||||
provider={mockProvider}
|
provider={mockProvider}
|
||||||
@@ -93,14 +92,13 @@ describe('AddSharedProviderDialog', () => {
|
|||||||
// Use a provider that exists in presets
|
// Use a provider that exists in presets
|
||||||
const openrouterProvider: AIProvider = {
|
const openrouterProvider: AIProvider = {
|
||||||
id: 'openrouter',
|
id: 'openrouter',
|
||||||
name: 'OpenRouter',
|
|
||||||
baseURL: 'https://openrouter.ai/api/v1',
|
baseURL: 'https://openrouter.ai/api/v1',
|
||||||
apiKey: 'sk-test-123',
|
apiKey: 'sk-test-123',
|
||||||
};
|
};
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<TestApp>
|
<TestApp>
|
||||||
<AddSharedProviderDialog
|
<AddProviderDialog
|
||||||
open={true}
|
open={true}
|
||||||
onOpenChange={onOpenChange}
|
onOpenChange={onOpenChange}
|
||||||
provider={openrouterProvider}
|
provider={openrouterProvider}
|
||||||
@@ -112,17 +110,16 @@ describe('AddSharedProviderDialog', () => {
|
|||||||
expect(screen.getByText(/Add OpenRouter to your configuration/i)).toBeInTheDocument();
|
expect(screen.getByText(/Add OpenRouter to your configuration/i)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uses provider name when not in presets', () => {
|
it('uses provider id as fallback name when not in presets', () => {
|
||||||
const onOpenChange = vi.fn();
|
const onOpenChange = vi.fn();
|
||||||
const customProvider: AIProvider = {
|
const customProvider: AIProvider = {
|
||||||
id: 'my-custom-provider',
|
id: 'my-custom-provider',
|
||||||
name: 'My Custom Provider',
|
|
||||||
baseURL: 'https://api.custom.com/v1',
|
baseURL: 'https://api.custom.com/v1',
|
||||||
};
|
};
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<TestApp>
|
<TestApp>
|
||||||
<AddSharedProviderDialog
|
<AddProviderDialog
|
||||||
open={true}
|
open={true}
|
||||||
onOpenChange={onOpenChange}
|
onOpenChange={onOpenChange}
|
||||||
provider={customProvider}
|
provider={customProvider}
|
||||||
@@ -130,7 +127,7 @@ describe('AddSharedProviderDialog', () => {
|
|||||||
</TestApp>
|
</TestApp>
|
||||||
);
|
);
|
||||||
|
|
||||||
// Should use the provider name even when not in presets
|
// Should use the id as the name since it's not in presets
|
||||||
expect(screen.getByText(/Add My Custom Provider to your configuration/i)).toBeInTheDocument();
|
expect(screen.getByText(/Add my-custom-provider to your configuration/i)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||