Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dchristl committed Jan 20, 2024
2 parents b566122 + 1c7c20e commit b7b08d6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,24 @@ jobs:
skip-recent: 3
- name: Prepare and checkout
uses: actions/checkout@v3
- name: Set environment variables
run: echo "VERSION=$(cat version)" >> $GITHUB_ENV
- name: Fail if Git-Tag already exist on main
if: github.ref == 'refs/heads/main'
run: |
TAG="v${{ env.VERSION }}"
git fetch
if git rev-parse -q --verify "refs/tags/${TAG}" > /dev/null; then
echo "Tag ${TAG} already exists"
exit 1
else
echo "Tag ${TAG} does not exist"
fi
- name: Initialize Submodules
run: |
git submodule update --init --recursive
- name: Set environment variables
run: echo "VERSION=$(cat version)" >> $GITHUB_ENV

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

Expand Down Expand Up @@ -134,12 +147,10 @@ jobs:
firmware/ESP32/.pio/build/esp32dev/partitions.bin
firmware/ESP32/.pio/build/esp32dev/bootloader.bin
- name: Delete old drafts
if: github.ref == 'refs/heads/main'
uses: hugo19941994/delete-draft-releases@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
if: github.ref == 'refs/heads/main'
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,35 +53,39 @@ Customization in keypair generator to output an array for the ESP32 firmware and

- Create a docker network

`docker network create mh-network`
```
docker network create mh-network
```

- Install [Anisette Server](https://github.com/Dadoum/anisette-v3-server):

`docker run -d --restart always --name anisette -p 6969:6969 --volume anisette-v3_data:/home/Alcoholic/.config/anisette-v3/lib/ --network mh-network dadoum/anisette-v3-server`
```
docker run -d --restart always --name anisette -p 6969:6969 --volume anisette-v3_data:/home/Alcoholic/.config/anisette-v3/lib/ --network mh-network dadoum/anisette-v3-server
```

- Start and set up your Macless Haystack endpoint in interactive mode:

`docker run -i --restart unless-stopped --name macless-haystack -p 6176:6176 --volume mh_data:/app/endpoint/data --network mh-network christld/macless-haystack`
```
docker run -i --restart unless-stopped --name macless-haystack -p 6176:6176 --volume mh_data:/app/endpoint/data --network mh-network christld/macless-haystack
```

- You will be asked for your Apple-ID, password and your 2FA. If you see `serving at port 6176 over HTTP` you have all set up

- End your server by pressing Ctrl+C or by
- Restart your server now in background by restarting it in an other terminal

`docker stop macless-haystack`

- Restart your server now in background

`docker restart macless-haystack`
```
docker restart macless-haystack
```


### Configure and install frontend

You can either use the frontend, provided by GitHub, host the webserver for yourself or use the Android application
You can either use the frontend provided by GitHub, host the webserver for yourself or use the Android application

- *Optional*: Mobile: Install application
- *Optional*: Host: Browse to [Github Page](https://dchristl.github.io/macless-haystack/) (s. [Notes on SSL usage](endpoint/README.md#notes-on-usage-on-other-machines-ssl))
- Import PREFIX_devices.json to your application
- *Optional*: If you run the frontend not on the same machine as your endpoint, you have to configure your Url in the settings
- If you run the frontend not on the same machine as your endpoint, you have to configure your Url in the settings


## Screenshots
Expand Down
6 changes: 2 additions & 4 deletions endpoint/mh_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def do_POST(self):
headers=pypush_gsa_icloud.generate_anisette_headers(),
json=data)
logger.debug('Return from fetch service:')
logger.debug(r.content.decode())
result = json.loads(r.content.decode())
logger.debug(result)
results = result['results']

newResults = OrderedDict()
Expand All @@ -87,13 +87,11 @@ def do_POST(self):
# send the body of the response
responseBody = json.dumps(result)
self.wfile.write(responseBody.encode())

except requests.exceptions.ConnectTimeout:
logger.error("Timeout to " + config.getAnisetteServer() +
", is your anisette running and accepting Connections?")
self.send_response(504)
except Exception as e:
logger.error("Unknown error occured {e}")
self.send_response(501)

def getCurrentTimes(self):
clientTime = datetime.utcnow().replace(microsecond=0).isoformat() + 'Z'
Expand Down

0 comments on commit b7b08d6

Please sign in to comment.