Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Veyon Community Forum

  1. Home
  2. Help & Troubleshooting
  3. ScreenLock from WebAPI and CLI

ScreenLock from WebAPI and CLI

Scheduled Pinned Locked Moved Help & Troubleshooting
1 Posts 1 Posters 60 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mariomoran
    wrote on last edited by
    #1

    Hey guys, a few days ago I started testing Veyon and its features. I was mainly interested in testing the web API and the veyon-cli, and I've been trying them out.
    My goal was to be able to lock a computer screen in the lab from the admin. However, I can't get it to work. The CLI command 'veyon-cli feature start ScreenLock <host address>' tells me that the feature name or UID is incorrect (I also tried the UID from the 'veyon-cli feature show' command). So I decided to try the web API. The problem I have with the API is that the documentation apparently doesn't mention how to specify the host to lock the screen on.

    Estaba probando la api con el siguiente codigo de python (es solo de prueba):

    from flask import Flask, request, jsonify
    import requests
    
    app = Flask(__name__)
    VEYON_API_URL = "http://localhost:11080/api/v1"
    
    
    ConnectionUID = ""
    
    # Autenticación
    @app.route("/authentication", methods=["GET"])
    def authentication():
        global ConnectionUID
    
        data = {
            "method": "0c69b301-81b4-42d6-8fae-128cdd113314", 
            "credentials": {
                "keyname": "admin_key",
                "keydata": read_private_key()
            }
        }
        response = requests.post(f"{VEYON_API_URL}/authentication/localhost", json=data)
    
        ConnectionUID = response.json()["connection-uid"]
        # print(ConnectionUID)
    
        return jsonify(response.json()), response.status_code
    
    # Iniciar una función (Ejemplo: ScreenLock)
    @app.route("/get_features", methods=["GET"])
    def get_features():
        global ConnectionUID
        headers = {
            "Connection-Uid": ConnectionUID
        }
    
        response = requests.get(f"{VEYON_API_URL}/feature", headers=headers)
        return jsonify(response.json()), response.status_code
    
    # Iniciar una función (Ejemplo: ScreenLock)
    @app.route("/screen_lock", methods=["POST"])
    def screen_lock():
        global ConnectionUID
        headers = {
            "Connection-Uid": ConnectionUID
        }
    
        data = request.json
        response = requests.put(f"{VEYON_API_URL}/feature/ccb535a2-1d24-4cc1-a709-8b47d2b2ac79", headers=headers, json=data)
        return jsonify(response.json()), response.status_code
    
    
    
    # Lectura de la private key
    def read_private_key():
        with open("admin_key_private_key.pem", "r") as file:
            return file.read()
    
    if __name__ == "__main__":
        app.run(debug=True, port=3000)
    
    

    Docs:
    36ad93ea-23b6-4de1-bf0d-d0964cc9e82c-image.png

    I'm using veyon 4.9.4 and I'd like to know what I'm doing wrong or if I'm misunderstood that these functions can be performed from the admin. Thank you for your help in advance.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    Powered by NodeBB | Contributors
    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups