80 Commits

Author SHA1 Message Date
1d926ce082 Merge pull request #3 from SrIzan10/feat/android-app
feat/android app
2026-04-23 22:52:13 +02:00
8fdb06641f feat: dls tag 2026-04-23 22:51:47 +02:00
2852cd56d8 ci: android workflow 2026-04-23 22:15:07 +02:00
9dd24d77fc fix: android app corners and new downloads page 2026-04-22 20:31:46 +02:00
da3d3b607e feat: apk builds 2026-03-19 21:27:13 +01:00
98b17af7be fix: build issues 2026-02-13 23:47:18 +01:00
3add1c2825 chore: some webrtc build fixes 2026-02-13 23:46:09 +01:00
55d8a6f173 chore: config changes 2026-02-13 23:22:32 +01:00
5454339d46 feat: add splash 2026-02-13 23:17:58 +01:00
c3cc78794f feat(native): add English and Spanish i18n support 2026-02-13 19:04:30 +01:00
79b29c3959 perf(native): reduce Android screen-share latency 2026-02-13 18:57:12 +01:00
e5bc2ec353 fix(native): enable Android media projection foreground service 2026-02-13 18:54:08 +01:00
e53b46def1 fix(native): serialize ICE candidates from Android peer 2026-02-13 18:49:54 +01:00
5538554f7a fix(native): stop preset detail request loop 2026-02-13 18:42:48 +01:00
38a557bd79 feat(native): add Android screen-share host with presets 2026-02-13 18:33:25 +01:00
b088b65dad fix(native): use explicit Expo entry file 2026-02-13 18:19:06 +01:00
c4f6fb87a1 fix(native): avoid Java keyword in app package id 2026-02-13 18:11:00 +01:00
0d7116050c feat(native): add React Native viewer with Clerk auth 2026-02-13 17:53:38 +01:00
b6909b8f49 fix(mobile): prefer Chrome launch on Android 2026-02-13 17:42:02 +01:00
1ee47a6940 fix(mobile): align react and react-dom versions 2026-02-13 17:39:13 +01:00
f6c836e705 fix(mobile): use relative asset paths for Capacitor 2026-02-13 17:36:51 +01:00
397fa9c0c4 feat(mobile): add Capacitor Android wrapper for Helium 2026-02-13 17:13:25 +01:00
61458b2759 fix: macos drag region 2026-02-10 20:14:42 +01:00
84a9f6f8bd fix: macos screen capture prompt 2026-02-10 19:40:42 +01:00
d349b226aa chore: regenerate icons 2026-02-10 19:06:59 +01:00
2b934d22f8 feat: logo 2026-02-10 17:54:01 +01:00
d11b3c031b fix: add electron publish script 2026-02-10 08:17:49 +01:00
df57b17e32 chore: add workflow_dispatch 2026-02-10 08:09:47 +01:00
e89774f080 feat: (ai gen) github release workflow 2026-02-10 08:08:48 +01:00
1739142cf3 fix: stuff not right with electron 2026-02-10 08:03:48 +01:00
13cf2b577c feat: (mostly ai gen) electron app for native computer platforms 2026-02-09 21:30:43 +01:00
160fb0d36f feat: agentsmd and change source 2026-01-16 19:36:54 +01:00
ec1f1614a1 fix: localize shared presets page 2026-01-15 20:42:42 +01:00
3b2ded0b7d fix: default shadcn theme 2026-01-14 22:58:12 +01:00
c85c873f84 chore: add copyleft 2026-01-14 22:36:03 +01:00
4732ffe9a1 chore: remove sidebar 2026-01-14 22:25:06 +01:00
c2f843ce4c chore: mobile friendly navbar 2026-01-14 22:24:34 +01:00
8a538347d3 feat: about page 2026-01-14 22:17:07 +01:00
6fe5caef94 chore: add gplv3 license
the following might not be legal to say, but all prior commits are also
considered to be under the GNU GPL v3 license.
2026-01-14 22:11:48 +01:00
0315e72c48 feat: clerk localization and no language routes 2026-01-14 20:00:42 +01:00
613c5b24da feat: add internationalization and spanish locale 2026-01-14 19:23:44 +01:00
80261ad627 fix: more tactile stuff 2026-01-13 22:23:53 +01:00
c70fb7f06e fix: unique constraint on name, and flex redesign 2026-01-13 22:02:40 +01:00
3f92dd2226 chore: update vue to fix 500 error 2026-01-12 23:45:27 +01:00
f80a2bf517 chore: move to normal postgres 2026-01-12 23:23:37 +01:00
fe19883234 chore: (ai gen) drizzle migration fixes 2026-01-12 23:17:03 +01:00
c615bcd7e2 Merge pull request #2 from SrIzan10/feat/clerk
clerk auth and presets and other goodies
2026-01-12 23:10:21 +01:00
b7bc77fb9a chore: (ai gen) run migrations on startup 2026-01-12 23:09:10 +01:00
c8d9a4e132 feat: (mostly ai gen) touchscreen oriented viewer 2026-01-12 23:01:57 +01:00
103644acc3 fix: (ai gen) streaming stability improvementsk 2026-01-12 22:33:07 +01:00
bda1297689 feat: (ai gen) improve website wide navigation 2026-01-12 22:25:04 +01:00
a8b90e62c1 feat: rtc connections finally working 2026-01-12 21:26:38 +01:00
d67dd9e5bf feat: peer stuff 2026-01-11 22:14:05 +01:00
08e44e61ff feat: preliminary sharing 2026-01-11 18:44:37 +01:00
6864748174 refactor: move stuff to presetsDb and start work on sharing 2026-01-11 00:59:55 +01:00
409f32090e feat: preliminary presets index 2026-01-11 00:20:25 +01:00
610a0446a5 chore: protect pages before i forget (and also auth page changes) 2026-01-10 00:38:49 +01:00
9bb77cfa57 feat: make form submissions and start main presets page 2026-01-10 00:14:08 +01:00
76a6a77f1d feat: overengineered form and db schema 2026-01-09 17:00:40 +01:00
91556378b9 feat: basic form and styling (no form logic done yet) 2026-01-08 16:16:25 +01:00
1e4874cffa refactor: move script under template 2026-01-07 23:21:01 +01:00
f429f30983 feat: shadcn color theme change 2026-01-07 20:44:59 +01:00
fbe9ffd246 chore: set json lang 2026-01-07 19:54:32 +01:00
a2436cb6d5 feat: finally a monaco editor 2026-01-07 19:08:52 +01:00
801f30de0b monaco pmo 2026-01-06 18:41:58 +01:00
41da79611c refactor: listen to changes instead of doing onClick 2026-01-03 14:25:58 +01:00
145c3b1136 feat: clerk theming and preset selector 2026-01-03 13:31:10 +01:00
8995979eb1 chore: janky ahh clerk 2026-01-02 19:30:41 +00:00
3b03b32046 feat: move database to postgres 2025-12-20 21:21:10 +00:00
350f88446e feat: debugging inside viewer 2025-11-06 17:11:16 +01:00
b63e3e83aa fix: force relays instead of local connections 2025-11-06 16:34:03 +01:00
953da59ca7 feat: turn servers i found somewhere 2025-11-05 21:00:57 +01:00
5481bae405 fix: wrong urls 2025-11-01 02:08:46 +01:00
ebba9481c6 chore: use peerjs stuff now 2025-11-01 02:04:04 +01:00
2aa36b433b feat: use proper metered stuff 2025-11-01 01:47:12 +01:00
0f3ca69ffc chore: empty testing commit 2025-11-01 01:25:43 +01:00
e8c691729e fix: use openrelay as turn 2025-11-01 01:16:57 +01:00
f8be3f48e7 fix: inexistent import 2025-10-30 21:37:10 +01:00
63d23210b8 chore: remove comments 2025-10-30 12:21:29 +01:00
ffbbf1f94f Merge pull request #1 from SrIzan10/copilot/configure-websocket-connection
[WIP] Add conditional WebSocket connection for development and production
2025-10-30 12:12:18 +01:00
173 changed files with 23490 additions and 1027 deletions

77
.github/workflows/android-release.yml vendored Normal file
View File

@@ -0,0 +1,77 @@
name: Android Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Existing tag to publish the APK to"
required: true
type: string
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-latest
env:
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ secrets.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout selected tag
if: ${{ github.event_name == 'workflow_dispatch' }}
run: git checkout "refs/tags/${{ inputs.tag }}"
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
cache: gradle
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build release APK
run: ./gradlew assembleRelease
working-directory: native-app/android
- name: Prepare APK asset
run: cp native-app/android/app/build/outputs/apk/release/app-release.apk helium-android-${{ env.RELEASE_TAG }}.apk
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: helium-android-${{ env.RELEASE_TAG }}
path: helium-android-${{ env.RELEASE_TAG }}.apk
if-no-files-found: error
- name: Upload APK to GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RELEASE_TAG }}
files: helium-android-${{ env.RELEASE_TAG }}.apk
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

55
.github/workflows/electron-release.yml vendored Normal file
View File

