This commit is contained in:
2026-01-04 00:38:04 -05:00
Unverified
parent ec2425f2b7
commit d3dbd1e33a
20 changed files with 1622 additions and 1869 deletions

112
README.md
View File

@@ -17,24 +17,23 @@ A React Native Expo app that connects to an UpSnap server and provides mobile ac
- Node.js installed
- Expo CLI installed (`npm install -g expo-cli`)
- An UpSnap server instance running (e.g., https://wol.f6knight.duckdns.org/)
- An UpSnap server instance running
### Installation
1. Install dependencies:
```bash
npm install
npm i
```
2. Start the development server:
```bash
npm start
npx expo run
```
3. Run on your preferred platform:
- iOS: Press `i` in the terminal or run `npm run ios`
- Android: Press `a` in the terminal or run `npm run android`
- Web: Press `w` in the terminal or run `npm run web`
- iOS: Press `i` in the terminal or run `npx expo run:ios`
- Android: Press `a` in the terminal or run `npx expo run:android`
## Usage
@@ -42,25 +41,15 @@ npm start
1. Open the app
2. Enter your UpSnap server credentials:
- Server Address
- Username or Email
- Password
- Check "Login as Admin" if you're an admin user
3. Tap "Login"
### Device Management
#### Adding a Device
1. Tap the "+ Add" button in the Devices screen
2. Fill in the required fields:
- Device Name (e.g., "My PC")
- MAC Address (format: XX:XX:XX:XX:XX:XX)
- IP Address
- Optional: Netmask, Broadcast Address, SecureOn Password, Port
3. Tap "Add Device"
#### Scanning for Devices
1. Tap the "Scan" button in the Devices screen
2. Wait for the network scan to complete
3. Tap on a discovered device to add it to your list
@@ -68,7 +57,6 @@ npm start
#### Managing Devices
- **View Devices**: Scroll through the list on the main screen
- **Device Details**: Tap on a device card to view and edit details
- **Wake Device**: Tap the green "Wake" button on a device card
- **Sleep Device**: Tap the orange "Sleep" button
- **Reboot Device**: Tap the blue "Reboot" button
@@ -80,93 +68,8 @@ npm start
- 🔴 Red dot: Device is offline
- 🟠 Orange dot: Status unknown
## Screens
### Login Screen
- Username/email and password fields
- Admin login option
- Persistent authentication using AsyncStorage
### Devices Screen
- List of all devices with status indicators
- Quick action buttons for each device
- Pull-to-refresh for updating status
- Add device and scan network buttons
### Device Details Screen
- View all device information
- Edit device details
- Delete device option
### Add Device Screen
- Manual device entry form
- All required and optional fields
- Input validation
### Scan Devices Screen
- Network scanning functionality
- List of discovered devices
- Quick add to device list
### Settings Screen
- User information display
- Server configuration
- Logout option
- Clear data option
## API Integration
The app connects to an UpSnap server via its REST API:
- **Authentication**: `/api/collections/users/auth-with-password` or `/api/collections/_superusers/auth-with-password`
- **Devices**: `/api/collections/devices/records`
- **Wake**: `/api/upsnap/wake/:id`
- **Sleep**: `/api/collections/upsnap/sleep/:id`
- **Reboot**: `/api/upsnap/reboot/:id`
- **Shutdown**: `/api/upsnap/shutdown/:id`
- **Scan**: `/api/upsnap/scan`
## Project Structure
```
src/
├── components/ # Reusable components
├── context/ # React context providers (AuthContext)
├── navigation/ # Navigation setup
├── screens/ # All app screens
│ ├── LoginScreen.tsx
│ ├── DeviceListScreen.tsx
│ ├── DeviceDetailsScreen.tsx
│ ├── AddDeviceScreen.tsx
│ ├── ScanDevicesScreen.tsx
│ └── SettingsScreen.tsx
├── services/ # API service
│ └── api.ts
└── types/ # TypeScript type definitions
└── index.ts
```
## Tech Stack
- **React Native**: Cross-platform mobile framework
- **Expo**: Development platform
- **TypeScript**: Type safety
- **React Navigation**: Navigation library
- **AsyncStorage**: Local data persistence
## Server Configuration
The app is pre-configured to connect to:
- Server URL: `https://wol.f6knight.duckdns.org`
- API Base: `/api`
To change the server URL, modify the `API_BASE_URL` constant in `src/services/api.ts`.
## Security Notes
- Authentication tokens are stored securely in AsyncStorage
- All API calls require authentication
- Destructive actions (sleep, reboot, shutdown) require confirmation
- Never expose your UpSnap server to the open web without proper security measures
## Troubleshooting
@@ -174,7 +77,6 @@ To change the server URL, modify the `API_BASE_URL` constant in `src/services/ap
### Login Issues
- Verify your username/email and password are correct
- Check if you need to log in as admin
- Ensure your UpSnap server is accessible
### Network Scan Issues
@@ -192,7 +94,7 @@ To change the server URL, modify the `API_BASE_URL` constant in `src/services/ap
## License
This project is a mobile companion to UpSnap, which is licensed under the MIT License.
This project is licensed under the MIT License.
## Credits