Skip to content

Commit

Permalink
feat: add hide editor param
Browse files Browse the repository at this point in the history
  • Loading branch information
nasbench committed Nov 13, 2023
1 parent 2080da7 commit 0543fc8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
9 changes: 8 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import os
import yaml
import base64
from flask import Flask, render_template, request, Response
import json
from flask import Flask, jsonify, render_template, request, Response

from sigma.conversion.base import Backend
from sigma.plugins import InstalledSigmaPlugins
Expand All @@ -19,6 +20,7 @@
backends = plugins.backends
pipeline_resolver = plugins.get_pipeline_resolver()
pipelines = list(pipeline_resolver.list_pipelines())
pipelines_names = [p[0] for p in pipelines]


@app.route("/")
Expand All @@ -41,6 +43,11 @@ def home():
)


@app.route("/getpipelines", methods=["GET"])
def get_pipelines():
return jsonify(pipelines_names)


@app.route("/sigma", methods=["POST"])
def convert():
# get params from request
Expand Down
9 changes: 9 additions & 0 deletions static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ window.onload = function () {
}
});

// check if rule parameter is in url
if(urlParameter.has('hideEditor')){
let hideEditor = urlParameter.get('hideEditor')
if(hideEditor == 1){
document.getElementById("rule-section").style.display = "none"
document.getElementById("rule-grid").setAttribute("class", "")
}
}

// check if rule parameter is in url
if(urlParameter.has('rule')){
let rule = atob(urlParameter.get('rule'));
Expand Down
6 changes: 2 additions & 4 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@
</div>
</div>
</div>

<div id="content-section" class="mx-10 mt-5">
<div class="grid lg:grid-cols-2 gap-4">
<div class="lg:col-span-1 self-start lg:px-2">
<div id="rule-grid" class="grid lg:grid-cols-2 gap-4">
<div id="rule-section" class="lg:col-span-1 self-start lg:px-2">
<p class="text-lg text-white font-bold">
<span class="px-3 py-2 border-x border-t rounded border-sigma-blue">
<i id="rule-share-btn" class="fas fa-share-nodes px-1 py-0 my-0 text-sm text-sigma-blue cursor-pointer"></i>
Expand Down Expand Up @@ -169,7 +168,6 @@
level: high</code></pre>
<pre onclick="focusSelect('pipeline-code')" class="border border-sigma-blue tab-code hidden"><code id="pipeline-code" class="language-yaml text-sm"></code></pre>
</div>

<div class="lg:col-span-1 self-start lg:px-2">
<p class="text-lg text-white font-bold">
<span class="px-3 py-2 border-x border-t rounded border-sigma-blue">
Expand Down

0 comments on commit 0543fc8

Please sign in to comment.