# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Save it (telegram bot)
spec:
    description: Save images and videos from internet.
    coverImage: https://github.com/ThaddeusJiang/save_it/blob/main/docs/assets/save_it_demo.gif?raw=true
    icon: https://raw.githubusercontent.com/ThaddeusJiang/save_it/refs/heads/main/docs/assets/savt_it_bot_logo.jpg
    variables:
        - key: PUBLIC_DOMAIN
          type: DOMAIN
          name: Domain
          description: What is the domain you want for your service?
    tags:
        - Downloader
        - Telegram Bot
        - CLI
    readme: |-
        # Features
        - Save images and videos by link
        - Search images and videos using semantic search
        - Find similar images and videos by picture
        - Explore indexed items in TypeLens

        [more](https://github.com/ThaddeusJiang/save_it)
    services:
        - name: save_it_bot
          icon: https://raw.githubusercontent.com/ThaddeusJiang/save_it/refs/heads/main/docs/assets/savt_it_bot_logo.jpg
          template: PREBUILT_V2
          spec:
            id: save-it-bot
            source:
                image: ghcr.io/thaddeusjiang/save_it:latest
            volumes:
                - id: bot-data
                  dir: /data
            env:
                COBALT_API_URL:
                    default: http://cobalt-api.zeabur.internal:9000
                    expose: false
                GOOGLE_OAUTH_CLIENT_ID:
                    default: ""
                    expose: false
                GOOGLE_OAUTH_CLIENT_SECRET:
                    default: ""
                    expose: false
                TELEGRAM_BOT_TOKEN:
                    default: ""
                    expose: false
                TYPESENSE_URL:
                    default: http://typesense.zeabur.internal:8108
                    expose: false
            configs: []
        - name: typesense
          icon: https://typesense.org/docs/images/typesense_logo.svg
          template: PREBUILT_V2
          spec:
            id: typesense
            source:
                image: typesense/typesense:27.1
            ports:
                - id: web
                  port: 8108
                  type: HTTP
            volumes:
                - id: typesense-data
                  dir: /data
            instructions:
                - title: Typesense Health Check URL
                  content: ${ZEABUR_WEB_URL}/health
                - title: Typesense API Key
                  content: ${TYPESENSE_API_KEY}
            env:
                TYPESENSE_API_KEY:
                    default: ${PASSWORD}
                    expose: true
                TYPESENSE_DATA_DIR:
                    default: /data
                    expose: false
            configs: []
        - name: typelens
          icon: https://raw.githubusercontent.com/copperline-ai/typelens/main/public/logo.png
          template: PREBUILT_V2
          spec:
            id: typelens
            source:
                image: ghcr.io/copperline-ai/typelens:1.26.0
            ports:
                - id: web
                  port: 3000
                  type: HTTP
            instructions:
                - title: TypeLens URL
                  content: ${ZEABUR_WEB_URL}
                - title: TypeLens Username
                  content: ${AUTH_USERNAME}
                - title: TypeLens Password
                  content: ${AUTH_PASSWORD}
            env:
                AUTH_PASSWORD:
                    default: ${PASSWORD}
                    expose: false
                AUTH_USERNAME:
                    default: admin
                    expose: false
                TYPESENSE_HOST:
                    default: typesense.zeabur.internal
                    expose: false
                TYPESENSE_PORT:
                    default: "8108"
                    expose: false
                TYPESENSE_PROTOCOL:
                    default: http
                    expose: false
                TYPESENSE_SERVER_NAME:
                    default: Save It Typesense
                    expose: false
            configs: []
        - name: cobalt-api
          icon: https://github.com/imputnet/cobalt/raw/main/web/static/favicon.png
          template: PREBUILT_V2
          spec:
            id: cobalt-api
            source:
                image: ghcr.io/imputnet/cobalt:11
            ports:
                - id: api
                  port: 9000
                  type: TCP
            instructions:
                - title: Cobalt Twitter Cookies
                  content: Edit /cookies.json with {"twitter":["auth_token=<token>; ct0=<csrf>"]} to let self-hosted Cobalt download X posts that require login.
            env:
                API_URL:
                    default: http://cobalt-api.zeabur.internal:9000
                    expose: false
                COOKIE_PATH:
                    default: /cookies.json
                    expose: false
            configs:
                - path: /cookies.json
                  template: |
                    {
                      "twitter": []
                    }
                  permission: 256
                  envsubst: null
