Ir al contenido

Inicio rápido

import { Steps } from ‘@astrojs/starlight/components’;

Publicá un artefacto en vivo con un solo request contra tu $ORIGIN. Vas a necesitar un token de API — mirá Autenticación. ¿Sin instancia? Instalá primero.

  1. Guardá credenciales. Token y origin en ~/.shareout/credentials:

    ~/.shareout/credentials
    {
    "token": "so_your_token_here",
    "origin": "https://shareout.<tu-cuenta>.workers.dev"
    }
  2. Publicá un artefacto. ShareOut está detrás de Cloudflare, que puede bloquear los requests crudos de Python. El patrón confiable es construir el JSON en Python y pasarlo por pipe a curl:

    Ventana de terminal
    ORIGIN=$(python3 -c "import json,os; print(json.load(open(os.path.expanduser('~/.shareout/credentials')))['origin'].rstrip('/'))")
    TOKEN=$(python3 -c "import json,os; print(json.load(open(os.path.expanduser('~/.shareout/credentials')))['token'])")
    python3 - <<'PY' | curl -sS -X POST "$ORIGIN/v1/publish" \
    -H "Authorization: Bearer $TOKEN" \
    -H 'Content-Type: application/json' \
    --data-binary @-
    import json, sys
    json.dump({
    "name": "Hello ShareOut",
    "slug": "hello-shareout",
    "visibility": "public",
    "files": [{
    "path": "index.html",
    "content": "<!DOCTYPE html><html><body><h1>Hello, world.</h1></body></html>",
    "mime": "text/html",
    "encoding": "utf8"
    }]
    }, sys.stdout)
    PY
  3. Abrí tu URL. La respuesta incluye el link en vivo en tu origen:

    {
    "artifact": { "id": "art_abc123" },
    "deployment": {
    "slug": "hello-shareout",
    "url": "https://shareout.<tu-cuenta>.workers.dev/a/hello-shareout/"
    }
    }

Listo — tu artefacto está en vivo. Actualizalo cuando quieras publicando de nuevo con el mismo slug; ShareOut crea una nueva versión y conserva las anteriores.