Skip to content

Commit

Permalink
empty values
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra committed Aug 13, 2023
1 parent b372175 commit 840cd3c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Get it with presoldered headers, or solder them yourself. Attach the two devices
docker run -d -p 8999:8999 mariusandra/frameos
```

Then load http://0.0.0.0:8999 - ideally with an IP that your frames can connect to.

## Raspberry setup

Download the [Raspberry Pi Imager](https://www.raspberrypi.com/software/)
Expand All @@ -36,11 +38,12 @@ Plug in the raspberry, and wait until you can connect to it:

```bash
ping frame1.local
ssh raam@frame1.local
ssh frame@frame1.local
```

Then add it in the control interface.


### Optional

Then run `sudo raspi-config` and:

Expand All @@ -53,9 +56,10 @@ Optional, install tailscale
curl -fsSL https://tailscale.com/install.sh | sh
```

# FrameOS Control Panel
# Developing

## FrameOS Control Panel

Getting started:

```bash
python3 -m venv env
Expand All @@ -65,7 +69,7 @@ cd frontend && npm install && cd ..
honcho start
```

## Updating models
## Migrations

```bash
# create migration after changing a model
Expand Down
12 changes: 8 additions & 4 deletions backend/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ def get_ssh_connection(frame: Frame) -> SSHClient:
if frame.ssh_pass:
ssh.connect(frame.frame_host, username=frame.ssh_user, password=frame.ssh_pass, timeout=10)
else:
with open(os.path.expanduser('~/.ssh/id_rsa'), 'r') as f:
ssh_key = f.read()
ssh_key_obj = RSAKey.from_private_key(StringIO(ssh_key))
ssh.connect(frame.frame_host, username=frame.ssh_user, pkey=ssh_key_obj, timeout=10)
key_path = os.path.expanduser('~/.ssh/id_rsa')
if os.path.exists(key_path):
with open(key_path, 'r') as f:
ssh_key = f.read()
ssh_key_obj = RSAKey.from_private_key(StringIO(ssh_key))
ssh.connect(frame.frame_host, username=frame.ssh_user, pkey=ssh_key_obj, timeout=10)
else:
raise Exception(f"SSH key file does not exist at {key_path}")
return ssh

def exec_command(frame: Frame, ssh: SSHClient, command: str) -> int:
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/scenes/frame/frameLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export const frameLogic = kea<frameLogicType>([
try {
const formData = new FormData()
Object.keys(frame).forEach((key) => {
formData.append(key, (frame as any)[key])
const value = (frame as any)[key]
formData.append(key, value === null || value === undefined ? '' : value)
})
const response = await fetch(`/api/frames/${values.id}/update`, {
method: 'POST',
Expand Down

0 comments on commit 840cd3c

Please sign in to comment.