@@ -0,0 +1,55 @@
name: Electron Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-publish:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: linux
- os: windows-latest
target: win
- os: macos-latest
target: mac
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build and publish Electron app
run: pnpm electron:publish:${{ matrix.target }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload dist artifacts
uses: actions/upload-artifact@v4
with:
name: electron-${{ matrix.target }}
path: dist-electron
if-no-files-found: error

14
.gitignore vendored
View File

@@ -6,8 +6,13 @@
.cache .cache
dist dist
# Electron compiled output
electron/dist
dist-electron
# Node dependencies # Node dependencies
node_modules *node_modules/
node_modules/
# Logs # Logs
logs logs
@@ -22,3 +27,10 @@ logs
.env .env
.env.* .env.*
!.env.example !.env.example
*credentials.json
native-app/.expo
native-app/android
native-app/ios
native-app/dist

223
AGENTS.md Normal file
View File

@@ -0,0 +1,223 @@
# Agent Guidelines for Helium
## Project Overview
Helium is a Nuxt 3 application for effortless WebRTC screensharing with:
- **Framework**: Nuxt 4 (Vue 3 + TypeScript)
- **Package Manager**: pnpm
- **Database**: PostgreSQL with Drizzle ORM
- **Auth**: Clerk
- **UI**: shadcn-vue + Tailwind CSS v4
- **State**: Pinia stores
- **i18n**: @nuxtjs/i18n (English & Spanish)
## Build/Dev/Test Commands
### Development
```bash
pnpm dev # Start dev server
pnpm build # Build for production
pnpm preview # Preview production build
pnpm generate # Generate static site
```
### Database
```bash
pnpm db:migrate # Generate and run migrations
```
### UI Components
```bash
pnpm ui:add [component] # Add shadcn-vue component
```
### Running Single Tests
Currently no test framework is configured. If adding tests, recommend Vitest for unit tests and Playwright for e2e.
## Project Structure
```
app/
├── components/ # Vue components
│ ├── app/ # Application-specific components
│ └── ui/ # shadcn-vue UI components
├── composables/ # Vue composables (e.g., useWebSocketUrl)
├── layouts/ # Nuxt layouts
├── lib/ # Utilities, DB schema, types
│ ├── db/ # Database schema and utils
│ ├── schema/ # Zod validation schemas
│ ├── types/ # TypeScript type definitions
│ └── utils/ # Helper functions
├── middleware/ # Route middleware (e.g., auth)
├── pages/ # File-based routing
├── plugins/ # Nuxt plugins
└── state/ # Pinia stores
server/
├── api/ # API endpoints
├── cron/ # Scheduled tasks
└── routes/ # Server routes (e.g., WebSocket)
drizzle/ # Database migrations
i18n/ # Translation files
public/ # Static assets
```
## Code Style Guidelines
### TypeScript
- **Always use TypeScript**: No `.js` files. All code must be typed.
- **Type imports**: Use `import type` for type-only imports
```typescript
import type { PrimitiveProps } from "reka-ui";
import type { HTMLAttributes } from "vue";
```
- **Explicit return types**: Prefer explicit return types for functions
- **No `any`**: Avoid `any` type. Use `unknown` or proper typing
- **Interface vs Type**: Use `interface` for object shapes, `type` for unions/intersections
### Imports
- **Path aliases**: Use `@/` for app directory imports and `~/` for root imports
```typescript
import { cn } from "@/lib/utils";
import { schema } from "~/lib/schema/new-preset";
```
- **Import order**:
1. External packages
2. Vue/Nuxt imports
3. Type imports
4. Internal utilities
5. Components
6. Relative imports
### Vue Components
- **Script Setup**: Always use `<script setup lang="ts">`
- **Props**: Define with TypeScript interfaces
```typescript
interface Props extends PrimitiveProps {
variant?: ButtonVariants["variant"];
size?: ButtonVariants["size"];
class?: HTMLAttributes["class"];
}
const props = withDefaults(defineProps<Props>(), {
as: "button",
});
```
- **Template**: Keep templates clean, extract complex logic to composables
- **Component naming**: PascalCase for components, kebab-case for files in multi-word components
### Naming Conventions
- **Files**:
- Components: PascalCase (e.g., `Button.vue`, `EditPresetDialog.vue`)
- Composables: camelCase starting with `use` (e.g., `useWebSocketUrl.ts`)
- API routes: kebab-case with HTTP method (e.g., `[id].get.ts`, `[id].delete.ts`)
- Database: camelCase for tables (e.g., `schema.ts`, `migrate.ts`)
- **Variables**: camelCase
- **Constants**: UPPER_SNAKE_CASE for true constants, camelCase for config objects
- **Functions**: camelCase, descriptive verbs (e.g., `createPreset`, `getPresetById`)
- **Components**: PascalCase
### Database (Drizzle)
- **Schema location**: `app/lib/db/schema.ts`
- **Relations**: Define relations separately after table definitions
- **Column naming**: camelCase in TypeScript, snake_case in SQL
```typescript
export const presets = pgTable("presets", {
createdBy: text("created_by").notNull(),
createdAt: timestamp("created_at").notNull().defaultNow(),
});
```
- **Migrations**: Always generate migrations with `pnpm db:migrate`
### API Routes (Server)
- **Event handlers**: Use `defineEventHandler`
- **Auth**: Check `event.context.auth()` for authentication
```typescript
const { isAuthenticated, userId } = event.context.auth();
if (!isAuthenticated || !userId) {
throw createError({ statusCode: 401, statusMessage: "Unauthorized" });
}
```
- **Error handling**: Use `createError` for HTTP errors
- **Validation**: Use Zod schemas from `app/lib/schema/`
- **Response format**: Consistent structure with `success` and `data`/`message` fields
```typescript
return {
success: true,
data: preset,
};
```
### Error Handling
- **Server**: Use `createError()` with proper status codes
- **Client**: Use `toast` from `vue-sonner` for user feedback
```typescript
try {
await $fetch("/api/presets", { method: "POST" });
toast.success(t("presetCreatedSuccessfully"));
} catch (error) {
toast.error(t("failedToCreatePreset"));
}
```
- **Validation**: Use Zod with `.safeParse()` and handle errors
- **Always catch promises**: Never leave promises unhandled
### Formatting
- **Indentation**: 2 spaces
- **Quotes**: Double quotes for strings
- **Semicolons**: Optional but consistent within files
- **Line length**: Aim for 80-100 characters, break at 120
- **Trailing commas**: Use in multiline objects/arrays
- **Comments**: Prevent comments where possible, if the code is not understandable by itself.
### State Management
- **Pinia stores**: Located in `app/state/`
- **Store naming**: Descriptive (e.g., `streamer.ts`, `viewer.ts`)
- **Composables**: Prefer composables over stores for simple state
### i18n
- **Always use**: Use `useI18n()` composable for all user-facing strings. That is, you must localize any user-facing text.
```typescript
const { t } = useI18n();
<h1>{{ t('presets') }}</h1>
```
- **Keys**: camelCase (e.g., `createNewPreset`, `deletePresetConfirm`)
- **Files**: `i18n/locales/en.json` and `i18n/locales/es.json`
## Important Notes
- **Authentication**: All protected routes must use auth middleware
- **WebSocket**: Available at `/ws/signaling` for real-time communication
- **Environment**: Use `.env` file (not committed) for DATABASE_URL and Clerk keys
- **Clerk**: Auth provider - use `useAuth()` and `useUser()` composables
- **Styling**: Use Tailwind utility classes, `cn()` helper for conditional classes

View File

@@ -25,6 +25,9 @@ WORKDIR /app
# Only `.output` folder is needed from the build stage # Only `.output` folder is needed from the build stage
COPY --from=build /app/.output/ ./ COPY --from=build /app/.output/ ./
# Copy drizzle migrations folder
COPY --from=build /app/drizzle/ ./drizzle/
# Change the port and host # Change the port and host
ENV PORT=80 ENV PORT=80
ENV HOST=0.0.0.0 ENV HOST=0.0.0.0

674
LICENSE Normal file
View File

@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@@ -1,75 +1,8 @@
# Nuxt Minimal Starter # helium
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more. effortless webrtc screensharing
## Setup # ai usage transparency
Make sure to install dependencies: i maintain full control of the website, while the android and electron apps are "controlled" by the ai.
i, of course, review code, but would like to implement stuff on
```bash
# npm
npm install
# pnpm
pnpm install
# yarn
yarn install
# bun
bun install
```
## Development Server
Start the development server on `http://localhost:3000`:
```bash
# npm
npm run dev
# pnpm
pnpm dev
# yarn
yarn dev
# bun
bun run dev
```
## Production
Build the application for production:
```bash
# npm
npm run build
# pnpm
pnpm build
# yarn
yarn build
# bun
bun run build
```
Locally preview production build:
```bash
# npm
npm run preview
# pnpm
pnpm preview
# yarn
yarn preview
# bun
bun run preview
```
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.

3
app.json Normal file
View File

@@ -0,0 +1,3 @@
{
"expo": {}
}

View File

@@ -1,5 +1,6 @@
@import "tailwindcss"; @import "tailwindcss";
@import "tw-animate-css"; @import "tw-animate-css";
@import "@clerk/themes/shadcn.css";
@custom-variant dark (&:is(.dark *)); @custom-variant dark (&:is(.dark *));
@@ -43,74 +44,59 @@
} }
:root { :root {
--radius: 0.625rem; --radius: 0.5rem;
--background: oklch(1 0 0); --background: oklch(0.959 0.006 264.533);
--foreground: oklch(0.145 0 0); --foreground: oklch(0.431 0.043 279.511);
--card: oklch(1 0 0); --muted: oklch(0.92 0.006 264.531);
--card-foreground: oklch(0.145 0 0); --muted-foreground: oklch(0.406 0.022 264.291);
--popover: oklch(1 0 0); --popover: oklch(0.934 0.009 264.519);
--popover-foreground: oklch(0.145 0 0); --popover-foreground: oklch(0.345 0.032 279.621);
--primary: oklch(0.205 0 0); --card: oklch(0.942 0.008 264.524);
--primary-foreground: oklch(0.985 0 0); --card-foreground: oklch(0.389 0.037 279.559);
--secondary: oklch(0.97 0 0); --border: oklch(0.92 0.006 264.529);
--secondary-foreground: oklch(0.205 0 0); --input: oklch(0.895 0.008 264.52);
--muted: oklch(0.97 0 0); --primary: oklch(0.554 0.25 296.956);
--muted-foreground: oklch(0.556 0 0); --primary-foreground: oklch(1 0 180);
--accent: oklch(0.97 0 0); --secondary: oklch(0.771 0.057 304.762);
--accent-foreground: oklch(0.205 0 0); --secondary-foreground: oklch(0.245 0.044 303.216);
--destructive: oklch(0.577 0.245 27.325); --accent: oklch(0.832 0.023 264.439);
--destructive-foreground: oklch(0.577 0.245 27.325); --accent-foreground: oklch(0.305 0.03 263.965);
--border: oklch(0.922 0 0); --destructive: oklch(0.484 0.188 29.368);
--input: oklch(0.922 0 0); --destructive-foreground: oklch(0.969 0.014 21.071);
--ring: oklch(0.708 0 0); --ring: oklch(0.554 0.25 296.956);
--chart-1: oklch(0.646 0.222 41.116); --chart-1: oklch(0.554 0.25 296.956);
--chart-2: oklch(0.6 0.118 184.704); --chart-2: oklch(0.771 0.057 304.762);
--chart-3: oklch(0.398 0.07 227.392); --chart-3: oklch(0.832 0.023 264.439);
--chart-4: oklch(0.828 0.189 84.429); --chart-4: oklch(0.799 0.049 304.917);
--chart-5: oklch(0.769 0.188 70.08); --chart-5: oklch(0.553 0.256 296.488);
--sidebar: oklch(0.985 0 0);
--sidebar-foreground: oklch(0.145 0 0);
--sidebar-primary: oklch(0.205 0 0);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.97 0 0);
--sidebar-accent-foreground: oklch(0.205 0 0);
--sidebar-border: oklch(0.922 0 0);
--sidebar-ring: oklch(0.708 0 0);
} }
.dark { .dark {
--background: oklch(0.145 0 0); --radius: 0.5rem;
--foreground: oklch(0.985 0 0); --background: oklch(0.244 0.03 283.913);
--card: oklch(0.145 0 0); --foreground: oklch(0.878 0.043 272.094);
--card-foreground: oklch(0.985 0 0); --muted: oklch(0.293 0.021 285.027);
--popover: oklch(0.145 0 0); --muted-foreground: oklch(0.733 0.027 285.71);
--popover-foreground: oklch(0.985 0 0); --popover: oklch(0.216 0.025 284.103);
--primary: oklch(0.985 0 0); --popover-foreground: oklch(0.98 0.007 272.584);
--primary-foreground: oklch(0.205 0 0); --card: oklch(0.225 0.027 284.034);
--secondary: oklch(0.269 0 0); --card-foreground: oklch(0.929 0.024 272.369);
--secondary-foreground: oklch(0.985 0 0); --border: oklch(0.303 0.02 285.14);
--muted: oklch(0.269 0 0); --input: oklch(0.331 0.023 285.098);
--muted-foreground: oklch(0.708 0 0); --primary: oklch(0.787 0.119 304.446);
--accent: oklch(0.269 0 0); --primary-foreground: oklch(0.277 0.139 295.596);
--accent-foreground: oklch(0.985 0 0); --secondary: oklch(0.334 0.068 303.657);
--destructive: oklch(0.396 0.141 25.723); --secondary-foreground: oklch(0.864 0.033 305.939);
--destructive-foreground: oklch(0.637 0.237 25.331); --accent: oklch(0.372 0.055 283.423);
--border: oklch(0.269 0 0); --accent-foreground: oklch(0.91 0.014 286.109);
--input: oklch(0.269 0 0); --destructive: oklch(75.56% 0.13 2.76);
--ring: oklch(0.439 0 0); --destructive-foreground: oklch(1 0 180);
--chart-1: oklch(0.488 0.243 264.376); --ring: oklch(0.787 0.119 304.446);
--chart-2: oklch(0.696 0.17 162.48); --chart-1: oklch(0.787 0.119 304.446);
--chart-3: oklch(0.769 0.188 70.08); --chart-2: oklch(0.334 0.068 303.657);
--chart-4: oklch(0.627 0.265 303.9); --chart-3: oklch(0.372 0.055 283.423);
--chart-5: oklch(0.645 0.246 16.439); --chart-4: oklch(0.359 0.075 303.591);
--sidebar: oklch(0.205 0 0); --chart-5: oklch(0.784 0.123 304.365);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(0.269 0 0);
--sidebar-ring: oklch(0.439 0 0);
} }
@layer base { @layer base {
@@ -123,4 +109,8 @@
h1 { h1 {
@apply scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl; @apply scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl;
} }
} }
.cl-avatarBox {
@apply size-8;
}

18
app/assets/logo.svg Normal file
View File

@@ -0,0 +1,18 @@
<svg xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 176 174"
fill="currentColor"
role="img"
aria-label="Logo">
<path fill-rule="evenodd" d="
M47.0,154.5 L8.5,153.0 L8.5,105.0 L28.0,90.5 L29.0,95.5 L68.0,95.5 L107.5,66.0
L107.5,31.0 L110.0,28.5 L128.0,15.5 L166.0,15.5 L167.5,65.0 L148.0,79.5
L147.0,74.5 L105.0,76.5 L68.5,104.0 L68.5,139.0 Z
M29.0,89.5 L28.5,46.0 L32.0,42.5 L69.0,15.5 L107.5,16.0 L107.5,30.0
L87.5,46.0 L87.0,74.5 L49.0,74.5 Z
M107.0,154.5 L68.5,154.0 L68.5,140.0 L88.5,124.0 L88.5,96.0 L127.0,95.5
L147.0,80.5 L147.5,124.0 Z
"/>
</svg>

After

Width:  |  Height:  |  Size: 611 B

View File

@@ -1,28 +1,88 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue" import { ref, watch } from "vue"
import { Delete } from "lucide-vue-next"
import { import {
PinInput, PinInput,
PinInputGroup, PinInputGroup,
PinInputSlot, PinInputSlot,
} from "@/components/ui/pin-input" } from "@/components/ui/pin-input"
import { Button } from "@/components/ui/button"
import { useViewerStore } from "~/state/viewer"; import { useViewerStore } from "~/state/viewer";
const viewerStore = useViewerStore() const viewerStore = useViewerStore()
const digits = ref<string[]>([])
// Sync local digits with store code
watch(digits, (newDigits) => {
const code = newDigits.join('')
viewerStore.code = code
})
// Also sync if store updates from elsewhere (though unlikely in this flow)
watch(() => viewerStore.code, (newCode) => {
if (newCode !== digits.value.join('')) {
digits.value = newCode.split('')
}
})
const handleNumPad = (num: number) => {
if (digits.value.length < 6) {
digits.value = [...digits.value, num.toString()]
}
}
const handleBackspace = () => {
digits.value = digits.value.slice(0, -1)
}
</script> </script>
<template> <template>
<div> <div class="flex flex-col items-center gap-6">
<PinInput <PinInput
id="pin-input" id="pin-input"
@complete="(viewerStore.code = $event.join(''))" v-model="digits"
type="number"
> >
<PinInputGroup> <PinInputGroup>
<PinInputSlot <PinInputSlot
v-for="(id, index) in 6" v-for="(id, index) in 6"
:key="id" :key="id"
:index="index" :index="index"
class="h-14 w-10 sm:h-16 sm:w-12 text-lg sm:text-xl"
/> />
</PinInputGroup> </PinInputGroup>
</PinInput> </PinInput>
<!-- Touchscreen Numpad -->
<div class="grid grid-cols-3 gap-3 w-full max-w-[280px]">
<Button
v-for="n in 9"
:key="n"
variant="outline"
class="h-14 text-xl font-medium active:scale-95 transition-transform"
@click="handleNumPad(n)"
>
{{ n }}
</Button>
<div class="col-span-1"></div> <!-- Spacer -->
<Button
variant="outline"
class="h-14 text-xl font-medium active:scale-95 transition-transform"
@click="handleNumPad(0)"
>
0
</Button>
<Button
variant="ghost"
class="h-14 active:scale-95 transition-transform hover:bg-destructive/10 hover:text-destructive"
@click="handleBackspace"
:disabled="digits.length === 0"
>
<Delete class="w-6 h-6" />
</Button>
</div>
</div> </div>
</template> </template>

View File

@@ -0,0 +1,56 @@
<template>
<Dialog :open="open" @update:open="$emit('update:open', $event)">
<DialogContent class="sm:max-w-[700px] max-h-[90vh] overflow-y-auto">
<DialogHeader>
<DialogTitle>{{ t('editPreset') }}</DialogTitle>
<DialogDescription>
{{ t('editPresetDescription') }}
</DialogDescription>
</DialogHeader>
<PresetForm
v-if="open"
:initial-values="initialValues"
:preset-id="presetUser.preset.id"
:is-edit="true"
@success="onSuccess"
/>
</DialogContent>
</Dialog>
</template>
<script setup lang="ts">
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import PresetForm from "~/components/app/PresetForm.vue";
const { t } = useI18n();
const props = defineProps<{
open: boolean;
presetUser: any;
}>();
const emit = defineEmits<{
(e: "update:open", value: boolean): void;
(e: "refresh"): void;
}>();
const initialValues = computed(() => ({
name: props.presetUser.preset.name,
iceServers:
typeof props.presetUser.preset.iceServers === "string"
? props.presetUser.preset.iceServers
: JSON.stringify(props.presetUser.preset.iceServers, 2, 2),
default: props.presetUser.isDefault,
}));
function onSuccess() {
emit("update:open", false);
emit("refresh");
}
</script>

View File

@@ -0,0 +1,43 @@
<script setup lang="ts">
import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectTrigger,
SelectValue,
} from "~/components/ui/select";
import { Languages } from "lucide-vue-next";
const { locale, locales, setLocale } = useI18n();
const { t } = useI18n();
const availableLocales = computed(() => locales.value);
const currentLocale = computed({
get: () => locale.value,
set: (value) => {
setLocale(value);
},
});
</script>
<template>
<Select v-model="currentLocale">
<SelectTrigger class="w-[150px]">
<Languages class="mr-2 h-4 w-4" />
<SelectValue :placeholder="t('selectLanguage')" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectItem
v-for="loc in availableLocales"
:key="loc.code"
:value="loc.code"
>
{{ loc.name }}
</SelectItem>
</SelectGroup>
</SelectContent>
</Select>
</template>

View File

