FreeAITokens
हिन्दी

इंस्टॉल स्क्रिप्ट क्या करती है

किसी वेबसाइट से कमांड कॉपी करके Terminal में पेस्ट करने का मतलब उस वेबसाइट पर भरोसा करना है। यहाँ वह सब है जो FreeAITokens का इंस्टॉलर करता है, और उसका पूरा सोर्स।

आसान शब्दों में

  1. पता लगाती है कि आपके पास Mac, Linux या Windows कंप्यूटर है।
  2. FreeAITokens का नया ऐप उसके सार्वजनिक GitHub रिलीज़ से डाउनलोड करती है।
  3. Mac: ऐप को आपके Applications फ़ोल्डर में रखती है (पुरानी कॉपी बदलकर) और खोल देती है। Linux: इसे ~/.local/bin/freeaitokens-app के रूप में सेव करती है। Windows: सामान्य इंस्टॉलर चलाती है।
  4. डाउनलोड की हुई फ़ाइल मिटा देती है। इसके अलावा कुछ नहीं बदलती: न एडमिन पासवर्ड, न सेटिंग, न कोई दूसरा सॉफ़्टवेयर।

पूरी स्क्रिप्ट एक फ़ंक्शन के अंदर है जो बिल्कुल आख़िर में चलता है, इसलिए अगर डाउनलोड बीच में कट जाए तो कुछ नहीं होता।

चलाने से पहले इसे पढ़ने के लिए: curl -fsSL https://freeaitokens.co/install | less

Mac और Linux: /install

#!/bin/sh
# Installs the FreeAITokens desktop app from its latest GitHub release. Nothing else is changed.
#   macOS: the app goes into /Applications (or ~/Applications if that is not writable) and opens.
#   Linux: the AppImage goes to ~/.local/bin/freeaitokens-app.
# Source and explanation: https://freeaitokens.co/install-script
set -eu

# Everything is in main, so a download cut off halfway runs nothing.
main() {
BASE="https://github.com/timchosen/freeaitokens/releases/latest/download"
OS="${FREEAITOKENS_OS:-$(uname -s)}"
ARCH="${FREEAITOKENS_ARCH:-$(uname -m)}"
DRY="${FREEAITOKENS_DRY_RUN:-}"

fail() { echo "FreeAITokens: $1" >&2; exit 1; }

case "$OS" in
  Darwin)
    FILE="FreeAITokens-mac.zip"
    if [ -w /Applications ]; then DEST="/Applications"; else DEST="$HOME/Applications"; fi
    ;;
  Linux)
    case "$ARCH" in
      x86_64|amd64) FILE="FreeAITokens-linux-x86_64.AppImage" ;;
      aarch64|arm64) FILE="FreeAITokens-linux-arm64.AppImage" ;;
      *) fail "this computer's processor ($ARCH) is not supported. See https://freeaitokens.co/download" ;;
    esac
    DEST="$HOME/.local/bin/freeaitokens-app"
    ;;
  *) fail "$OS is not supported by this script. On Windows, use the PowerShell line at https://freeaitokens.co/download" ;;
esac

URL="$BASE/$FILE"
echo "Downloading $URL"
echo "Installing to $DEST"
[ -n "$DRY" ] && exit 0

command -v curl >/dev/null 2>&1 || fail "curl is needed but not installed."
TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' EXIT
curl -fL --progress-bar "$URL" -o "$TMP/$FILE" || fail "the download failed. Check your connection and try again."

if [ "$OS" = Darwin ]; then
  ditto -x -k "$TMP/$FILE" "$TMP/app"
  APP="$(find "$TMP/app" -maxdepth 1 -name '*.app' | head -n 1)"
  [ -n "$APP" ] || fail "the download did not contain the app."
  # An older copy may be running; quit it so the new one starts.
  osascript -e 'quit app id "io.github.timchosen.freeaitokens"' >/dev/null 2>&1 || true
  mkdir -p "$DEST"
  rm -rf "$DEST/$(basename "$APP")"
  mv "$APP" "$DEST/"
  # Not signed by Apple yet: clear the "downloaded from the internet" flag so macOS opens it.
  xattr -dr com.apple.quarantine "$DEST/$(basename "$APP")" 2>/dev/null || true
  echo "Installed $DEST/$(basename "$APP"). Opening it now; look for it in your menu bar."
  open "$DEST/$(basename "$APP")"
else
  mkdir -p "$(dirname "$DEST")"
  chmod +x "$TMP/$FILE"
  mv -f "$TMP/$FILE" "$DEST"
  echo "Installed $DEST. Start it with: $DEST"
  echo "(Some systems need libfuse2 to run AppImages: sudo apt install libfuse2, or libfuse2t64 on Ubuntu 24.04 and newer)"
fi
}

main "$@"

Windows: /install.ps1

# Installs the FreeAITokens desktop app on Windows from its latest GitHub release.
# It downloads the installer to your temp folder and runs it. Nothing else is changed.
# Source and explanation: https://freeaitokens.co/install-script
& {
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue' # the progress bar makes downloads many times slower
$url = 'https://github.com/timchosen/freeaitokens/releases/latest/download/FreeAITokens-windows.exe'
$file = Join-Path $env:TEMP 'FreeAITokens-windows.exe'
Write-Host "Downloading $url"
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
Write-Host 'Running the installer. Windows may ask you to confirm: choose More info, then Run anyway.'
Start-Process -FilePath $file -Wait
Remove-Item $file -ErrorAction SilentlyContinue
Write-Host 'Done. FreeAITokens is in your Start menu and system tray.'
}

दोनों फ़ाइलें सोर्स रिपॉज़िटरी में भी हैं। कोई समस्या मिली? निजी तौर पर बताएँ।