#!/bin/bash

# 获取系统架构
arch=$(uname -m)

# 检查是否有参数传入
if [ $# -gt 0 ]; then
    # 有参数时，转发给 apm-store-handler 并保留所有参数
    exec apm-store-handler "$@"
fi

# 没有参数时，根据架构执行不同操作
case $arch in
    x86_64|i386|i686)
        xdg-open "https://erotica.spark-app.store/amd64-apm/index-client.html"
        ;;
    aarch64|armv7l|armv8l)
        xdg-open "https://erotica.spark-app.store/arm64-apm/index-client.html"
        ;;
    *)
        zenity --error --text="暂不支持此架构: $arch" --title="架构不支持"
        ;;
esac