@@ -0,0 +1,174 @@
<template>
<div class="flex flex-col">
<form :id="formId" @submit.prevent="form.handleSubmit" class="space-y-6">
<FieldGroup>
<form.Field v-slot="{ field }" name="name">
<Field :data-invalid="isInvalid(field)">
<FieldLabel :for="`${formId}-name`"> {{ t('presetName') }} </FieldLabel>
<Input
:id="`${formId}-name`"
:name="field.name"
:model-value="field.state.value"
:aria-invalid="isInvalid(field)"
placeholder="My ICE Preset"
autocomplete="off"
@blur="field.handleBlur"
@input="field.handleChange($event.target.value)"
/>
<FieldError
v-if="isInvalid(field)"
:errors="field.state.meta.errors"
/>
</Field>
</form.Field>
</FieldGroup>
<form.Field v-slot="{ field }" name="iceServers">
<Field :data-invalid="isInvalid(field)">
<FieldLabel>{{ t('iceServersJson') }}</FieldLabel>
<div
class="h-96 w-full border rounded-md overflow-hidden focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px] transition"
>
<MonacoEditor
:model-value="field.state.value"
:options="editorOptions"
class="h-full w-full"
lang="json"
@update:model-value="field.handleChange"
@blur="field.handleBlur"
/>
</div>
<FieldError
v-if="isInvalid(field)"
:errors="field.state.meta.errors"
/>
</Field>
</form.Field>
<form.Field v-slot="{ field }" name="default">
<Field orientation="horizontal">
<FieldContent>
<FieldLabel :for="`${formId}-default`">
{{ t('setAsDefaultPreset') }}
</FieldLabel>
<FieldDescription>
{{ t('setAsDefaultPresetDescription') }}
</FieldDescription>
</FieldContent>
<Switch
:id="`${formId}-default`"
:model-value="field.state.value"
@update:model-value="field.handleChange"
@blur="field.handleBlur"
/>
</Field>
</form.Field>
<Field orientation="horizontal">
<Button type="submit" :form="formId">{{ t('save') }}</Button>
</Field>
</form>
</div>
</template>
<script setup lang="ts">
import { useForm } from "@tanstack/vue-form";
import { toast } from "vue-sonner";
import { Button } from "@/components/ui/button";
import {
Field,
FieldContent,
FieldDescription,
FieldError,
FieldGroup,
FieldLabel,
} from "~/components/ui/field";
import { Input } from "~/components/ui/input";
import { Switch } from "~/components/ui/switch";
import { schema } from "~/lib/schema/new-preset";
const { t } = useI18n();
const props = defineProps<{
initialValues?: {
name: string;
iceServers: string;
default: boolean;
};
presetId?: string;
isEdit?: boolean;
}>();
const emit = defineEmits<{
(e: "success"): void;
}>();
const formId = computed(() =>
props.isEdit ? `form-edit-preset-${props.presetId}` : "form-new-preset",
);
const editorOptions = {
automaticLayout: true,
fontFamily: "'JetBrains Mono', monospace",
fontSize: 14,
minimap: { enabled: false },
theme: "catppuccin-mocha",
};
if (import.meta.client) {
const monaco = await useMonaco();
if (monaco) {
const mocha = await $fetch("/catppuccin-mocha.json");
monaco.editor.defineTheme("catppuccin-mocha", mocha);
monaco.editor.setTheme("catppuccin-mocha");
}
}
const form = useForm({
defaultValues: props.initialValues || {
name: "",
iceServers:
'[\n\t{ "urls": "stun:stun.l.google.com:19302" }\,\n\t{ "urls": "stun:stun1.l.google.com:19302" }\n]',
default: false,
},
validators: {
onSubmit: schema,
},
onSubmit: async ({ value }) => {
// Parse the JSON string back to an object for submission
const parsedValue = {
...value,
iceServers: JSON.parse(value.iceServers),
};
let url = "/api/presets/create";
let method = "POST";
if (props.isEdit && props.presetId) {
url = `/api/presets/${props.presetId}`;
method = "PUT";
}
try {
const request = await $fetch<{ success: boolean; message: string }>(url, {
method: method as any,
body: JSON.stringify(parsedValue),
});
if (request.success) {
toast.success(
props.isEdit
? t('presetUpdatedSuccessfully')
: t('presetCreatedSuccessfully'),
);
emit("success");
}
} catch (e) {
toast.error(
props.isEdit ? t('failedToUpdatePreset') : t('failedToCreatePreset'),
);
}
},
});
function isInvalid(field: any) {
return field.state.meta.isTouched && !field.state.meta.isValid;
}
</script>

View File

@@ -0,0 +1,109 @@
<script setup lang="ts">
import {
Select,
SelectContent,
SelectItem,
SelectSeparator,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { Plus } from "lucide-vue-next";
import type { ApiResponse, PresetUser } from "~/lib/types/PresetGetResponse";
import { useStreamerStore } from "~/state/streamer";
const { t } = useI18n();
const router = useRouter();
const selectedValue = ref("");
const presets = ref<PresetUser[]>([]);
const loading = ref(true);
const streamerStore = useStreamerStore();
onMounted(async () => {
try {
const response = await $fetch<ApiResponse>("/api/presets");
if (response.success) {
presets.value = response.data;
const defaultPreset = presets.value.find((p) => p.isDefault);
if (defaultPreset) {
selectedValue.value = defaultPreset.presetId;
// Load the default preset's ice servers
loadPresetIceServers(defaultPreset.presetId);
}
}
} catch (error) {
console.error("Failed to fetch presets:", error);
} finally {
loading.value = false;
}
});
async function loadPresetIceServers(presetId: string) {
try {
const response = await $fetch(`/api/presets/${presetId}`);
const preset = response?.data || response;
if (preset && preset.iceServers) {
// Parse ice servers if it's a string
let iceServers = preset.iceServers;
if (typeof iceServers === "string") {
iceServers = JSON.parse(iceServers);
}
// Set the ice servers on the streamer store
streamerStore.setIceServers(iceServers);
}
} catch (error) {
console.error("Failed to load preset ice servers:", error);
}
}
watch(selectedValue, (newValue) => {
if (newValue === "create-new") {
router.push("/presets/new");
selectedValue.value = "";
} else if (newValue) {
// Load ice servers for the selected preset
loadPresetIceServers(newValue);
}
});
</script>
<template>
<Select v-model="selectedValue" :disabled="loading">
<SelectTrigger class="w-[180px]">
<SelectValue
:placeholder="loading ? t('loadingPresets') : t('selectAPreset')"
/>
</SelectTrigger>
<SelectContent>
<div
v-if="presets.length === 0 && !loading"
class="px-2 py-1.5 text-sm text-muted-foreground"
>
{{ t('noPresetsAvailable') }}
</div>
<div v-else-if="!loading">
<div v-for="preset in presets" :key="preset.presetId">
<SelectItem :value="preset.presetId">
<span :class="{ 'font-semibold': preset.isDefault }">
{{ preset.preset.name }}
</span>
<span
v-if="preset.isDefault"
class="ml-2 text-xs text-muted-foreground"
>({{ t('default') }})</span
>
</SelectItem>
</div>
<SelectSeparator />
</div>
<SelectItem value="create-new">
<div class="font-bold flex gap-2 items-center">
<Plus class="size-4" />
{{ t('createNewPreset') }}
</div>
</SelectItem>
</SelectContent>
</Select>
</template>

View File

@@ -0,0 +1,12 @@
<script setup lang="ts">
import { LogIn } from "lucide-vue-next";
import { Button } from "@/components/ui/button";
</script>
<template>
<NuxtLink to="/sign-in">
<Button size="icon">
<LogIn />
</Button>
</NuxtLink>
</template>

View File

@@ -7,12 +7,14 @@ const colorMode = useColorMode()
</script> </script>
<template> <template>
<div class="fixed top-4 right-4 z-50"> <div>
<DropdownMenu> <DropdownMenu>
<DropdownMenuTrigger as-child> <DropdownMenuTrigger as-child>
<Button variant="outline"> <Button size="icon" variant="outline">
<Icon icon="radix-icons:moon" class="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" /> <Icon icon="radix-icons:moon"
<Icon icon="radix-icons:sun" class="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" /> class="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
<Icon icon="radix-icons:sun"
class="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
<span class="sr-only">Toggle theme</span> <span class="sr-only">Toggle theme</span>
</Button> </Button>
</DropdownMenuTrigger> </DropdownMenuTrigger>
@@ -29,4 +31,4 @@ const colorMode = useColorMode()
</DropdownMenuContent> </DropdownMenuContent>
</DropdownMenu> </DropdownMenu>
</div> </div>
</template> </template>

View File

@@ -0,0 +1,26 @@
<script setup lang="ts">
import type { PrimitiveProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import type { BadgeVariants } from "."
import { reactiveOmit } from "@vueuse/core"
import { Primitive } from "reka-ui"
import { cn } from "@/lib/utils"
import { badgeVariants } from "."
const props = defineProps<PrimitiveProps & {
variant?: BadgeVariants["variant"]
class?: HTMLAttributes["class"]
}>()
const delegatedProps = reactiveOmit(props, "class")
</script>
<template>
<Primitive
data-slot="badge"
:class="cn(badgeVariants({ variant }), props.class)"
v-bind="delegatedProps"
>
<slot />
</Primitive>
</template>

View File

@@ -0,0 +1,26 @@
import type { VariantProps } from "class-variance-authority"
import { cva } from "class-variance-authority"
export { default as Badge } from "./Badge.vue"
export const badgeVariants = cva(
"inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
{
variants: {
variant: {
default:
"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
secondary:
"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
destructive:
"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
outline:
"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
},
},
defaultVariants: {
variant: "default",
},
},
)
export type BadgeVariants = VariantProps<typeof badgeVariants>

View File

@@ -0,0 +1,22 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<div
data-slot="card"
:class="
cn(
'bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm',
props.class,
)
"
>
<slot />
</div>
</template>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<div
data-slot="card-action"
:class="cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', props.class)"
>
<slot />
</div>
</template>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<div
data-slot="card-content"
:class="cn('px-6', props.class)"
>
<slot />
</div>
</template>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<p
data-slot="card-description"
:class="cn('text-muted-foreground text-sm', props.class)"
>
<slot />
</p>
</template>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<div
data-slot="card-footer"
:class="cn('flex items-center px-6 [.border-t]:pt-6', props.class)"
>
<slot />
</div>
</template>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<div
data-slot="card-header"
:class="cn('@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6', props.class)"
>
<slot />
</div>
</template>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<h3
data-slot="card-title"
:class="cn('leading-none font-semibold', props.class)"
>
<slot />
</h3>
</template>

View File

@@ -0,0 +1,7 @@
export { default as Card } from "./Card.vue"
export { default as CardAction } from "./CardAction.vue"
export { default as CardContent } from "./CardContent.vue"
export { default as CardDescription } from "./CardDescription.vue"
export { default as CardFooter } from "./CardFooter.vue"
export { default as CardHeader } from "./CardHeader.vue"
export { default as CardTitle } from "./CardTitle.vue"

View File

@@ -0,0 +1,19 @@
<script setup lang="ts">
import type { DialogRootEmits, DialogRootProps } from "reka-ui"
import { DialogRoot, useForwardPropsEmits } from "reka-ui"
const props = defineProps<DialogRootProps>()
const emits = defineEmits<DialogRootEmits>()
const forwarded = useForwardPropsEmits(props, emits)
</script>
<template>
<DialogRoot
v-slot="slotProps"
data-slot="dialog"
v-bind="forwarded"
>
<slot v-bind="slotProps" />
</DialogRoot>
</template>

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
import type { DialogCloseProps } from "reka-ui"
import { DialogClose } from "reka-ui"
const props = defineProps<DialogCloseProps>()
</script>
<template>
<DialogClose
data-slot="dialog-close"
v-bind="props"
>
<slot />
</DialogClose>
</template>

View File

@@ -0,0 +1,53 @@
<script setup lang="ts">
import type { DialogContentEmits, DialogContentProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { X } from "lucide-vue-next"
import {
DialogClose,
DialogContent,
DialogPortal,
useForwardPropsEmits,
} from "reka-ui"
import { cn } from "@/lib/utils"
import DialogOverlay from "./DialogOverlay.vue"
defineOptions({
inheritAttrs: false,
})
const props = withDefaults(defineProps<DialogContentProps & { class?: HTMLAttributes["class"], showCloseButton?: boolean }>(), {
showCloseButton: true,
})
const emits = defineEmits<DialogContentEmits>()
const delegatedProps = reactiveOmit(props, "class")
const forwarded = useForwardPropsEmits(delegatedProps, emits)
</script>
<template>
<DialogPortal>
<DialogOverlay />
<DialogContent
data-slot="dialog-content"
v-bind="{ ...$attrs, ...forwarded }"
:class="
cn(
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
props.class,
)"
>
<slot />
<DialogClose
v-if="showCloseButton"
data-slot="dialog-close"
class="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
>
<X />
<span class="sr-only">Close</span>
</DialogClose>
</DialogContent>
</DialogPortal>
</template>

View File

@@ -0,0 +1,23 @@
<script setup lang="ts">
import type { DialogDescriptionProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { DialogDescription, useForwardProps } from "reka-ui"
import { cn } from "@/lib/utils"
const props = defineProps<DialogDescriptionProps & { class?: HTMLAttributes["class"] }>()
const delegatedProps = reactiveOmit(props, "class")
const forwardedProps = useForwardProps(delegatedProps)
</script>
<template>
<DialogDescription
data-slot="dialog-description"
v-bind="forwardedProps"
:class="cn('text-muted-foreground text-sm', props.class)"
>
<slot />
</DialogDescription>
</template>

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div
data-slot="dialog-footer"
:class="cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', props.class)"
>
<slot />
</div>
</template>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<div
data-slot="dialog-header"
:class="cn('flex flex-col gap-2 text-center sm:text-left', props.class)"
>
<slot />
</div>
</template>

View File

@@ -0,0 +1,21 @@
<script setup lang="ts">
import type { DialogOverlayProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { DialogOverlay } from "reka-ui"
import { cn } from "@/lib/utils"
const props = defineProps<DialogOverlayProps & { class?: HTMLAttributes["class"] }>()
const delegatedProps = reactiveOmit(props, "class")
</script>
<template>
<DialogOverlay
data-slot="dialog-overlay"
v-bind="delegatedProps"
:class="cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80', props.class)"
>
<slot />
</DialogOverlay>
</template>

View File

@@ -0,0 +1,59 @@
<script setup lang="ts">
import type { DialogContentEmits, DialogContentProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { X } from "lucide-vue-next"
import {
DialogClose,
DialogContent,
DialogOverlay,
DialogPortal,
useForwardPropsEmits,
} from "reka-ui"
import { cn } from "@/lib/utils"
defineOptions({
inheritAttrs: false,
})
const props = defineProps<DialogContentProps & { class?: HTMLAttributes["class"] }>()
const emits = defineEmits<DialogContentEmits>()
const delegatedProps = reactiveOmit(props, "class")
const forwarded = useForwardPropsEmits(delegatedProps, emits)
</script>
<template>
<DialogPortal>
<DialogOverlay
class="fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
>
<DialogContent
:class="
cn(
'relative z-50 grid w-full max-w-lg my-8 gap-4 border border-border bg-background p-6 shadow-lg duration-200 sm:rounded-lg md:w-full',
props.class,
)
"
v-bind="{ ...$attrs, ...forwarded }"
@pointer-down-outside="(event) => {
const originalEvent = event.detail.originalEvent;
const target = originalEvent.target as HTMLElement;
if (originalEvent.offsetX > target.clientWidth || originalEvent.offsetY > target.clientHeight) {
event.preventDefault();
}
}"
>
<slot />
<DialogClose
class="absolute top-4 right-4 p-0.5 transition-colors rounded-md hover:bg-secondary"
>
<X class="w-4 h-4" />
<span class="sr-only">Close</span>
</DialogClose>
</DialogContent>
</DialogOverlay>
</DialogPortal>
</template>

View File

@@ -0,0 +1,23 @@
<script setup lang="ts">
import type { DialogTitleProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { DialogTitle, useForwardProps } from "reka-ui"
import { cn } from "@/lib/utils"
const props = defineProps<DialogTitleProps & { class?: HTMLAttributes["class"] }>()
const delegatedProps = reactiveOmit(props, "class")
const forwardedProps = useForwardProps(delegatedProps)
</script>
<template>
<DialogTitle
data-slot="dialog-title"
v-bind="forwardedProps"
:class="cn('text-lg leading-none font-semibold', props.class)"
>
<slot />
</DialogTitle>
</template>

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
import type { DialogTriggerProps } from "reka-ui"
import { DialogTrigger } from "reka-ui"
const props = defineProps<DialogTriggerProps>()
</script>
<template>
<DialogTrigger
data-slot="dialog-trigger"
v-bind="props"
>
<slot />
</DialogTrigger>
</template>

View File

@@ -0,0 +1,10 @@
export { default as Dialog } from "./Dialog.vue"
export { default as DialogClose } from "./DialogClose.vue"
export { default as DialogContent } from "./DialogContent.vue"
export { default as DialogDescription } from "./DialogDescription.vue"
export { default as DialogFooter } from "./DialogFooter.vue"
export { default as DialogHeader } from "./DialogHeader.vue"
export { default as DialogOverlay } from "./DialogOverlay.vue"
export { default as DialogScrollContent } from "./DialogScrollContent.vue"
export { default as DialogTitle } from "./DialogTitle.vue"
export { default as DialogTrigger } from "./DialogTrigger.vue"

View File

@@ -0,0 +1,25 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import type { FieldVariants } from "."
import { cn } from "@/lib/utils"
import { fieldVariants } from "."
const props = defineProps<{
class?: HTMLAttributes["class"]
orientation?: FieldVariants["orientation"]
}>()
</script>
<template>
<div
role="group"
data-slot="field"
:data-orientation="orientation"
:class="cn(
fieldVariants({ orientation }),
props.class,
)"
>
<slot />
</div>
</template>

View File

@@ -0,0 +1,20 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<div
data-slot="field-content"
:class="cn(
'group/field-content flex flex-1 flex-col gap-1.5 leading-snug',
props.class,
)"
>
<slot />
</div>
</template>

View File

@@ -0,0 +1,22 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<p
data-slot="field-description"
:class="cn(
'text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance',
'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',
'[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',
props.class,
)"
>
<slot />
</p>
</template>

View File

@@ -0,0 +1,53 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { computed } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
errors?: Array<string | { message: string | undefined } | undefined>
}>()
const content = computed(() => {
if (!props.errors || props.errors.length === 0)
return null
const uniqueErrors = [
...new Map(
props.errors
.filter(Boolean)
.map((error) => {
const message = typeof error === "string" ? error : error?.message
return [message, error]
}),
).values(),
]
if (uniqueErrors.length === 1 && uniqueErrors[0]) {
return typeof uniqueErrors[0] === "string" ? uniqueErrors[0] : uniqueErrors[0].message
}
return uniqueErrors.map(error => typeof error === "string" ? error : error?.message)
})
</script>
<template>
<div
v-if="$slots.default || content"
role="alert"
data-slot="field-error"
:class="cn('text-destructive text-sm font-normal', props.class)"
>
<slot v-if="$slots.default" />
<template v-else-if="typeof content === 'string'">
{{ content }}
</template>
<ul v-else-if="Array.isArray(content)" class="ml-4 flex list-disc flex-col gap-1">
<li v-for="(error, index) in content" :key="index">
{{ error }}
</li>
</ul>
</div>
</template>

View File

@@ -0,0 +1,20 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<div
data-slot="field-group"
:class="cn(
'group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4',
props.class,
)"
>
<slot />
</div>
</template>

View File

@@ -0,0 +1,23 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
import { Label } from '@/components/ui/label'
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<Label
data-slot="field-label"
:class="cn(
'group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50',
'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4',
'has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10',
props.class,
)"
>
<slot />
</Label>
</template>

