mirror of
https://github.com/oslook/cursor-ai-downloads.git
synced 2025-09-26 19:31:12 +08:00
add product.json
This commit is contained in:
7
.github/workflows/update-cursor-links.yml
vendored
7
.github/workflows/update-cursor-links.yml
vendored
@@ -38,7 +38,10 @@ jobs:
|
||||
|
||||
- name: Run update script
|
||||
run: bun src/update-cursor-links.ts
|
||||
|
||||
|
||||
- name: Run update script
|
||||
run: ./scripts/download_all_cursors.sh version-history.json
|
||||
|
||||
- name: Check for changes
|
||||
id: git-check
|
||||
run: |
|
||||
@@ -49,7 +52,7 @@ jobs:
|
||||
run: |
|
||||
git config --global user.email "github-actions@github.com"
|
||||
git config --global user.name "GitHub Actions"
|
||||
git add README.md version-history.json
|
||||
git add README.md version-history.json cursor_products
|
||||
git commit -m "Update Cursor download links"
|
||||
git push
|
||||
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@@ -32,4 +32,6 @@ yarn-error.log*
|
||||
# OS specific
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
*.backup
|
||||
*.backup
|
||||
squashfs-root
|
||||
*AppImage
|
1538
cursor_products/1.5.6/product.json
Normal file
1538
cursor_products/1.5.6/product.json
Normal file
File diff suppressed because it is too large
Load Diff
1538
cursor_products/1.5.7/product.json
Normal file
1538
cursor_products/1.5.7/product.json
Normal file
File diff suppressed because it is too large
Load Diff
1539
cursor_products/1.5.9/product.json
Normal file
1539
cursor_products/1.5.9/product.json
Normal file
File diff suppressed because it is too large
Load Diff
63
scripts/download_all_cursors.sh
Executable file
63
scripts/download_all_cursors.sh
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if a JSON file is provided
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <json_file> [force]"
|
||||
echo "Example: $0 versions.json"
|
||||
echo "Example (force mode): $0 versions.json force"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JSON_FILE=$1
|
||||
FORCE_DOWNLOAD=false
|
||||
if [ "$2" == "force" ]; then
|
||||
FORCE_DOWNLOAD=true
|
||||
echo "Force mode enabled. Will re-download and process all found Linux versions."
|
||||
fi
|
||||
|
||||
# Ensure the JSON file exists
|
||||
if [ ! -f "$JSON_FILE" ]; then
|
||||
echo "Error: JSON file '$JSON_FILE' does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure the download script exists and is executable
|
||||
DOWNLOAD_SCRIPT="scripts/get_cursor_product_json.sh"
|
||||
if [ ! -f "$DOWNLOAD_SCRIPT" ] || [ ! -x "$DOWNLOAD_SCRIPT" ]; then
|
||||
echo "Error: The download script '$DOWNLOAD_SCRIPT' does not exist or is not executable."
|
||||
echo "Please ensure 'get_cursor_product_json.sh' is in the current directory and has execute permissions."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Parsing '$JSON_FILE' file..."
|
||||
echo "-----------------------------------"
|
||||
|
||||
# Use jq to iterate through the versions in the JSON
|
||||
# Filter for objects that have a "linux-x64" platform
|
||||
jq -c '.versions[] | select(.platforms."linux-x64" != null)' "$JSON_FILE" | while read -r version_obj; do
|
||||
|
||||
# Extract the version number and Linux URL from the JSON object
|
||||
VERSION=$(echo "$version_obj" | jq -r '.version')
|
||||
LINUX_URL=$(echo "$version_obj" | jq -r '.platforms."linux-x64"')
|
||||
|
||||
OUTPUT_FILE="cursor_products/${VERSION}/product.json"
|
||||
|
||||
# Check if the product.json file already exists, unless force mode is enabled
|
||||
if [ "$FORCE_DOWNLOAD" = false ] && [ -f "$OUTPUT_FILE" ]; then
|
||||
echo "Product.json for version $VERSION already exists. Skipping."
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "Processing version: $VERSION"
|
||||
echo "Download URL: $LINUX_URL"
|
||||
|
||||
# Call the download script and check its exit status
|
||||
if ! "$DOWNLOAD_SCRIPT" "$LINUX_URL"; then
|
||||
echo "Failed to process version $VERSION. Please check the output of the download script."
|
||||
else
|
||||
echo "Successfully processed version $VERSION."
|
||||
fi
|
||||
echo "-----------------------------------"
|
||||
done
|
||||
|
||||
echo "Finished processing all specified versions."
|
77
scripts/get_cursor_product_json.sh
Executable file
77
scripts/get_cursor_product_json.sh
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if a complete URL is provided
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <full_appimage_download_url>"
|
||||
echo "Example: $0 https://downloads.cursor.com/production/.../Cursor-1.5.9-x86_64.AppImage"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DOWNLOAD_URL=$1
|
||||
OUTPUT_DIR="cursor_products"
|
||||
EXTRACT_DIR="temp_cursor_extract"
|
||||
|
||||
# Extract the filename from the URL
|
||||
APPIMAGE_FILENAME=$(basename "$DOWNLOAD_URL")
|
||||
|
||||
# Extract the version number from the filename using a regular expression
|
||||
VERSION=$(echo "$APPIMAGE_FILENAME" | sed -n 's/.*-\([0-9.]*\)-x86_64.AppImage/\1/p')
|
||||
|
||||
# Check if the version was successfully extracted
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Error: Could not parse version number from the filename. Please ensure the URL points to a valid AppImage file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Attempting to download file: $APPIMAGE_FILENAME"
|
||||
echo "Download URL: $DOWNLOAD_URL"
|
||||
echo "Parsed Version: $VERSION"
|
||||
|
||||
# 1. Download the AppImage file
|
||||
if ! wget --quiet --output-document="${APPIMAGE_FILENAME}" "$DOWNLOAD_URL"; then
|
||||
echo "Error: Download failed. Please check the URL or your network connection."
|
||||
rm -f "${APPIMAGE_FILENAME}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Download complete."
|
||||
|
||||
# 2. Create a temporary directory for extracted files
|
||||
mkdir -p "$EXTRACT_DIR"
|
||||
|
||||
# 3. Extract the AppImage file contents
|
||||
echo "Extracting AppImage package..."
|
||||
chmod +x "$APPIMAGE_FILENAME"
|
||||
if ! ./"$APPIMAGE_FILENAME" --appimage-extract > /dev/null; then
|
||||
echo "Extraction failed. Attempting fallback with 'unsquashfs'."
|
||||
# Fallback method: using unsquashfs (requires squashfs-tools)
|
||||
if command -v unsquashfs &>/dev/null; then
|
||||
unsquashfs -f -d "$EXTRACT_DIR" "$APPIMAGE_FILENAME"
|
||||
else
|
||||
echo "Error: Fallback method 'unsquashfs' is not available. Please ensure 'squashfs-tools' is installed."
|
||||
rm -f "$APPIMAGE_FILENAME"
|
||||
rmdir "$EXTRACT_DIR" > /dev/null 2>&1
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 4. Locate and copy the product.json file
|
||||
# The extracted files are typically in a 'squashfs-root' directory
|
||||
SOURCE_FILE="${EXTRACT_DIR}/squashfs-root/usr/share/cursor/resources/app/product.json"
|
||||
if [ ! -f "$SOURCE_FILE" ]; then
|
||||
# In some cases, files might be extracted to the root of the temp directory
|
||||
SOURCE_FILE="./squashfs-root/usr/share/cursor/resources/app/product.json"
|
||||
fi
|
||||
|
||||
if [ -f "$SOURCE_FILE" ]; then
|
||||
mkdir -p "${OUTPUT_DIR}/${VERSION}"
|
||||
cp "$SOURCE_FILE" "${OUTPUT_DIR}/${VERSION}/product.json"
|
||||
echo "Successfully extracted and saved product.json for version ${VERSION}."
|
||||
echo "File location: ${OUTPUT_DIR}/${VERSION}/product.json"
|
||||
else
|
||||
echo "Error: product.json file not found in the expected path inside the extracted AppImage."
|
||||
fi
|
||||
|
||||
# 5. Clean up temporary files
|
||||
rm -rf "$EXTRACT_DIR" "$APPIMAGE_FILENAME"
|
||||
echo "Cleanup complete."
|
Reference in New Issue
Block a user