Attempts to locate and validate a Shinylive app.json file from a given base URL. The function tries multiple possible paths and validates both the HTTP response and JSON structure.
Value
A list with three components:
valid
Logical indicating if a valid app.json was foundurl
Character string of the successful URL, or NULL if not founddata
List containing the parsed JSON data if valid, NULL otherwise
Details
The function performs the following steps:
Generates three possible paths to check:
The base URL as provided
base URL + `"/app.json"“
Parent directory +
"/app.json"
For each path:
Attempts an HTTP GET request
Verifies the content type is JSON
Parses and validates the JSON structure
Returns immediately if valid app.json is found
Examples
if (FALSE) { # \dontrun{
# Direct app.json URL
result <- find_shinylive_app_json("https://example.com/app.json")
# Directory containing app.json
result <- find_shinylive_app_json("https://example.com/myapp/")
# Check if valid
if (result$valid) {
cat("Found app.json at:", result$url)
}
} # }