View File

@@ -0,0 +1,24 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
variant?: "legend" | "label"
}>()
</script>
<template>
<legend
data-slot="field-legend"
:data-variant="variant"
:class="cn(
'mb-3 font-medium',
'data-[variant=legend]:text-base',
'data-[variant=label]:text-sm',
props.class,
)"
>
<slot />
</legend>
</template>

View File

@@ -0,0 +1,29 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
import { Separator } from '@/components/ui/separator'
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<div
data-slot="field-separator"
:data-content="!!$slots.default"
:class="cn(
'relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2',
props.class,
)"
>
<Separator class="absolute inset-0 top-1/2" />
<span
v-if="$slots.default"
class="bg-background text-muted-foreground relative mx-auto block w-fit px-2"
data-slot="field-separator-content"
>
<slot />
</span>
</div>
</template>

View File

@@ -0,0 +1,21 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<fieldset
data-slot="field-set"
:class="cn(
'flex flex-col gap-6',
'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',
props.class,
)"
>
<slot />
</fieldset>
</template>

View File

@@ -0,0 +1,20 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<div
data-slot="field-label"
:class="cn(
'flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50',
props.class,
)"
>
<slot />
</div>
</template>

View File

@@ -0,0 +1,39 @@
import type { VariantProps } from "class-variance-authority"
import { cva } from "class-variance-authority"
export const fieldVariants = cva(
"group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
{
variants: {
orientation: {
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
horizontal: [
"flex-row items-center",
"[&>[data-slot=field-label]]:flex-auto",
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
],
responsive: [
"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
],
},
},
defaultVariants: {
orientation: "vertical",
},
},
)
export type FieldVariants = VariantProps<typeof fieldVariants>
export { default as Field } from "./Field.vue"
export { default as FieldContent } from "./FieldContent.vue"
export { default as FieldDescription } from "./FieldDescription.vue"
export { default as FieldError } from "./FieldError.vue"
export { default as FieldGroup } from "./FieldGroup.vue"
export { default as FieldLabel } from "./FieldLabel.vue"
export { default as FieldLegend } from "./FieldLegend.vue"
export { default as FieldSeparator } from "./FieldSeparator.vue"
export { default as FieldSet } from "./FieldSet.vue"
export { default as FieldTitle } from "./FieldTitle.vue"

View File

@@ -0,0 +1,33 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { useVModel } from "@vueuse/core"
import { cn } from "@/lib/utils"
const props = defineProps<{
defaultValue?: string | number
modelValue?: string | number
class?: HTMLAttributes["class"]
}>()
const emits = defineEmits<{
(e: "update:modelValue", payload: string | number): void
}>()
const modelValue = useVModel(props, "modelValue", emits, {
passive: true,
defaultValue: props.defaultValue,
})
</script>
<template>
<input
v-model="modelValue"
data-slot="input"
:class="cn(
'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
props.class,
)"
>
</template>

View File

@@ -0,0 +1 @@
export { default as Input } from "./Input.vue"

View File

@@ -0,0 +1,26 @@
<script setup lang="ts">
import type { LabelProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { Label } from "reka-ui"
import { cn } from "@/lib/utils"
const props = defineProps<LabelProps & { class?: HTMLAttributes["class"] }>()
const delegatedProps = reactiveOmit(props, "class")
</script>
<template>
<Label
data-slot="label"
v-bind="delegatedProps"
:class="
cn(
'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
props.class,
)
"
>
<slot />
</Label>
</template>

View File

@@ -0,0 +1 @@
export { default as Label } from "./Label.vue"

View File

@@ -0,0 +1,19 @@
<script setup lang="ts">
import type { SelectRootEmits, SelectRootProps } from "reka-ui"
import { SelectRoot, useForwardPropsEmits } from "reka-ui"
const props = defineProps<SelectRootProps>()
const emits = defineEmits<SelectRootEmits>()
const forwarded = useForwardPropsEmits(props, emits)
</script>
<template>
<SelectRoot
v-slot="slotProps"
data-slot="select"
v-bind="forwarded"
>
<slot v-bind="slotProps" />
</SelectRoot>
</template>

View File

@@ -0,0 +1,51 @@
<script setup lang="ts">
import type { SelectContentEmits, SelectContentProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import {
SelectContent,
SelectPortal,
SelectViewport,
useForwardPropsEmits,
} from "reka-ui"
import { cn } from "@/lib/utils"
import { SelectScrollDownButton, SelectScrollUpButton } from "."
defineOptions({
inheritAttrs: false,
})
const props = withDefaults(
defineProps<SelectContentProps & { class?: HTMLAttributes["class"] }>(),
{
position: "popper",
},
)
const emits = defineEmits<SelectContentEmits>()
const delegatedProps = reactiveOmit(props, "class")
const forwarded = useForwardPropsEmits(delegatedProps, emits)
</script>
<template>
<SelectPortal>
<SelectContent
data-slot="select-content"
v-bind="{ ...$attrs, ...forwarded }"
:class="cn(
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--reka-select-content-available-height) min-w-[8rem] overflow-x-hidden overflow-y-auto rounded-md border shadow-md',
position === 'popper'
&& 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
props.class,
)
"
>
<SelectScrollUpButton />
<SelectViewport :class="cn('p-1', position === 'popper' && 'h-[var(--reka-select-trigger-height)] w-full min-w-[var(--reka-select-trigger-width)] scroll-my-1')">
<slot />
</SelectViewport>
<SelectScrollDownButton />
</SelectContent>
</SelectPortal>
</template>

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
import type { SelectGroupProps } from "reka-ui"
import { SelectGroup } from "reka-ui"
const props = defineProps<SelectGroupProps>()
</script>
<template>
<SelectGroup
data-slot="select-group"
v-bind="props"
>
<slot />
</SelectGroup>
</template>

View File

