File size: 4,173 Bytes
571f20f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<!DOCTYPE html>
<html>
<head>
    <title>Sync</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
    <link rel="icon" type="image/x-icon" href="{{ url_for('static', filename='favicon.png') }}">
    <style>

	body {
            margin: 0;
            padding: 0;
            background-position: top;
            background-image: url("{{ url_for('static', filename='bkg0.png') }}"); /* Replace "bkg.png" with your mobile background image path */
            background-repeat: repeat;
            background-color: #f1f1f1;
            background-size: stretch;
        }
	.form_container {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            width: 90vw; /* 90% of viewport width */
            max-width: 300px; /* Set maximum width as desired */
            height: 400px;
            padding: 10px;
            background-color: hsla(244, 16%, 92%, 0.6);
            border-radius: 10px;
            margin: 0 auto;
            margin-top: 50px;
        }
        .login__input {
  	    width: 80%;
            padding: 12px 12px;
            border-radius: 6px;
            border: 2px solid var(--text-color);
            background-color: hsla(244, 16%, 92%, 0.6);
            color: var(--title-color);
            font-size: var(--smaller-font-size);
            font-weight: var(--font-medium);
            transition: border 0.4s;
            margin: 0 auto;
        }
        
        .login__button {
            width: 70%;
            padding: 10px 1.5rem;
            border-radius: 6px;
            background: lightblue;
            color: #000;
            font-size: var(--small-font-size);
            font-weight: var(--font-semi-bold);
            box-shadow: 0 6px 24px hsla(244, 75%, 48%, 0.3);
            margin-bottom: 1rem;
            margin-top: 1rem;
        }

        .login__button-ghost {
            background: hsla(244, 16%, 92%, 0.6);
            border: 2px solid var(--first-color);
            color: var(--first-color);
            box-shadow: none;
        }
        .hidden {
  display: none;
}
    </style>
</head>
<body>
<button class="done-button" onclick="window.close()">Done</button>
<div class="form_container">
    <h1 style="font-family: Calibri, sans-serif; font-size: 30px; font-weight: bold; color: darkblue; font-style: bold;text-align: center;">DARNA.HI</h1>
    <h2 style="font-family: Calibri, sans-serif; font-size: 20px; font-weight: bold; color: darkblue; font-style: bold;text-align: center;">Please enter super user password to run Install:</h2>
    <div style="text-align: center;">
    
    <form action="/execute_script" method="post">
    {% if error %}
        <p style="color:red;">{{ error }}</p>
        {% endif %}
        <input type="password" id="sudo" placeholder="Enter sudo password">
        <button type="submit" class="login__button" id="installButton">GO</button>
       
    </form>
    <h3></h3>
</div>
<script>
    const installButton = document.getElementById('installButton');
    installButton.addEventListener('click', function() {
        installButton.style.display = 'none'; // Hide the button

        const sudoPassword = document.getElementById('sudo').value;

        // Fetch request to execute the script
        fetch('/execute_script', { 
            method: 'POST', 
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({ sudo: sudoPassword })
        })
        .then(response => response.json())
        .then(data => {
            if (data.success) {
                alert('Script executed successfully!');
                window.close();
            } else {
                alert('Error executing script: ' + data.error);
            }
        })
        .catch(error => {
            alert('Failed to execute script: ' + error);
        })
        .finally(() => {
            installButton.style.display = 'block'; // Show the button again
        });
    });
</script>

</body>
</html>