@@ -0,0 +1,44 @@
<script setup lang="ts">
import type { SelectItemProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { Check } from "lucide-vue-next"
import {
SelectItem,
SelectItemIndicator,
SelectItemText,
useForwardProps,
} from "reka-ui"
import { cn } from "@/lib/utils"
const props = defineProps<SelectItemProps & { class?: HTMLAttributes["class"] }>()
const delegatedProps = reactiveOmit(props, "class")
const forwardedProps = useForwardProps(delegatedProps)
</script>
<template>
<SelectItem
data-slot="select-item"
v-bind="forwardedProps"
:class="
cn(
'focus:bg-accent focus:text-accent-foreground [&_svg:not([class*=\'text-\'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2',
props.class,
)
"
>
<span class="absolute right-2 flex size-3.5 items-center justify-center">
<SelectItemIndicator>
<slot name="indicator-icon">
<Check class="size-4" />
</slot>
</SelectItemIndicator>
</span>
<SelectItemText>
<slot />
</SelectItemText>
</SelectItem>
</template>

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
import type { SelectItemTextProps } from "reka-ui"
import { SelectItemText } from "reka-ui"
const props = defineProps<SelectItemTextProps>()
</script>
<template>
<SelectItemText
data-slot="select-item-text"
v-bind="props"
>
<slot />
</SelectItemText>
</template>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
import type { SelectLabelProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { SelectLabel } from "reka-ui"
import { cn } from "@/lib/utils"
const props = defineProps<SelectLabelProps & { class?: HTMLAttributes["class"] }>()
</script>
<template>
<SelectLabel
data-slot="select-label"
:class="cn('text-muted-foreground px-2 py-1.5 text-xs', props.class)"
>
<slot />
</SelectLabel>
</template>

View File

@@ -0,0 +1,26 @@
<script setup lang="ts">
import type { SelectScrollDownButtonProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { ChevronDown } from "lucide-vue-next"
import { SelectScrollDownButton, useForwardProps } from "reka-ui"
import { cn } from "@/lib/utils"
const props = defineProps<SelectScrollDownButtonProps & { class?: HTMLAttributes["class"] }>()
const delegatedProps = reactiveOmit(props, "class")
const forwardedProps = useForwardProps(delegatedProps)
</script>
<template>
<SelectScrollDownButton
data-slot="select-scroll-down-button"
v-bind="forwardedProps"
:class="cn('flex cursor-default items-center justify-center py-1', props.class)"
>
<slot>
<ChevronDown class="size-4" />
</slot>
</SelectScrollDownButton>
</template>

View File

@@ -0,0 +1,26 @@
<script setup lang="ts">
import type { SelectScrollUpButtonProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { ChevronUp } from "lucide-vue-next"
import { SelectScrollUpButton, useForwardProps } from "reka-ui"
import { cn } from "@/lib/utils"
const props = defineProps<SelectScrollUpButtonProps & { class?: HTMLAttributes["class"] }>()
const delegatedProps = reactiveOmit(props, "class")
const forwardedProps = useForwardProps(delegatedProps)
</script>
<template>
<SelectScrollUpButton
data-slot="select-scroll-up-button"
v-bind="forwardedProps"
:class="cn('flex cursor-default items-center justify-center py-1', props.class)"
>
<slot>
<ChevronUp class="size-4" />
</slot>
</SelectScrollUpButton>
</template>

View File

@@ -0,0 +1,19 @@
<script setup lang="ts">
import type { SelectSeparatorProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { SelectSeparator } from "reka-ui"
import { cn } from "@/lib/utils"
const props = defineProps<SelectSeparatorProps & { class?: HTMLAttributes["class"] }>()
const delegatedProps = reactiveOmit(props, "class")
</script>
<template>
<SelectSeparator
data-slot="select-separator"
v-bind="delegatedProps"
:class="cn('bg-border pointer-events-none -mx-1 my-1 h-px', props.class)"
/>
</template>

View File

@@ -0,0 +1,33 @@
<script setup lang="ts">
import type { SelectTriggerProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { ChevronDown } from "lucide-vue-next"
import { SelectIcon, SelectTrigger, useForwardProps } from "reka-ui"
import { cn } from "@/lib/utils"
const props = withDefaults(
defineProps<SelectTriggerProps & { class?: HTMLAttributes["class"], size?: "sm" | "default" }>(),
{ size: "default" },
)
const delegatedProps = reactiveOmit(props, "class", "size")
const forwardedProps = useForwardProps(delegatedProps)
</script>
<template>
<SelectTrigger
data-slot="select-trigger"
:data-size="size"
v-bind="forwardedProps"
:class="cn(
'border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*=\'text-\'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4',
props.class,
)"
>
<slot />
<SelectIcon as-child>
<ChevronDown class="size-4 opacity-50" />
</SelectIcon>
</SelectTrigger>
</template>

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
import type { SelectValueProps } from "reka-ui"
import { SelectValue } from "reka-ui"
const props = defineProps<SelectValueProps>()
</script>
<template>
<SelectValue
data-slot="select-value"
v-bind="props"
>
<slot />
</SelectValue>
</template>

View File

@@ -0,0 +1,11 @@
export { default as Select } from "./Select.vue"
export { default as SelectContent } from "./SelectContent.vue"
export { default as SelectGroup } from "./SelectGroup.vue"
export { default as SelectItem } from "./SelectItem.vue"
export { default as SelectItemText } from "./SelectItemText.vue"
export { default as SelectLabel } from "./SelectLabel.vue"
export { default as SelectScrollDownButton } from "./SelectScrollDownButton.vue"
export { default as SelectScrollUpButton } from "./SelectScrollUpButton.vue"
export { default as SelectSeparator } from "./SelectSeparator.vue"
export { default as SelectTrigger } from "./SelectTrigger.vue"
export { default as SelectValue } from "./SelectValue.vue"

View File

@@ -0,0 +1,29 @@
<script setup lang="ts">
import type { SeparatorProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { Separator } from "reka-ui"
import { cn } from "@/lib/utils"
const props = withDefaults(defineProps<
SeparatorProps & { class?: HTMLAttributes["class"] }
>(), {
orientation: "horizontal",
decorative: true,
})
const delegatedProps = reactiveOmit(props, "class")
</script>
<template>
<Separator
data-slot="separator"
v-bind="delegatedProps"
:class="
cn(
'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
props.class,
)
"
/>
</template>

View File

@@ -0,0 +1 @@
export { default as Separator } from "./Separator.vue"

View File

@@ -0,0 +1,19 @@
<script setup lang="ts">
import type { DialogRootEmits, DialogRootProps } from "reka-ui"
import { DialogRoot, useForwardPropsEmits } from "reka-ui"
const props = defineProps<DialogRootProps>()
const emits = defineEmits<DialogRootEmits>()
const forwarded = useForwardPropsEmits(props, emits)
</script>
<template>
<DialogRoot
v-slot="slotProps"
data-slot="sheet"
v-bind="forwarded"
>
<slot v-bind="slotProps" />
</DialogRoot>
</template>

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
import type { DialogCloseProps } from "reka-ui"
import { DialogClose } from "reka-ui"
const props = defineProps<DialogCloseProps>()
</script>
<template>
<DialogClose
data-slot="sheet-close"
v-bind="props"
>
<slot />
</DialogClose>
</template>

View File

@@ -0,0 +1,62 @@
<script setup lang="ts">
import type { DialogContentEmits, DialogContentProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { X } from "lucide-vue-next"
import {
DialogClose,
DialogContent,
DialogPortal,
useForwardPropsEmits,
} from "reka-ui"
import { cn } from "@/lib/utils"
import SheetOverlay from "./SheetOverlay.vue"
interface SheetContentProps extends DialogContentProps {
class?: HTMLAttributes["class"]
side?: "top" | "right" | "bottom" | "left"
}
defineOptions({
inheritAttrs: false,
})
const props = withDefaults(defineProps<SheetContentProps>(), {
side: "right",
})
const emits = defineEmits<DialogContentEmits>()
const delegatedProps = reactiveOmit(props, "class", "side")
const forwarded = useForwardPropsEmits(delegatedProps, emits)
</script>
<template>
<DialogPortal>
<SheetOverlay />
<DialogContent
data-slot="sheet-content"
:class="cn(
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
side === 'right'
&& 'data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm',
side === 'left'
&& 'data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm',
side === 'top'
&& 'data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b',
side === 'bottom'
&& 'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',
props.class)"
v-bind="{ ...$attrs, ...forwarded }"
>
<slot />
<DialogClose
class="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none"
>
<X class="size-4" />
<span class="sr-only">Close</span>
</DialogClose>
</DialogContent>
</DialogPortal>
</template>

View File

@@ -0,0 +1,21 @@
<script setup lang="ts">
import type { DialogDescriptionProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { DialogDescription } from "reka-ui"
import { cn } from "@/lib/utils"
const props = defineProps<DialogDescriptionProps & { class?: HTMLAttributes["class"] }>()
const delegatedProps = reactiveOmit(props, "class")
</script>
<template>
<DialogDescription
data-slot="sheet-description"
:class="cn('text-muted-foreground text-sm', props.class)"
v-bind="delegatedProps"
>
<slot />
</DialogDescription>
</template>

View File

@@ -0,0 +1,16 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div
data-slot="sheet-footer"
:class="cn('mt-auto flex flex-col gap-2 p-4', props.class)
"
>
<slot />
</div>
</template>

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div
data-slot="sheet-header"
:class="cn('flex flex-col gap-1.5 p-4', props.class)"
>
<slot />
</div>
</template>

View File

@@ -0,0 +1,21 @@
<script setup lang="ts">
import type { DialogOverlayProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { DialogOverlay } from "reka-ui"
import { cn } from "@/lib/utils"
const props = defineProps<DialogOverlayProps & { class?: HTMLAttributes["class"] }>()
const delegatedProps = reactiveOmit(props, "class")
</script>
<template>
<DialogOverlay
data-slot="sheet-overlay"
:class="cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80', props.class)"
v-bind="delegatedProps"
>
<slot />
</DialogOverlay>
</template>

View File

@@ -0,0 +1,21 @@
<script setup lang="ts">
import type { DialogTitleProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { DialogTitle } from "reka-ui"
import { cn } from "@/lib/utils"
const props = defineProps<DialogTitleProps & { class?: HTMLAttributes["class"] }>()
const delegatedProps = reactiveOmit(props, "class")
</script>
<template>
<DialogTitle
data-slot="sheet-title"
:class="cn('text-foreground font-semibold', props.class)"
v-bind="delegatedProps"
>
<slot />
</DialogTitle>
</template>

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
import type { DialogTriggerProps } from "reka-ui"
import { DialogTrigger } from "reka-ui"
const props = defineProps<DialogTriggerProps>()
</script>
<template>
<DialogTrigger
data-slot="sheet-trigger"
v-bind="props"
>
<slot />
</DialogTrigger>
</template>

View File

@@ -0,0 +1,8 @@
export { default as Sheet } from "./Sheet.vue"
export { default as SheetClose } from "./SheetClose.vue"
export { default as SheetContent } from "./SheetContent.vue"
export { default as SheetDescription } from "./SheetDescription.vue"
export { default as SheetFooter } from "./SheetFooter.vue"
export { default as SheetHeader } from "./SheetHeader.vue"
export { default as SheetTitle } from "./SheetTitle.vue"
export { default as SheetTrigger } from "./SheetTrigger.vue"

View File

@@ -1,19 +1,42 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { ToasterProps } from "vue-sonner" import type { ToasterProps } from "vue-sonner"
import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon, XIcon } from "lucide-vue-next"
import { Toaster as Sonner } from "vue-sonner" import { Toaster as Sonner } from "vue-sonner"
import { cn } from "@/lib/utils"
const props = defineProps<ToasterProps>() const props = defineProps<ToasterProps>()
</script> </script>
<template> <template>
<Sonner <Sonner
class="toaster group" :class="cn('toaster group', props.class)"
v-bind="props"
:style="{ :style="{
'--normal-bg': 'var(--popover)', '--normal-bg': 'var(--popover)',
'--normal-text': 'var(--popover-foreground)', '--normal-text': 'var(--popover-foreground)',
'--normal-border': 'var(--border)', '--normal-border': 'var(--border)',
'--border-radius': 'var(--radius)',
}" }"
/> v-bind="props"
>
<template #success-icon>
<CircleCheckIcon class="size-4" />
</template>
<template #info-icon>
<InfoIcon class="size-4" />
</template>
<template #warning-icon>
<TriangleAlertIcon class="size-4" />
</template>
<template #error-icon>
<OctagonXIcon class="size-4" />
</template>
<template #loading-icon>
<div>
<Loader2Icon class="size-4 animate-spin" />
</div>
</template>
<template #close-icon>
<XIcon class="size-4" />
</template>
</Sonner>
</template> </template>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { Loader2Icon } from "lucide-vue-next"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<Loader2Icon
role="status"
aria-label="Loading"
:class="cn('size-4 animate-spin', props.class)"
/>
</template>

View File

@@ -0,0 +1 @@
export { default as Spinner } from "./Spinner.vue"

View File

@@ -0,0 +1,38 @@
<script setup lang="ts">
import type { SwitchRootEmits, SwitchRootProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import {
SwitchRoot,
SwitchThumb,
useForwardPropsEmits,
} from "reka-ui"
import { cn } from "@/lib/utils"
const props = defineProps<SwitchRootProps & { class?: HTMLAttributes["class"] }>()
const emits = defineEmits<SwitchRootEmits>()
const delegatedProps = reactiveOmit(props, "class")
const forwarded = useForwardPropsEmits(delegatedProps, emits)
</script>
<template>
<SwitchRoot
v-slot="slotProps"
data-slot="switch"
v-bind="forwarded"
:class="cn(
'peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
props.class,
)"
>
<SwitchThumb
data-slot="switch-thumb"
:class="cn('bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0')"
>
<slot name="thumb" v-bind="slotProps" />
</SwitchThumb>
</SwitchRoot>
</template>

View File

@@ -0,0 +1 @@
export { default as Switch } from "./Switch.vue"

View File

@@ -0,0 +1,278 @@
export interface PlatformInfo {
platform: string;
isLinux: boolean;
isMac: boolean;
isWindows: boolean;
isElectron: boolean;
supportsLoopbackAudio: boolean;
supportsVenmic: boolean;
}
export interface DesktopSource {
id: string;
name: string;
thumbnail: string;
appIcon: string | null;
display_id?: string;
}
export interface VenmicLinkOptions {
include?: Record<string, string>[];
exclude?: Record<string, string>[];
ignore_devices?: boolean;
only_speakers?: boolean;
only_default_speakers?: boolean;
}
interface HeliumElectronAPI {
isElectron: boolean;
getPlatform: () => Promise<PlatformInfo>;
getSources: () => Promise<DesktopSource[]>;
onSourcesAvailable: (callback: (sources: DesktopSource[]) => void) => void;
selectSource: (sourceId: string | null) => void;
removeSourcesListener: () => void;
venmicAvailable: () => Promise<boolean>;
venmicList: () => Promise<Record<string, string>[]>;
venmicLink: (options: VenmicLinkOptions) => Promise<boolean>;
venmicUnlink: () => Promise<boolean>;
checkScreenPermission: () => Promise<string>;
openScreenPermissionSettings: () => Promise<boolean>;
}
declare global {
interface Window {
heliumElectron?: HeliumElectronAPI;
}
}
export function useElectron() {
const isElectron = ref(false);
const platformInfo = ref<PlatformInfo | null>(null);
const audioSources = ref<Record<string, string>[]>([]);
const isVenmicLinked = ref(false);
const checkElectron = () => {
if (import.meta.client) {
isElectron.value = !!window.heliumElectron?.isElectron;
}
return isElectron.value;
};
const getPlatformInfo = async (): Promise<PlatformInfo | null> => {
if (!checkElectron()) {
return {
platform: 'browser',
isLinux: false,
isMac: false,
isWindows: false,
isElectron: false,
supportsLoopbackAudio: false,
supportsVenmic: false,
};
}
try {
platformInfo.value = await window.heliumElectron!.getPlatform();
return platformInfo.value;
} catch (error) {
console.error('[useElectron] Failed to get platform info:', error);
return null;
}
};
const getDesktopSources = async (): Promise<DesktopSource[]> => {
if (!checkElectron()) return [];
try {
return await window.heliumElectron!.getSources();
} catch (error) {
console.error('[useElectron] Failed to get sources:', error);
return [];
}
};
const onSourcesAvailable = (callback: (sources: DesktopSource[]) => void) => {
if (!checkElectron()) return;
window.heliumElectron!.onSourcesAvailable(callback);
};
const selectSource = (sourceId: string | null) => {
if (!checkElectron()) return;
window.heliumElectron!.selectSource(sourceId);
};
const removeSourcesListener = () => {
if (!checkElectron()) return;
window.heliumElectron!.removeSourcesListener();
};
const isVenmicAvailable = async (): Promise<boolean> => {
if (!checkElectron()) return false;
try {
return await window.heliumElectron!.venmicAvailable();
} catch {
return false;
}
};
const getVenmicSources = async (): Promise<Record<string, string>[]> => {
if (!checkElectron()) return [];
try {
const sources = await window.heliumElectron!.venmicList();
audioSources.value = sources;
return sources;
} catch (error) {
console.error('[useElectron] Failed to list venmic sources:', error);
return [];
}
};
const linkVenmicAudio = async (options: VenmicLinkOptions = {}): Promise<boolean> => {
if (!checkElectron()) return false;
try {
const success = await window.heliumElectron!.venmicLink(options);
isVenmicLinked.value = success;
return success;
} catch (error) {
console.error('[useElectron] Failed to link venmic:', error);
return false;
}
};
const linkAllAudio = async (): Promise<boolean> => {
return linkVenmicAudio({
exclude: [],
ignore_devices: true,
only_speakers: true,
only_default_speakers: false,
});
};
const linkAppAudio = async (appName: string): Promise<boolean> => {
return linkVenmicAudio({
include: [{ 'application.name': appName }],
});
};
const unlinkVenmicAudio = async (): Promise<boolean> => {
if (!checkElectron()) return false;
try {
const success = await window.heliumElectron!.venmicUnlink();
isVenmicLinked.value = !success;
return success;
} catch (error) {
console.error('[useElectron] Failed to unlink venmic:', error);
return false;
}
};
const startScreenShareWithAudio = async (options: {
video?: boolean | MediaTrackConstraints;
audioSource?: 'all' | 'none' | string;
} = {}): Promise<MediaStream | null> => {
const { video = true, audioSource = 'all' } = options;
const platform = await getPlatformInfo();
try {
if (platform?.isLinux && platform.supportsVenmic && audioSource !== 'none') {
if (audioSource === 'all') {
await linkAllAudio();
} else {
await linkAppAudio(audioSource);
}
}
const stream = await navigator.mediaDevices.getDisplayMedia({
video,
audio: audioSource !== 'none',
});
return stream;
} catch (error) {
console.error('[useElectron] Failed to start screen share:', error);
if (platform?.isLinux && isVenmicLinked.value) {
await unlinkVenmicAudio();
}
return null;
}
};
const stopScreenShare = async (stream: MediaStream | null) => {
if (stream) {
stream.getTracks().forEach(track => track.stop());
}
const platform = platformInfo.value;
if (platform?.isLinux && isVenmicLinked.value) {
await unlinkVenmicAudio();
}
};
const supportsAudioScreenShare = computed(() => {
if (!platformInfo.value) return false;
return platformInfo.value.supportsLoopbackAudio || platformInfo.value.supportsVenmic;
});
const getScreenPermissionStatus = async (): Promise<string> => {
if (!checkElectron()) return "granted";
try {
return await window.heliumElectron!.checkScreenPermission();
} catch (error) {
console.error("[useElectron] Failed to check screen permission:", error);
return "unknown";
}
};
const openScreenPermissionSettings = async (): Promise<boolean> => {
if (!checkElectron()) return false;
try {
return await window.heliumElectron!.openScreenPermissionSettings();
} catch (error) {
console.error("[useElectron] Failed to open screen permission settings:", error);
return false;
}
};
onMounted(() => {
checkElectron();
if (isElectron.value) {
getPlatformInfo();
}
});
onUnmounted(() => {
removeSourcesListener();
if (isVenmicLinked.value) {
unlinkVenmicAudio();
}
});
return {
isElectron: readonly(isElectron),
platformInfo: readonly(platformInfo),
audioSources: readonly(audioSources),
isVenmicLinked: readonly(isVenmicLinked),
supportsAudioScreenShare,
checkElectron,
getPlatformInfo,
getDesktopSources,
onSourcesAvailable,
selectSource,
removeSourcesListener,
isVenmicAvailable,
getVenmicSources,
linkVenmicAudio,
linkAllAudio,
linkAppAudio,
unlinkVenmicAudio,
getScreenPermissionStatus,
openScreenPermissionSettings,
startScreenShareWithAudio,
stopScreenShare,
};
}

View File

@@ -1,21 +1,9 @@
export const useWebSocketUrl = () => { export const useWebSocketUrl = () => {
// Detect environment based on hostname
// In production (helium.srizan.dev), use wss://
// In development (localhost), use ws://
if (import.meta.client) { if (import.meta.client) {
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:' const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
const host = window.location.host const host = window.location.host
return `${protocol}//${host}/ws/signaling` return `${protocol}//${host}/ws/signaling`
} }
// Server-side: This shouldn't be used since WebSocket connections are client-only return ''
// But we provide a sensible default for SSR hydration
const config = useRuntimeConfig()
const isDev = process.dev
if (isDev) {
return 'ws://localhost:3000/ws/signaling'
}
return 'wss://helium.srizan.dev/ws/signaling'
} }

View File

@@ -1,11 +1,163 @@
<script setup lang="ts"> <script setup lang="ts">
import ThemeDropdown from '~/components/ui/ThemeDropdown.vue'; import SignInDialog from "~/components/app/SignInDialog.vue";
import ThemeDropdown from "~/components/ui/ThemeDropdown.vue";
import LanguageSwitcher from "~/components/app/LanguageSwitcher.vue";
import { useElectron } from "~/composables/useElectron";
import "vue-sonner/style.css";
import { Toaster } from "@/components/ui/sonner";
import {
Sheet,
SheetContent,
SheetHeader,
SheetTitle,
SheetTrigger,
} from "@/components/ui/sheet";
import { Menu } from "lucide-vue-next";
import LogoSvg from "~/assets/logo.svg?component";
const { t } = useI18n();
const mobileMenuOpen = ref(false);
const { isElectron, platformInfo, getPlatformInfo } = useElectron();
const isMacElectron = computed(() => {
return isElectron.value && platformInfo.value?.isMac;
});
onMounted(async () => {
if (isElectron.value && !platformInfo.value) {
await getPlatformInfo();
}
});
const navLinks = [
{ to: "/", label: "home" },
{ to: "/stream", label: "stream" },
{ to: "/about", label: "about" },
{ to: "/downloads", label: "downloads" },
{ to: "/presets", label: "presets", requiresAuth: true },
];
</script> </script>
<template> <template>
<div> <div>
<ThemeDropdown /> <header
class="flex justify-between items-center p-4"
:class="isMacElectron ? 'pl-24 [-webkit-app-region:drag] select-none' : ''"
>
<div
class="flex items-center space-x-4 md:space-x-6"
:class="isMacElectron ? '[-webkit-app-region:no-drag]' : ''"
>
<NuxtLink
to="/"
class="inline-flex items-center gap-2 text-lg font-semibold leading-none hover:opacity-80 transition-opacity"
>
<LogoSvg class="block w-8 h-8 shrink-0" />
<span class="leading-none">helium</span>
</NuxtLink>
<nav class="hidden md:flex space-x-4">
<template v-for="link in navLinks" :key="link.to">
<ClientOnly v-if="link.requiresAuth">
<SignedIn>
<NuxtLink
:to="link.to"
class="text-sm font-medium hover:text-primary transition-colors"
active-class="text-primary"
>
{{ t(link.label) }}
</NuxtLink>
</SignedIn>
</ClientOnly>
<NuxtLink
v-else
:to="link.to"
class="text-sm font-medium hover:text-primary transition-colors"
active-class="text-primary"
>
{{ t(link.label) }}
</NuxtLink>
</template>
</nav>
</div>
<div
class="hidden md:flex items-center space-x-4"
:class="isMacElectron ? '[-webkit-app-region:no-drag]' : ''"
>
<LanguageSwitcher />
<ThemeDropdown />
<ClientOnly>
<SignedOut>
<SignInDialog />
</SignedOut>
<SignedIn>
<UserButton />
</SignedIn>
</ClientOnly>
</div>
<div
class="md:hidden"
:class="isMacElectron ? '[-webkit-app-region:no-drag]' : ''"
>
<Sheet v-model:open="mobileMenuOpen">
<SheetTrigger as-child>
<button
class="p-2 hover:bg-muted rounded-md transition-colors"
aria-label="Toggle menu"
>
<Menu class="w-6 h-6" />
</button>
</SheetTrigger>
<SheetContent side="right" class="w-[300px] sm:w-[400px]">
<SheetHeader>
<SheetTitle>{{ t("menu") || "Menu" }}</SheetTitle>
</SheetHeader>
<nav class="flex flex-col space-y-4 mt-6">
<template v-for="link in navLinks" :key="link.to">
<ClientOnly v-if="link.requiresAuth">
<SignedIn>
<NuxtLink
:to="link.to"
class="text-sm font-medium hover:text-primary transition-colors py-2"
active-class="text-primary"
@click="mobileMenuOpen = false"
>
{{ t(link.label) }}
</NuxtLink>
</SignedIn>
</ClientOnly>
<NuxtLink
v-else
:to="link.to"
class="text-sm font-medium hover:text-primary transition-colors py-2"
active-class="text-primary"
@click="mobileMenuOpen = false"
>
{{ t(link.label) }}
</NuxtLink>
</template>
<div
class="flex items-center space-x-4 pt-4 border-t border-border"
>
<LanguageSwitcher />
<ThemeDropdown />
<ClientOnly>
<SignedOut>
<SignInDialog />
</SignedOut>
<SignedIn>
<UserButton />
</SignedIn>
</ClientOnly>
</div>
</nav>
</SheetContent>
</Sheet>
</div>
</header>
<slot /> <slot />
<Toaster />
</div> </div>
</template> </template>

10
app/lib/db/index.ts Normal file
View File

@@ -0,0 +1,10 @@
import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";
import * as schema from "./schema";
// Create a connection pool
const pool = new Pool({
connectionString: process.env.DATABASE_URL!,
});
export const db = drizzle(pool, { schema });

42
app/lib/db/migrate.ts Normal file
View File

@@ -0,0 +1,42 @@
import { migrate } from "drizzle-orm/node-postgres/migrator";
import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";
import * as schema from "./schema";
import { join } from "path";
import { existsSync } from "fs";
export async function runMigrations() {
if (!process.env.DATABASE_URL) {
throw new Error("DATABASE_URL environment variable is not set");
}
// Create a temporary pool for migrations
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
});
try {
const db = drizzle(pool, { schema });
// Determine the correct migrations folder path
// In development: ./drizzle from project root
// In production (Docker): /app/drizzle
let migrationsFolder = "./drizzle";
if (existsSync("/app/drizzle/meta/_journal.json")) {
migrationsFolder = "/app/drizzle";
} else if (existsSync(join(process.cwd(), "drizzle/meta/_journal.json"))) {
migrationsFolder = join(process.cwd(), "drizzle");
}
console.log("[DB] Running migrations from:", migrationsFolder);
await migrate(db, { migrationsFolder });
console.log("[DB] Migrations completed successfully");
} catch (error) {
console.error("[DB] Migration failed:", error);
throw error;
} finally {
// Close the pool after migrations
await pool.end();
}
}

99
app/lib/db/schema.ts Normal file
View File

@@ -0,0 +1,99 @@
import {
boolean,
pgTable,
text,
timestamp,
uniqueIndex,
uuid,
} from "drizzle-orm/pg-core";
import { relations } from "drizzle-orm";
export const peers = pgTable("peers", {
id: text("id").primaryKey(),
lastSeen: timestamp("last_seen").notNull().defaultNow(),
});
export const rooms = pgTable("rooms", {
id: text("id").primaryKey(),
broadcaster: text("broadcaster")
.notNull()
.references(() => peers.id, { onDelete: "cascade" }),
createdAt: timestamp("created_at").notNull().defaultNow(),
});
export const roomViewers = pgTable("room_viewers", {
id: uuid("id").primaryKey().defaultRandom(),
roomId: text("room_id")
.notNull()
.references(() => rooms.id, { onDelete: "cascade" }),
viewerId: text("viewer_id")
.notNull()
.references(() => peers.id, { onDelete: "cascade" }),
joinedAt: timestamp("joined_at").notNull().defaultNow(),
});
export const presets = pgTable("presets", {
id: uuid("id").primaryKey().defaultRandom(),
createdBy: text("created_by").notNull(),
name: text("name").notNull(),
iceServers: text("ice_servers").notNull(), // stringified json obv
shareable: boolean("shareable").notNull().default(false),
createdAt: timestamp("created_at").notNull().defaultNow(),
}, (table) => ({
uniqueUserPresetName: uniqueIndex().on(table.createdBy, table.name),
}));
export const presetUsers = pgTable(
"preset_users",
{
id: uuid("id").primaryKey().defaultRandom(),
presetId: uuid("preset_id")
.notNull()
.references(() => presets.id, { onDelete: "cascade" }),
userId: text("user_id").notNull(),
isDefault: boolean("is_default").notNull().default(false),
addedAt: timestamp("added_at").notNull().defaultNow(),
},
(table) => ({
uniquePresetUser: uniqueIndex().on(table.presetId, table.userId),
}),
);
// relations
export const peersRelations = relations(peers, ({ many }) => ({
roomsAsbroadcaster: many(rooms, { relationName: "broadcaster" }),
roomViewersAsViewer: many(roomViewers, { relationName: "viewer" }),
}));
export const roomsRelations = relations(rooms, ({ one, many }) => ({
broadcasterPeer: one(peers, {
fields: [rooms.broadcaster],
references: [peers.id],
relationName: "broadcaster",
}),
viewers: many(roomViewers, { relationName: "room" }),
}));
export const roomViewersRelations = relations(roomViewers, ({ one }) => ({
room: one(rooms, {
fields: [roomViewers.roomId],
references: [rooms.id],
relationName: "room",
}),
viewer: one(peers, {
fields: [roomViewers.viewerId],
references: [peers.id],
relationName: "viewer",
}),
}));
export const presetsRelations = relations(presets, ({ many }) => ({
presetUsers: many(presetUsers),
}));
export const presetUsersRelations = relations(presetUsers, ({ one }) => ({
preset: one(presets, {
fields: [presetUsers.presetId],
references: [presets.id],
}),
}));

View File

@@ -0,0 +1,108 @@
import { z } from "zod";
export const schema = z.object({
name: z
.string()
.min(3, "Name must be at least 3 characters.")
.max(20, "Name must be at most 20 characters."),
iceServers: z.string().superRefine((val, ctx) => {
// below code is ai generated. i am not writing validation myself istg
try {
const parsed = JSON.parse(val);
if (!Array.isArray(parsed)) {
ctx.addIssue({
code: "custom",
message: "Must be a JSON array",
});
return;
}
// Validate each ICE server object
parsed.forEach((item, index) => {
if (typeof item !== "object" || item === null) {
ctx.addIssue({
code: "custom",
message: `Item ${index}: must be an object`,
});
return;
}
// Validate urls field - can be string or array of strings
const { urls } = item;
if (!urls) {
ctx.addIssue({
code: "custom",
message: `Item ${index}: 'urls' is required`,
});
return;
}
const urlsList = Array.isArray(urls) ? urls : [urls];
if (!Array.isArray(urls) && typeof urls !== "string") {
ctx.addIssue({
code: "custom",
message: `Item ${index}: 'urls' must be a string or array of strings`,
});
return;
}
// Validate each URL in the urls list
urlsList.forEach((url, urlIndex) => {
if (typeof url !== "string") {
ctx.addIssue({
code: "custom",
message: `Item ${index}: urls[${urlIndex}] must be a string`,
});
return;
}
// Validate STUN/TURN URL format (RFC 8829)
const isValidStunUrl = /^stuns?:.+/.test(url);
const isValidTurnUrl = /^turns?:.+/.test(url);
if (!isValidStunUrl && !isValidTurnUrl) {
ctx.addIssue({
code: "custom",
message: `Item ${index}: urls[${urlIndex}] must be a valid STUN (stun:) or TURN (turn:/turns:) URL`,
});
}
});
// Validate optional fields
if (item.username !== undefined && typeof item.username !== "string") {
ctx.addIssue({
code: "custom",
message: `Item ${index}: 'username' must be a string`,
});
}
if (
item.credential !== undefined &&
typeof item.credential !== "string"
) {
ctx.addIssue({
code: "custom",
message: `Item ${index}: 'credential' must be a string`,
});
}
if (
item.credentialType !== undefined &&
!["password", "oauth"].includes(item.credentialType)
) {
ctx.addIssue({
code: "custom",
message: `Item ${index}: 'credentialType' must be 'password' or 'oauth'`,
});
}
});
} catch (error) {
ctx.addIssue({
code: "custom",
message: "Must be valid JSON",
});
}
}),
default: z.boolean(),
});

View File

@@ -0,0 +1,29 @@
import type { getPresetAuthorData } from "~/lib/utils/presetsDb";
// below types are ai generated
interface IceServer {
urls: string | string[];
username?: string;
credential?: string;
}
interface Preset {
id: string;
name: string;
createdBy: string;
iceServers: string | IceServer[]; // Database returns string, we transform to IceServer[]
shareable: boolean;
createdAt: string;
}
export interface PresetUser {
id: string;
presetId: string;
userId: string;
isDefault: boolean;
addedAt: string;
preset: Preset;
}
export interface ApiResponse {
success: boolean;
data: PresetUser[];
author: Awaited<ReturnType<typeof getPresetAuthorData>>;
}

View File

@@ -0,0 +1,28 @@
interface IceServer {
urls: string | string[];
username?: string;
credential?: string;
}
export interface Preset {
id: string;
name: string;
createdBy: string;
iceServers: string | IceServer[]; // Database returns string, we transform to IceServer[]
shareable: boolean;
createdAt: string;
}
export interface PresetAuthor {
id: string;
fullName: string | null;
profileImageUrl: string | null;
username: string | null;
email: string | null;
}
export interface PresetShareResponse {
success: boolean;
data: Preset;
author: PresetAuthor;
}

165
app/lib/utils/presetsDb.ts Normal file
View File

@@ -0,0 +1,165 @@
import { clerkClient } from "@clerk/nuxt/server";
import { eq, and } from "drizzle-orm";
import { db } from "~/lib/db/index";
import * as schema from "~/lib/db/schema";
import type { H3Event } from "h3";
export async function getUserPresets(clerkUserId: string) {
return await db.query.presetUsers.findMany({
where: eq(schema.presetUsers.userId, clerkUserId),
with: {
preset: true,
},
});
}
export async function getPresetById(presetId: string) {
return await db.query.presets.findFirst({
where: eq(schema.presets.id, presetId),
});
}
export async function userHasPresetAccess(
presetId: string,
userId: string,
): Promise<boolean> {
const preset = await getPresetById(presetId);
if (!preset) return false;
if (preset.createdBy === userId) return true;
const userPreset = await db.query.presetUsers.findFirst({
where: and(
eq(schema.presetUsers.presetId, presetId),
eq(schema.presetUsers.userId, userId),
),
});
return !!userPreset;
}
export async function createPreset(
userId: string,
name: string,
iceServers: string,
isDefault: boolean = false,
) {
const presetCreate = await db
.insert(schema.presets)
.values({
createdBy: userId,
name: name,
iceServers: iceServers,
})
.returning({ insertedId: schema.presets.id });
const insertedId = presetCreate[0]?.insertedId;
if (!insertedId) {
throw new Error("Failed to get inserted preset ID");
}
await db.insert(schema.presetUsers).values({
presetId: insertedId,
userId: userId,
isDefault: isDefault,
});
return insertedId;
}
export async function updatePreset(
presetId: string,
name: string,
iceServers: string,
) {
await db
.update(schema.presets)
.set({
name: name,
iceServers: iceServers,
})
.where(eq(schema.presets.id, presetId));
}
export async function setPresetAsDefault(presetId: string, userId: string) {
await db
.update(schema.presetUsers)
.set({ isDefault: false })
.where(eq(schema.presetUsers.userId, userId));
// set as default
await db
.update(schema.presetUsers)
.set({ isDefault: true })
.where(
and(
eq(schema.presetUsers.presetId, presetId),
eq(schema.presetUsers.userId, userId),
),
);
}
export async function unsetPresetAsDefault(presetId: string, userId: string) {
await db
.update(schema.presetUsers)
.set({ isDefault: false })
.where(
and(
eq(schema.presetUsers.presetId, presetId),
eq(schema.presetUsers.userId, userId),
),
);
}
export async function updatePresetDefaultStatus(
presetId: string,
userId: string,
isDefault: boolean,
) {
if (isDefault) {
await setPresetAsDefault(presetId, userId);
} else {
await unsetPresetAsDefault(presetId, userId);
}
}
export async function deletePreset(presetId: string) {
await db.delete(schema.presets).where(eq(schema.presets.id, presetId));
}
export async function getOwnedPresets(userId: string) {
return await db.query.presets.findMany({
where: eq(schema.presets.createdBy, userId),
});
}
export async function ownsPreset(
presetId: string,
userId: string,
): Promise<boolean> {
const preset = await getPresetById(presetId);
if (!preset) return false;
return preset.createdBy === userId;
}
export async function markAsShareable(presetId: string, shareable: boolean) {
await db
.update(schema.presets)
.set({ shareable })
.where(eq(schema.presets.id, presetId));
}
export async function getPresetAuthorData(event: H3Event, presetId: string) {
const preset = await getPresetById(presetId);
if (!preset) {
throw createError({ statusCode: 404, statusMessage: "Preset not found" });
}
const user = await clerkClient(event).users.getUser(preset.createdBy);
return {
id: user.id,
fullName: user.fullName,
profileImageUrl: user.imageUrl,
username: user.username,
email: user.primaryEmailAddress?.emailAddress || null,
};
}

View File

@@ -0,0 +1,14 @@
// source: https://clerk.com/docs/guides/secure/protect-pages
// Define the routes you want to protect with `createRouteMatcher()`
const isProtectedRoute = createRouteMatcher(["/presets(.*)", "/stream(.*)"]);
export default defineNuxtRouteMiddleware((to) => {
// Use the `useAuth()` composable to access the `isSignedIn` property
const { isSignedIn } = useAuth();
// Check if the user is not signed in and is trying to access a protected route
// If so, redirect them to the sign-in page
if (!isSignedIn.value && isProtectedRoute(to)) {
return navigateTo("/sign-in");
}
});

83
app/pages/about.vue Normal file
View File

@@ -0,0 +1,83 @@
<script setup lang="ts">
import { marked } from "marked";
import { Spinner } from "~/components/ui/spinner";
const markdownContent = ref("");
const htmlContent = ref("");
const loading = ref(true);
onMounted(async () => {
try {
const response = await fetch("/about.md");
if (!response.ok) {
throw new Error("Failed to load about content");
}
markdownContent.value = await response.text();
htmlContent.value = await marked(markdownContent.value);
} catch (error) {
console.error("Error loading about page:", error);
htmlContent.value = "<p>Failed to load about content.</p>";
} finally {
loading.value = false;
}
});
definePageMeta({
layout: "default",
});
</script>
<template>
<div class="container max-w-4xl mx-auto px-4 py-8">
<div
v-if="loading"
class="flex items-center justify-center text-center py-12 m-auto"
>
<Spinner size="lg" />
</div>
<div v-else class="prose max-w-none" v-html="htmlContent" />
</div>
</template>
<style scoped>
@reference "../assets/css/tailwind.css";
.prose :deep(h1) {
@apply text-4xl font-bold mb-6;
}
.prose :deep(h2) {
@apply text-3xl font-semibold mt-8 mb-4;
}
.prose :deep(h3) {
@apply text-2xl font-semibold mt-6 mb-3;
}
.prose :deep(p) {
@apply mb-4 leading-7;
}
.prose :deep(ul) {
@apply list-disc list-inside mb-4 space-y-2;
}
.prose :deep(strong) {
@apply font-semibold;
}
.prose :deep(a) {
@apply text-primary hover:underline;
}
.prose :deep(hr) {
@apply my-8 border-border;
}
.prose :deep(code) {
@apply bg-muted px-1.5 py-0.5 rounded text-sm;
}
.prose :deep(em) {
@apply italic;
}
</style>

298
app/pages/downloads.vue Normal file
View File

@@ -0,0 +1,298 @@
<script setup lang="ts">
import type { Component } from "vue";
import {
Apple,
Download,
ExternalLink,
Info,
Laptop,
Monitor,
Smartphone,
} from "lucide-vue-next";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import {
Card,
CardContent,
CardFooter,
CardHeader,
CardDescription,
CardTitle,
} from "@/components/ui/card";
definePageMeta({
layout: "default",
});
interface GitHubReleaseAsset {
name: string;
browser_download_url: string;
}
interface GitHubRelease {
html_url: string;
assets: GitHubReleaseAsset[];
}
interface PlatformDownload {
name: string;
icon: Component;
formats: string;
href: string;
}
const { t } = useI18n();
const repositoryUrl = "https://github.com/SrIzan10/helium";
const releasesUrl = `${repositoryUrl}/releases`;
const latestReleaseFallbackUrl = `${releasesUrl}/latest`;
const latestReleaseApiUrl =
"https://api.github.com/repos/SrIzan10/helium/releases/latest";
const androidSourceUrl = `${repositoryUrl}/tree/main/native-app`;
const { data: latestRelease } = useFetch<GitHubRelease>(latestReleaseApiUrl, {
key: "helium-latest-release",
server: false,
default: () => ({
html_url: latestReleaseFallbackUrl,
assets: [],
}),
});
const latestReleaseUrl = computed<string>(() => {
return latestRelease.value?.html_url ?? latestReleaseFallbackUrl;
});
const releaseAssets = computed<GitHubReleaseAsset[]>(() => {
return latestRelease.value?.assets ?? [];
});
function findReleaseAsset(
patterns: readonly RegExp[],
): GitHubReleaseAsset | undefined {
return releaseAssets.value.find((asset) => {
return patterns.some((pattern) => pattern.test(asset.name));
});
}
function getReleaseAssetUrl(
patterns: readonly RegExp[],
fallbackUrl?: string,
): string {
return (
findReleaseAsset(patterns)?.browser_download_url ??
fallbackUrl ??
latestReleaseUrl.value
);
}
const desktopPlatforms = computed<PlatformDownload[]>(() => {
return [
{
name: "Windows",
icon: Laptop,
formats: "NSIS, Portable",
href: getReleaseAssetUrl([/-Setup-.*\\.exe$/i, /\\.exe$/i]),
},
{
name: "macOS",
icon: Apple,
formats: "DMG, ZIP",
href: getReleaseAssetUrl([/\\.dmg$/i, /-mac\\.zip$/i]),
},
{
name: "Linux",
icon: Laptop,
formats: "AppImage",
href: getReleaseAssetUrl([/\\.AppImage$/i]),
},
];
});
const androidPlatform = computed<PlatformDownload>(() => {
return {
name: "Android",
icon: Smartphone,
formats: "APK",
href: getReleaseAssetUrl([/^helium-android-.*\\.apk$/i]),
};
});
</script>
<template>
<div class="container max-w-5xl mx-auto px-4 py-12">
<div class="text-center space-y-4 mb-12">
<h1 class="text-4xl font-bold tracking-tight">
{{ t("downloadHelium") }}
</h1>
<p class="text-muted-foreground text-lg max-w-2xl mx-auto">
{{ t("downloadHeliumDescription") }}
</p>
</div>
<div class="grid md:grid-cols-2 gap-8">
<Card class="relative h-full overflow-hidden">
<div
class="absolute top-0 right-0 p-3 opacity-10 pointer-events-none"
>
<Monitor class="w-32 h-32" />
</div>
<CardHeader>
<div class="flex items-center gap-3">
<div
class="flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10 text-primary"
>
<Monitor class="w-5 h-5" />
</div>
<div>
<CardTitle>{{ t("desktopApp") }}</CardTitle>
<CardDescription>
{{ t("desktopAppDescription") }}
</CardDescription>
</div>
</div>
</CardHeader>
<CardContent class="flex-1 space-y-4">
<div class="space-y-3">
<div
v-for="platform in desktopPlatforms"
:key="platform.name"
>
<a
:href="platform.href"
target="_blank"
rel="noopener noreferrer"
class="group flex items-center justify-between rounded-lg bg-muted/50 p-3 transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
>
<div class="flex items-center gap-3">
<component
:is="platform.icon"
class="w-4 h-4 text-muted-foreground transition-colors group-hover:text-foreground"
/>
<span class="text-sm font-medium">{{ platform.name }}</span>
</div>
<div class="flex items-center gap-2">
<Badge variant="secondary" class="text-xs">
{{ platform.formats }}
</Badge>
<Download
class="w-4 h-4 text-muted-foreground transition-colors group-hover:text-foreground"
/>
</div>
</a>
</div>
</div>
<div
class="flex items-start gap-2 text-xs text-muted-foreground bg-muted/30 p-3 rounded-lg"
>
<Info class="w-4 h-4 mt-0.5 shrink-0" />
<span>{{ t("desktopAppNote") }}</span>
</div>
</CardContent>
<CardFooter class="mt-auto flex-col gap-3 items-stretch">
<Button as-child class="w-full gap-2">
<a
:href="latestReleaseUrl"
target="_blank"
rel="noopener noreferrer"
>
<Download class="w-4 h-4" />
{{ t("downloadFromGitHub") }}
</a>
</Button>
<Button as-child variant="outline" class="w-full gap-2">
<a
:href="repositoryUrl"
target="_blank"
rel="noopener noreferrer"
>
<ExternalLink class="w-4 h-4" />
{{ t("viewSourceCode") }}
</a>
</Button>
</CardFooter>
</Card>
<Card class="relative h-full overflow-hidden">
<div
class="absolute top-0 right-0 p-3 opacity-10 pointer-events-none"
>
<Smartphone class="w-32 h-32" />
</div>
<CardHeader>
<div class="flex items-center gap-3">
<div
class="flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10 text-primary"
>
<Smartphone class="w-5 h-5" />
</div>
<div>
<CardTitle>{{ t("androidApp") }}</CardTitle>
<CardDescription>
{{ t("androidAppDescription") }}
</CardDescription>
</div>
</div>
</CardHeader>
<CardContent class="flex-1 space-y-4">
<div>
<a
:href="androidPlatform.href"
target="_blank"
rel="noopener noreferrer"
class="group flex items-center justify-between rounded-lg bg-muted/50 p-3 transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
>
<div class="flex items-center gap-3">
<component
:is="androidPlatform.icon"
class="w-4 h-4 text-muted-foreground transition-colors group-hover:text-foreground"
/>
<span class="text-sm font-medium">
{{ androidPlatform.name }}
</span>
</div>
<div class="flex items-center gap-2">
<Badge variant="secondary" class="text-xs">
{{ androidPlatform.formats }}
</Badge>
<Download
class="w-4 h-4 text-muted-foreground transition-colors group-hover:text-foreground"
/>
</div>
</a>
</div>
<div
class="flex items-start gap-2 text-xs text-muted-foreground bg-muted/30 p-3 rounded-lg"
>
<Info class="w-4 h-4 mt-0.5 shrink-0" />
<span>{{ t("androidAppNote") }}</span>
</div>
</CardContent>
<CardFooter class="mt-auto flex-col gap-3 items-stretch">
<Button as-child class="w-full gap-2">
<a
:href="androidPlatform.href"
target="_blank"
rel="noopener noreferrer"
>
<Download class="w-4 h-4" />
{{ t("downloadFromGitHub") }}
</a>
</Button>
<Button as-child variant="outline" class="w-full gap-2">
<a
:href="androidSourceUrl"
target="_blank"
rel="noopener noreferrer"
>
<ExternalLink class="w-4 h-4" />
{{ t("viewSourceCode") }}
</a>
</Button>
</CardFooter>
</Card>
</div>
</div>
</template>

View File

@@ -1,34 +1,142 @@
<script setup lang="ts"> <template>
import { useWebSocket } from '@vueuse/core'; <div
import { useViewerStore } from '~/state/viewer'; class="flex flex-col md:flex-row items-center justify-center gap-6 md:gap-20 mt-10 px-4 min-h-[80vh]"
import { Button } from "@/components/ui/button" >
import { toast } from 'vue-sonner'; <div
v-if="!isConnected"
class="flex flex-col items-center gap-6 animate-in fade-in slide-in-from-bottom-4 duration-500"
>
<div class="text-center space-y-2">
<h1 class="text-4xl font-bold tracking-tight">helium</h1>
<p class="text-muted-foreground text-lg">
{{ $t("effortlessScreensharing") }}
</p>
</div>
const viewerStore = useViewerStore() <app-code-input />
const { code: codeRef } = storeToRefs(viewerStore)
const wsUrl = useWebSocketUrl() <NuxtLink to="/stream">
const { send } = useWebSocket(wsUrl, { <Button variant="link" class="text-muted-foreground hover:text-primary">
{{ $t("hostInstead") }}
</Button>
</NuxtLink>
</div>
<div
class="video transition-all duration-500 ease-in-out"
:class="[
isConnected
? 'fixed inset-0 z-50 w-full h-full bg-black'
: 'relative w-full max-w-3xl aspect-video rounded-xl overflow-hidden border shadow-sm bg-muted/50',
]"
>
<!-- Status Overlay -->
<div
v-if="!isConnected"
class="absolute inset-0 flex items-center justify-center z-10 p-4 text-center"
>
<div v-if="viewerStore.isDisconnected" class="space-y-4">
<p class="text-sm font-medium text-muted-foreground">
{{ $t("streamEnded") }}
</p>
<Button @click="handleReset" variant="outline">
{{ $t("enterAnotherCode") }}
</Button>
</div>
<div
v-else-if="viewerStore.connectionStatus !== 'waiting for a code'"
class="space-y-4"
>
<div
class="animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full mx-auto"
/>
<p class="text-sm font-medium text-muted-foreground">
{{ viewerStore.connectionStatus }}
</p>
</div>
<p v-else class="text-muted-foreground/50 text-sm">
{{ $t("enterCodeToJoinStream") }}
</p>
</div>
<!-- Video Feed -->
<video
ref="videofeedRef"
autoplay
playsinline
:controls="false"
class="w-full h-full object-contain bg-black cursor-pointer"
@loadeddata="isConnected = true"
@click="showControls"
@touchstart="showControls"
/>
<!-- Connected Controls Overlay -->
<div
v-if="isConnected"
class="absolute top-0 left-0 right-0 p-4 flex justify-between items-start transition-opacity bg-gradient-to-b from-black/50 to-transparent"
:class="[
controlsVisible ? 'opacity-100' : 'opacity-0 hover:opacity-100',
]"
@click="resetControlsTimeout"
@touchstart="showControls"
>
<Button
variant="destructive"
size="lg"
class="gap-2 shadow-lg"
@click="cleanupViewing"
>
<LogOut class="w-5 h-5" />
{{ $t("disconnect") }}
</Button>
<Button
variant="secondary"
size="lg"
class="gap-2 shadow-lg"
@click="toggleFullscreen"
>
<Maximize class="w-5 h-5" />
{{ $t("fullscreen") }}
</Button>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { useWebSocket } from "@vueuse/core";
import { useViewerStore } from "~/state/viewer";
import { Button } from "@/components/ui/button";
import { useWebSocketUrl } from "~/composables/useWebSocketUrl";
import { LogOut, Maximize } from "lucide-vue-next";
const isConnected = ref(false);
const controlsVisible = ref(false);
let controlsHideTimeout: ReturnType<typeof setTimeout> | null = null;
const viewerStore = useViewerStore();
const { code: codeRef } = storeToRefs(viewerStore);
const wsUrl = useWebSocketUrl();
const videofeedRef = ref<HTMLVideoElement | null>(null);
const { send, close: closeWebSocket } = useWebSocket(wsUrl, {
autoReconnect: true, autoReconnect: true,
heartbeat: { heartbeat: {
message: JSON.stringify({ event: 'ping' }), message: JSON.stringify({ event: "ping" }),
interval: 15000, interval: 15000,
}, },
onMessage: async (ws, ev) => { onMessage: async (ws, ev) => {
const message = JSON.parse(ev.data) const message = JSON.parse(ev.data);
if (message.event === 'joined') { if (message.event === "offer") {
toast.success('stream joined successfully') viewerStore.setConnectionStatus("creating rtc peer connections...");
}
if (message.event === 'offer') {
const peerConnection = new RTCPeerConnection({ const peerConnection = new RTCPeerConnection({
iceServers: [ iceServers: message.iceServers,
{ urls: 'stun:stun.l.google.com:19302' },
{ urls: 'stun:stun1.l.google.com:19302' },
],
iceCandidatePoolSize: 10
}); });
viewerStore.setPeerConnection(peerConnection); viewerStore.setPeerConnection(peerConnection);
peerConnection.ontrack = (event) => { peerConnection.ontrack = (event) => {
viewerStore.setConnectionStatus("got some tracks!");
if (event.streams && event.streams[0] && videofeedRef.value) { if (event.streams && event.streams[0] && videofeedRef.value) {
videofeedRef.value.srcObject = event.streams[0]; videofeedRef.value.srcObject = event.streams[0];
} }
@@ -36,60 +144,207 @@ const { send } = useWebSocket(wsUrl, {
peerConnection.onicecandidate = (event) => { peerConnection.onicecandidate = (event) => {
if (event.candidate) { if (event.candidate) {
send(JSON.stringify({ viewerStore.setConnectionStatus(
event: 'ice-candidate', `got an ice candidate (type: ${event.candidate.type})`,
targetId: message.senderId, );
candidate: event.candidate, send(
})) JSON.stringify({
event: "ice-candidate",
targetId: message.senderId,
candidate: event.candidate,
}),
);
} }
}; };
await peerConnection.setRemoteDescription(new RTCSessionDescription(message.sdp));
const answer = await peerConnection.createAnswer(); peerConnection.onconnectionstatechange = () => {
await peerConnection.setLocalDescription(answer); viewerStore.setConnectionStatus(
`connection state: ${peerConnection.connectionState}`,
send(JSON.stringify({ );
event: 'answer',
targetId: message.senderId, if (peerConnection.connectionState === "connected") {
sdp: answer, viewerStore.setConnectionStatus("connected!");
})) }
}
// Handle disconnection or failed connection
if (message.event === 'ice-candidate') { if (
if (viewerStore.peerConnection && viewerStore.peerConnection.remoteDescription) { peerConnection.connectionState === "disconnected" ||
await viewerStore.peerConnection.addIceCandidate(new RTCIceCandidate(message.candidate)); peerConnection.connectionState === "failed" ||
peerConnection.connectionState === "closed"
) {
viewerStore.setConnectionStatus(
`connection ${peerConnection.connectionState}`,
);
// Don't set isConnected = false immediately here to avoid flickering if it's a temp glitch,
// but usually disconnected means it's over.
if (peerConnection.connectionState !== "connected") {
isConnected.value = false;
}
}
};
peerConnection.oniceconnectionstatechange = () => {
viewerStore.setConnectionStatus(
`ice connection state: ${peerConnection.iceConnectionState}`,
);
};
peerConnection.onicegatheringstatechange = () => {
viewerStore.setConnectionStatus(
`ice gathering state: ${peerConnection.iceGatheringState}`,
);
};
viewerStore.setConnectionStatus("sending an sdp description");
try {
await peerConnection.setRemoteDescription(
new RTCSessionDescription(message.sdp),
);
} catch (error) {
console.error("Error setting remote description:", error);
viewerStore.setConnectionStatus("failed to connect");
return;
} }
viewerStore.setConnectionStatus("sending an answer");
try {
const answer = await peerConnection.createAnswer();
await peerConnection.setLocalDescription(answer);
send(
JSON.stringify({
event: "answer",
targetId: message.senderId,
sdp: answer,
}),
);
} catch (error) {
console.error("Error creating answer:", error);
viewerStore.setConnectionStatus("failed to send answer");
}
}
if (message.event === "ice-candidate") {
if (
viewerStore.peerConnection &&
viewerStore.peerConnection.remoteDescription
) {
viewerStore.setConnectionStatus(
`got an ice candidate from remote peer (type: ${message.candidate.type})`,
);
try {
await viewerStore.peerConnection.addIceCandidate(
new RTCIceCandidate(message.candidate),
);
} catch (error) {
console.error("Error adding ICE candidate:", error);
}
}
}
if (message.event === "room-closed") {
viewerStore.setConnectionStatus("room closed by host");
cleanupViewing();
isConnected.value = false;
} }
}, },
}); });
const videofeedRef = ref<HTMLVideoElement|null>(null);
const startWebRTCConnection = async () => { const startWebRTCConnection = async () => {
send(JSON.stringify({ send(
event: 'join-room', JSON.stringify({
roomId: viewerStore.code, event: "join-room",
})) roomId: viewerStore.code,
} }),
);
};
watch(codeRef, (newCode) => { watch(codeRef, (newCode) => {
// sort of a safeguard bc only 6 digit codes end up getting passed // sort of a safeguard bc only 6 digit codes end up getting passed
if (newCode.length === 6) { if (newCode.length === 6) {
startWebRTCConnection(); startWebRTCConnection();
} }
}) });
function cleanupViewing() {
// Clear controls hide timeout
if (controlsHideTimeout) {
clearTimeout(controlsHideTimeout);
}
controlsVisible.value = false;
// Close peer connection
if (viewerStore.peerConnection) {
viewerStore.peerConnection.close();
viewerStore.setPeerConnection(null);
}
// Clear video element
if (videofeedRef.value) {
videofeedRef.value.srcObject = null;
}
// Clear code
viewerStore.code = "";
// Reset connection status
viewerStore.setConnectionStatus("disconnected");
isConnected.value = false;
// Exit fullscreen if active
if (document.fullscreenElement) {
document.exitFullscreen().catch(() => {});
}
}
function toggleFullscreen() {
if (!videofeedRef.value) return;
if (!document.fullscreenElement) {
videofeedRef.value.requestFullscreen().catch((err) => {
console.error(`Error attempting to enable fullscreen: ${err.message}`);
});
} else {
document.exitFullscreen();
}
}
function handleReset() {
viewerStore.resetDisconnected();
viewerStore.setConnectionStatus("waiting for a code");
}
function showControls() {
controlsVisible.value = true;
resetControlsTimeout();
}
function resetControlsTimeout() {
if (controlsHideTimeout) {
clearTimeout(controlsHideTimeout);
}
controlsHideTimeout = setTimeout(() => {
controlsVisible.value = false;
}, 3000);
}
// Cleanup on component unmount
onBeforeUnmount(() => {
cleanupViewing();
closeWebSocket();
});
// Cleanup on window/tab close
onMounted(() => {
const handleBeforeUnload = () => {
cleanupViewing();
};
window.addEventListener("beforeunload", handleBeforeUnload);
onUnmounted(() => {
window.removeEventListener("beforeunload", handleBeforeUnload);
});
});
</script> </script>
<template>
<div class="flex flex-col items-center justify-center gap-6 mt-10 px-4">
<h1>helium</h1>
<p>effortless screensharing powered by webrtc</p>
<app-code-input />
<video ref="videofeedRef" autoplay playsinline controls style="width: 100%; max-width: 1200px; background: black;"></video>
<NuxtLink to="/stream"><Button>host instead?</Button></NuxtLink>
</div>
</template>

151
app/pages/presets/index.vue Normal file
View File

@@ -0,0 +1,151 @@
<template>
<div class="px-4">
<div class="flex justify-between items-center mb-6">
<h1 class="text-3xl font-bold">{{ t('presets') }}</h1>
<Button @click="navigateTo('/presets/new')">
<Plus class="mr-2 h-4 w-4" />
{{ t('createNewPreset') }}
</Button>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
<div v-for="presetUser in data!.data" :key="presetUser.preset.id">
<Card class="flex flex-col h-full">
<CardHeader>
<CardTitle class="flex items-center justify-between">
<span>{{ presetUser.preset.name }}</span>
<Badge v-if="presetUser.isDefault" variant="secondary"
>{{ t('default') }}</Badge
>
</CardTitle>
<CardDescription
>{{ t('createdBy') }} {{ presetUser.preset.createdBy }}</CardDescription
>
</CardHeader>
<CardContent class="grow">
<div class="text-sm text-muted-foreground truncate">
{{ presetUser.preset.iceServers.length }} {{ presetUser.preset.iceServers.length === 1 ? t('iceServerConfigured') : t('iceServersConfigured') }} {{ t('configured') }}
</div>
</CardContent>
<CardFooter class="flex justify-between gap-2 ml-auto">
<div class="flex gap-2">
<div
v-if="user?.id === presetUser.preset.createdBy"
class="flex gap-2"
>
<Button
variant="outline"
size="icon"
@click="handleShare(presetUser.preset)"
>
<Share2 />
</Button>
<Button
variant="outline"
size="icon"
@click="editPreset(presetUser)"
>
<Edit />
</Button>
</div>
<Button
variant="destructive"
size="icon"
@click="deletePreset(presetUser.preset.id)"
>
<Trash />
</Button>
</div>
</CardFooter>
</Card>
</div>
</div>
<EditPresetDialog
v-if="selectedPresetUser"
:open="isEditDialogOpen"
@update:open="isEditDialogOpen = $event"
:preset-user="selectedPresetUser"
@refresh="refresh"
/>
</div>
</template>
<script setup lang="ts">
import { toast } from "vue-sonner";
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import EditPresetDialog from "~/components/app/EditPresetDialog.vue";
import { Edit, Share2, Trash, Plus } from "lucide-vue-next";
import type { ApiResponse } from "~/lib/types/PresetGetResponse";
const { t } = useI18n();
const { user } = useUser();
const { data, refresh } = await useFetch<ApiResponse>("/api/presets", {
cache: "no-cache",
transform: (response: any) => {
return {
...response,
data: response.data.map((item: any) => ({
...item,
preset: {
...item.preset,
iceServers:
typeof item.preset.iceServers === "string"
? JSON.parse(item.preset.iceServers)
: item.preset.iceServers,
},
})),
};
},
});
const isEditDialogOpen = ref(false);
const selectedPresetUser = ref(null);
function editPreset(presetUser: any) {
selectedPresetUser.value = presetUser;
isEditDialogOpen.value = true;
}
async function deletePreset(id: string) {
if (!confirm(t('deletePresetConfirm'))) return;
try {
await $fetch(`/api/presets/${id}`, {
method: "DELETE",
});
toast.success(t('presetDeletedSuccessfully'));
refresh();
} catch (error) {
toast.error(t('failedToDeletePreset'));
}
}
async function handleShare(preset: any) {
if (!confirm(t('sharePresetConfirm'))) return;
try {
const response = await $fetch(`/api/presets/${preset.id}/share`, {
method: "POST",
});
if (!response.success) {
toast.error(t('failedToGenerateShareableLink'));
return;
}
const shareableLink = `${window.location.origin}/presets/shared/${preset.id}`;
navigator.clipboard.writeText(shareableLink);
toast.success(t('linkCopiedToClipboard'));
} catch (error) {
toast.error(t('failedToSharePreset'));
}
}
</script>

11
app/pages/presets/new.vue Normal file
View File

@@ -0,0 +1,11 @@
<template>
<div class="flex flex-col max-w-2xl m-auto">
<PresetForm @success="router.push('/presets')" />
</div>
</template>
<script setup lang="ts">
import PresetForm from "~/components/app/PresetForm.vue";
const router = useRouter();
</script>

View File

@@ -0,0 +1,170 @@
<template>
<div class="min-h-[80vh] flex items-center justify-center p-4">
<div v-if="pending" class="flex justify-center">
<Spinner />
</div>
<Card
v-else-if="response && response.data.shareable"
class="w-full max-w-lg shadow-lg"
>
<CardHeader class="border-b pb-6">
<div class="flex items-center gap-3 mb-2">
<img
v-if="response.author?.profileImageUrl"
:src="response.author.profileImageUrl"
class="w-8 h-8 rounded-full ring-2 ring-background"
alt="Profile"
/>
<div
v-else
class="w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center text-xs font-medium text-primary ring-2 ring-background"
>
{{
(response.author?.fullName ||
response.author?.username ||
response.author?.email ||
"?")[0]!.toUpperCase()
}}
</div>
<CardDescription class="text-sm font-medium">
<span class="text-foreground font-semibold">
{{ response.author?.fullName || response.author?.username }}
</span>
{{ $t("wantsToSharePreset") }}
</CardDescription>
</div>
<CardTitle class="text-2xl pt-2">{{ response.data.name }}</CardTitle>
</CardHeader>
<CardContent class="pt-4">
<div class="grid grid-cols-2 gap-6">
<div class="space-y-1">
<p
class="text-xs font-medium text-muted-foreground uppercase tracking-wider"
>
{{ $t("created") }}
</p>
<p class="text-sm font-medium">
{{
new Date(response.data.createdAt).toLocaleDateString(
undefined,
{ dateStyle: "medium" },
)
}}
</p>
</div>
<div class="space-y-1">
<p
class="text-xs font-medium text-muted-foreground uppercase tracking-wider"
>
{{ $t("servers") }}
</p>
<div class="flex items-center gap-2">
<span class="text-sm font-medium"
>{{ parsedIceServers.length }}
{{
parsedIceServers.length === 1
? $t("iceServerConfigured")
: $t("iceServersConfigured")
}}</span
>
</div>
</div>
</div>
<div class="mt-8 space-y-4">
<div
class="flex items-center justify-between p-3 bg-muted rounded-lg"
>
<label class="text-sm font-medium cursor-pointer">{{
$t("activateByDefault")
}}</label>
<Switch v-model="setAsDefault" />
</div>
<div class="flex justify-end gap-3">
<Button variant="outline" @click="navigateTo('/')">{{
$t("cancel")
}}</Button>
<Button @click="importPreset" :disabled="isImporting">
{{ isImporting ? $t("importing") : $t("importPreset") }}
</Button>
</div>
</div>
</CardContent>
</Card>
<div v-else-if="!response" class="text-center text-muted-foreground">
<p>{{ $t("presetNotFound") }}</p>
</div>
<div
v-else-if="response && !response.data.shareable"
class="text-center text-muted-foreground space-y-4"
>
<p class="text-lg font-semibold text-destructive">
{{ $t("presetCannotBeShared") }}
</p>
<p class="text-sm">
{{ $t("presetSharingDisabled") }}
</p>
<Button variant="outline" @click="navigateTo('/')">{{
$t("goBack")
}}</Button>
</div>
</div>
</template>
<script setup lang="ts">
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import { Spinner } from "@/components/ui/spinner";
import { Switch } from "@/components/ui/switch";
import type { PresetShareResponse } from "~/lib/types/PresetShareResponse";
import { toast } from "vue-sonner";
const route = useRoute();
const { data: response, pending } = useFetch<PresetShareResponse>(
`/api/presets/${route.params.id}`,
);
const isImporting = ref(false);
const setAsDefault = ref(true);
const parsedIceServers = computed(() => {
if (!response.value?.data.iceServers) return [];
const servers = response.value.data.iceServers;
return typeof servers === "string" ? JSON.parse(servers) : servers;
});
const importPreset = async () => {
isImporting.value = true;
try {
const result = await $fetch<{ success: boolean; message: string }>(
`/api/presets/${route.params.id}/import`,
{
method: "POST",
body: {
setAsDefault: setAsDefault.value,
},
},
);
if (result.success) {
// Navigate to presets page after successful import
await navigateTo("/presets");
} else {
// Show error message
console.error(result.message);
toast.error(result.message);
}
} catch (error) {
console.error("Failed to import preset:", error);
} finally {
isImporting.value = false;
}
};
</script>

View File

@@ -0,0 +1,5 @@
<template>
<div class="flex h-full w-full items-center justify-center">
<SignIn routing="path" path="/sign-in" />
</div>
</template>

Some files were not shown because too many files have changed in this diff Show More