git init of winget repo statistics and manager

This commit is contained in:
2024-06-06 13:47:07 +03:00
commit a71d124066
16 changed files with 814 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
Logs/
*.exe

15
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}"
}
]
}

21
go.mod Normal file
View File

@@ -0,0 +1,21 @@
module main
go 1.22.3
require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
golang.org/x/sys v0.19.0 // indirect
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
modernc.org/libc v1.50.9 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/sqlite v1.30.0 // indirect
modernc.org/strutil v1.2.0 // indirect
modernc.org/token v1.1.0 // indirect
)

31
go.sum Normal file
View File

@@ -0,0 +1,31 @@
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 h1:5D53IMaUuA5InSeMu9eJtlQXS2NxAhyWQvkKEgXZhHI=
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4=
modernc.org/libc v1.50.9 h1:hIWf1uz55lorXQhfoEoezdUHjxzuO6ceshET/yWjSjk=
modernc.org/libc v1.50.9/go.mod h1:15P6ublJ9FJR8YQCGy8DeQ2Uwur7iW9Hserr/T3OFZE=
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E=
modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU=
modernc.org/sqlite v1.30.0 h1:8YhPUs/HTnlEgErn/jSYQTwHN/ex8CjHHjg+K9iG7LM=
modernc.org/sqlite v1.30.0/go.mod h1:cgkTARJ9ugeXSNaLBPK3CqbOe7Ec7ZhWPoMFGldEYEw=
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=

26
html/ana.html Normal file
View File

@@ -0,0 +1,26 @@
<html>
<head>
<link rel="stylesheet" href="mod.css" type="text/css">
<title>HUJI Sap Analysis</title>
<script src="script.js"></script>
</head>
<body dir="rtl">
<div class="header">
<h3>מנהל החבילות של האוניברסיטה העברית</h3>
<strong>הדרכה:</strong>
<h4>אפשרות א'</h4>
<p>יש לפתוח את חלון ההתחל או את שורת החיפוש ולהקליד <abbr title="יוצג גם כcommand prompt">CMD</abbr>. יש ללחוץ עליו בלחצן הימני, ולבחור "הפעל כמנהל". כשיפתח, יש להדביק את הטקסט הבא (לחיצה על הטקסט כדי להעתיק), </p>
<div id="source" class="copyme" onclick="copyValue('source')">winget source add -n huji -t "Microsoft.Rest"
https://winget.cc.huji.ac.il/api/ & rmdir /s /q "%appdata%\SAP AG" & winget install sap.analysis -s huji </div>
</div>
<h4 style="width: 100%;">אפשרות ב'</h4>
<a href="/installers/UpgradeAna.bat" class="acopyme" style="width: 100%;" download>להורדה קובץ ההרצה. יש ללחוץ על הלחצן הימני ולפתוח כמנהל. במידה וייפתח חלון כחול, יש ללחוץ על פרטים נוספים -> אפשר </a>
<p style="width: 100%;"><strong>הערה:</strong> בדפדפן מיקרוסופט אדג' יש ללחוץ על Keep על הקובץ.</p>
<br><br><br>
<p>במידה ובשגיאה נכתב כי הפקודה 'winget' אינה מוכרת למערכת, יש להדביק את הפקודה הבאה:</p>
<div class="copyme" onclick="copyValue('help')" id="help">powershell -executionPolicy bypass -command "$progressPreference = 'silentlyContinue'; Write-Information 'Downloading WinGet and its dependencies...'; Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle; Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx; Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile Microsoft.UI.Xaml.2.8.x64.appx; Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx; Add-AppxPackage Microsoft.UI.Xaml.2.8.x64.appx; Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle;"</div>
</div>
</body>
</html>

58
html/index.html Normal file
View File

@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html>
<head>
<title>SQLite Data</title>
<link href="mod.css" rel="stylesheet" type="text/css">
</head>
<body class="m">
<div class="container">
<div class="column">
<h1>Download Statistics</h1>
<table>
<tr>
<th>Program</th>
<th>Version</th>
<th>Download Count</th>
</tr>
<% downloadData.forEach(function(row) { %>
<tr>
<td>
<%= row.program %>
</td>
<td>
<%= row.version %>
</td>
<td>
<%= row.download_count %>
</td>
</tr>
<% }); %>
</table>
</div>
<div class="column" id="totalus">
<h1>Total Download Statistics</h1>
<table>
<tr>
<th>Package</th>
<th>Search Count</th>
</tr>
<% searchData.forEach(function(row) { %>
<tr>
<td>
<%= row.program %>
</td>
<td>
<%= row.download_count %>
</td>
</tr>
<% }); %>
</table>
</div>
</div>
</body>
</html>

34
html/main.html Normal file
View File

@@ -0,0 +1,34 @@
{{define "body"}}
<body>
<a href="/" class="lang"><img src="/heb" width="20px" height="20px"></a>
<div>
<div class="header">
<h3>{{ .Header }}</h3>
<p style="font-size: 12;">{{ .Help }}</p>
<p>{{ .Explain }}</p>
<div id="source" class="copyme" onclick="copyValue('source')">winget source add -n huji -t "Microsoft.Rest"
https://winget.cc.huji.ac.il/api/</div>
</div>
<ul>
<% pkgs.forEach(function(row, i) { %>
<li id="<%= i %>">
<div id="program-<%= i %>" onclick="showAndHide('id-<%= i %>','<%= i %>')">
Package Name: <strong>
<%= row.package %>
</strong>
</div>
<div id="version-<%= i %>" onclick="showAndHide('id-<%= i %>','<%= i %>')">
Package Version: <%= row.version %>
</div>
<div id="tag-<%= i %>" onclick="showAndHide('id-<%= i %>','<%= i %>')">Allowed use by <%= row.tag %>
</div>
<script>insertWarning("<%= row.warning %>","<%= i %>")</script>
<div class="copyme hiddencopy" id="id-<%= i %>" onclick="copyValue('id-<%= i %>')"><script>scriptPackage("<%= row.id %>", "<%= row.extra_commands %>", "<%= i %>")</script></div>
</li>
<% }); %>
</ul>
</div>
</body>
{{end}}

14
html/master.html Normal file
View File

@@ -0,0 +1,14 @@
{{define "master"}}
<!DOCTYPE html>
<html>
<head>
<title>{{ .Title }}</title>
<link href="/public/mod.css" rel="stylesheet" type="text/css">
<script src="/public/script.js"></script>
</head>
<body>
{{template "body" .}}
</body>
</html>
{{end}}

42
html/mrkzi.html Normal file
View File

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<title>HUJI Packages</title>
<link href="mod.css" rel="stylesheet" type="text/css">
<script src="script.js"></script>
</head>
<body dir="rtl">
<a href="/en" class="lang"><img src="/eng" width="20px" height="20px"></a>
<div>
<div class="header">
<h3>מנהל החבילות של האוניברסיטה העברית</h3>
<p style="font-size: 12;">הדרכה:</p>
<p>יש לפתוח את חלון ההתחל או את שורת החיפוש ולהקליד<abbr title="יוצג גם כcommand prompt">CMD</abbr>. יש ללחוץ עליו בלחצן הימני, ולבחור "הפעל כמנהל". כשיפתח, יש להדביק את הטקסט הבא (לחיצה על הטקסט כדי להעתיק), </p>
<div id="source" class="copyme" onclick="copyValue('source')">winget source add -n huji -t "Microsoft.Rest"
https://winget.cc.huji.ac.il/api/</div>
</div>
<ul class="r">
<% pkgs.forEach(function(row, i) { %>
<li id="<%= i %>">
<div id="program-<%= i %>" onclick="showAndHide('id-<%= i %>','<%= i %>')">
שם התוכנה: <strong>
<%= row.package %>
</strong>
</div>
<div id="version-<%= i %>" onclick="showAndHide('id-<%= i %>','<%= i %>')">
גרסאת התוכנה <%= row.version %>
</div>
<div id="tag-<%= i %>" onclick="showAndHide('id-<%= i %>','<%= i %>')"><script>replaceHebrew("tag-<%= i %>",'<%= row.tag %>')</script>
</div>
<script>insertWarning("<%= row.warning %>","<%= i %>",'he')</script>
<div class="copyme hiddencopy" id="id-<%= i %>" onclick="copyValue('id-<%= i %>')"><script>scriptPackage("<%= row.id %>", "<%= row.extra_commands %>", "<%= i %>")</script></div>
</li>
<% }); %>
</ul>
</div>
</body>
</html>

26
html/sap.html Normal file
View File

@@ -0,0 +1,26 @@
<html>
<head>
<link rel="stylesheet" href="mod.css" type="text/css">
<title>HUJI Sap</title>
<script src="script.js"></script>
</head>
<body dir="rtl">
<div class="header">
<h3>מנהל החבילות של האוניברסיטה העברית</h3>
<strong>הדרכה:</strong>
<h4>אפשרות א'</h4>
<p>יש לפתוח את חלון ההתחל או את שורת החיפוש ולהקליד <abbr title="יוצג גם כcommand prompt">CMD</abbr>. יש ללחוץ עליו בלחצן הימני, ולבחור "הפעל כמנהל". כשיפתח, יש להדביק את הטקסט הבא (לחיצה על הטקסט כדי להעתיק), </p>
<div id="source" class="copyme" onclick="copyValue('source')">winget source add -n huji -t "Microsoft.Rest"
https://winget.cc.huji.ac.il/api/ & winget install sap.gui.upgrade -s huji </div>
</div>
<h4 style="width: 100%;">אפשרות ב'</h4>
<a href="/installers/UpgradeSap.bat" class="acopyme" style="width: 100%;" download>להורדה קובץ ההרצה. יש ללחוץ על הלחצן הימני ולפתוח כמנהל. במידה וייפתח חלון כחול, יש ללחוץ על פרטים נוספים -> אפשר </a>
<p style="width: 100%;"><strong>הערה:</strong> בדפדפן מיקרוסופט אדג' יש ללחוץ על Keep על הקובץ.</p>
<br><br><br>
<p>במידה ובשגיאה נכתב כי הפקודה 'winget' אינה מוכרת למערכת, יש להדביק את הפקודה הבאה:</p>
<div class="copyme" onclick="copyValue('help')" id="help">powershell -executionPolicy bypass -command "$progressPreference = 'silentlyContinue'; Write-Information 'Downloading WinGet and its dependencies...'; Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle; Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx; Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile Microsoft.UI.Xaml.2.8.x64.appx; Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx; Add-AppxPackage Microsoft.UI.Xaml.2.8.x64.appx; Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle;"</div>
</div>
</body>
</html>

33
html/up.html Normal file
View File

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File Upload</title>
<link href="mod.css" rel="stylesheet" type="text/css">
<script src="script.js"></script>
</head>
<body>
<!-- <div> -->
<form action="/upload" method="post" enctype="multipart/form-data">
<input type="text" name="filename" placeholder="Selected file" readonly>
<input type="file" name="file" id="file" onchange="document.forms[0].filename.value = this.files[0].name">
<button class="btn" type="submit">Upload</button>
</form>
<!---
</div>
-->
<script>
// Ensure the file input is not empty before submitting the form
document.forms[0].addEventListener('submit', function(event) {
var fileInput = document.getElementById('file');
if (fileInput.files.length === 0) {
alert('Please select a file to upload.');
event.preventDefault();
}
});
</script>
</body>
</html>

26
html/wsb.html Normal file
View File

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>HUJI Packages</title>
<link href="/public/mod.css" rel="stylesheet" type="text/css">
<script src="/public/script.js"></script>
</head>
<div>
<div id='fubar' class="copyme" onclick="copyValue('fubar')">$progressPreference = 'silentlyContinue'<br>
Write-Information "Downloading WinGet and its dependencies..."<br>
Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle<br>
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx <br>
Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile Microsoft.UI.Xaml.2.8.x64.appx <br>
Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx <br>
Add-AppxPackage Microsoft.UI.Xaml.2.8.x64.appx<br>
Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle<br>
Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name HideFileExt -Value 0<br>
Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name Hidden -Value 1<br>
winget source add -n huji -t "Microsoft.Rest" https://winget.cc.huji.ac.il/api/<br>
if((Test-Path -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\huji.ac.il\winget.cc") -ne $true) { New-Item "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\huji.ac.il\winget.cc" -force -ea SilentlyContinue };<br>
New-ItemProperty -LiteralPath 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\huji.ac.il\winget.cc' -Name '*' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue;<br>
New-ItemProperty -LiteralPath 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\huji.ac.il\winget.cc' -Name 'https' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue;<br>
</div>
</div>
</html>

110
main.go Normal file
View File

@@ -0,0 +1,110 @@
package main
import (
"database/sql"
"fmt"
"html/template"
"log"
"net/http"
"os"
"time"
_ "modernc.org/sqlite"
)
func readHtml(res http.ResponseWriter, req *http.Request) {
g := template.CSS("./html/public/mod.css")
f, err := template.ParseFiles("./html/wsb.html")
if err != nil {
log.Println(err)
}
err = f.Execute(res, g)
if err != nil {
log.Println(err)
}
}
func simpRequestResp(res http.ResponseWriter, req *http.Request) {
fmt.Fprint(res, "Hello, M'Lord", 153*4, " I'm here to serveè")
}
func getMsgFromDB(sqldb *sql.DB, id string, lang string) string {
query := fmt.Sprintf("SELECT %s FROM msgs WHERE content=$1", lang)
res := sqldb.QueryRow(query, id)
lng := ""
dt := res.Scan(&lng)
if dt != nil {
return ""
}
return lng
}
func getPkgIdFromDB(sqldb *sql.DB) []string {
query, err := sqldb.Query("SELECT id FROM packs_all")
if err != nil {
log.Println(err)
}
var pkgs []string
query.Scan(&pkgs)
if err != nil {
log.Println(err)
}
return pkgs
}
// func fullSearchDB(sqldb *sql.DB) []string {
// }
func index(sqldb *sql.DB) http.Handler {
return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
b := elements{
Title: getMsgFromDB(sqldb, "title", "heb"),
Header: getMsgFromDB(sqldb, "header", "heb"),
Help: getMsgFromDB(sqldb, "help", "heb"),
Packagename: getMsgFromDB(sqldb, "packagename", "heb"),
Packageversion: getMsgFromDB(sqldb, "packageversion", "heb"),
Allow: getMsgFromDB(sqldb, "allow", "heb"),
Warning: getMsgFromDB(sqldb, "warning", "heb"),
Explain: getMsgFromDB(sqldb, "explain", "heb"),
}
templates, err := template.ParseFiles("html/master.html", "html/main.html")
if err != nil {
log.Println(err)
}
err = templates.ExecuteTemplate(res, "master", &b)
if err != nil {
log.Println(err)
}
res.WriteHeader(http.StatusOK)
})
}
func public() http.Handler {
return http.StripPrefix("/public/", http.FileServer(http.Dir("./public")))
}
func main() {
logfilename := "Logs/" + time.Now().Format("2006-01-02--15-04-05") + ".log"
file, err := os.OpenFile(logfilename, os.O_APPEND|os.O_CREATE, 0777)
if err != nil {
os.Exit(12)
}
log.SetOutput(file)
db, err := sql.Open("sqlite", "file:progs.db")
mux := http.NewServeMux()
mux.Handle("/public/", public())
mux.Handle("/", index(db))
addr := fmt.Sprintf(":%s", "12312")
server := http.Server{
Addr: addr,
Handler: mux,
ReadTimeout: 15 * time.Second,
WriteTimeout: 15 * time.Second,
IdleTimeout: 15 * time.Second,
}
if err := server.ListenAndServe(); err != nil {
log.Fatalf("main: couldn't start simple server: %v\n", err)
}
lang := "heb"
log.Println(getMsgFromDB(db, "title", lang))
}

19
packages.go Normal file
View File

@@ -0,0 +1,19 @@
package main
type packages struct{
name string
version string
extra_command string
tag string
warning bool
}
type elements struct {
Title string
Header string
Help string
Packagename string
Packageversion string
Allow string
Warning string
Explain string
}

239
public/mod.css Normal file
View File

@@ -0,0 +1,239 @@
@import url("https://fonts.googleapis.com/css2?family=Alef:wght@400;700&display=swap");
abbr {
border: none;
text-decoration: none;
}
body {
font-family: "Alef";
padding-left: 10px;
margin: auto;
display: flex;
font-size: 14pt;
width: 75%;
background-color: #000000;
background: #000000;
color: #ffffff;
height: 100vh;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
flex-direction: row;
flex-wrap: wrap;
align-content: flex-start;
justify-content: center;
}
body.m{
width: auto;
}
.copyme::before {
content: "Click here to copy: ";
font-style: italic;
}
.acopyme {
direction: ltr;
background: #6a568b;
color: #ffffff;
cursor: pointer;
border-radius: 15px;
/* margin-left: -10px; */
transition: background 0.3s ease;
padding: inherit;
margin-bottom: 10px;
}
.acopyme:hover {
background: #7e7391;
cursor: pointer;
}
.copyme {
direction: ltr;
background: #6a568b;
color: #ffffff;
cursor: pointer;
border-radius: 15px;
/* margin-left: -10px; */
transition: background 0.3s ease;
padding: inherit;
margin-bottom: 10px;
}
.copyme:hover {
background: #7e7391;
cursor: pointer;
}
ul {
list-style-type: none;
background-color: inherit;
color: inherit;
padding-left: 5px;
background: inherit;
justify-content: inherit;
align-items: inherit;
align-content: inherit;
text-align: inherit;
}
ul.r {
list-style-type: none;
background-color: inherit;
color: inherit;
padding-right: 5px;
margin-left: -20px;
background: inherit;
justify-content: inherit;
align-items: inherit;
align-content: inherit;
text-align: inherit;
}
li {
margin-bottom: 20px;
background-color: inherit;
color: inherit;
background: inherit;
padding: inherit;
justify-content: inherit;
align-items: inherit;
align-content: inherit;
text-align: inherit;
}
li:hover {
background: #1a1a1a;
border-color: #7e7391;
border-radius: 15px;
cursor: pointer;
}
div {
display: block;
background-color: inherit;
padding: inherit;
width: inherit;
color: inherit;
background: inherit;
justify-content: inherit;
align-items: inherit;
align-content: inherit;
text-align: inherit;
}
th,
td {
padding-right: 40px;
/* Adjust as needed */
text-align: left;
justify-content: inherit;
align-items: inherit;
align-content: inherit;
text-align: inherit;
}
.container {
overflow: hidden;
justify-content: inherit;
align-items: inherit;
align-content: inherit;
text-align: inherit;
}
.column {
float: left;
margin: 20px;
padding-bottom: 100%;
margin-bottom: -100%;
justify-content: inherit;
align-items: inherit;
align-content: inherit;
text-align: inherit;
}
.header {
width: 100%;
margin: auto;
padding: inherit;
justify-content: inherit;
align-items: inherit;
align-content: inherit;
text-align: inherit;
margin-bottom: 35px;
}
.hiddencopy {
background: #6a568b;
color: #ffffff;
cursor: pointer;
border-radius: 15px;
margin-left: 10px;
transition: background 0.3s ease;
padding: 10px;
margin-bottom: 10px;
display: none;
}
strong {
font-size: 18pt;
}
li.clicked:hover {
border-color: #3d3d3d;
background: #635b72;
margin-bottom: 20px;
border-radius: 15px;
}
.btn {
direction: ltr;
background: #6a568b;
background-color: #6a568b;
cursor: pointer;
border-radius: 10px;
height: inherit;
width: 15%;
/* margin-left: -10px; */
transition: background 0.3s ease;
padding: inherit;
margin-bottom: 10px;
}
form {
margin: auto;
width: 75%;
margin-top: 30px;
}
input[type="text"],
input[type="file"] {
background-color: #6a568b;
border-color: #332150;
color: #ffffff;
width: 30%;
border-radius: 15px;
padding: auto;
padding-left: 10px;
}
::placeholder {
color: #ffffff;
}
.lang {
position: fixed;
float: inline-start;
flex: auto;
width: 100%;
}
#totalus {
background-color: #6a568b;
border-radius: 15px;
}

118
public/script.js Normal file
View File

@@ -0,0 +1,118 @@
function copyValue(elementId) {
/* Get the text field */
var copyText = document.getElementById(elementId).innerText;
/* Create a temporary input field */
var tempInput = document.createElement("input");
tempInput.value = copyText;
document.body.appendChild(tempInput);
/* Select the text field */
tempInput.select();
tempInput.setSelectionRange(0, 99999); /* For mobile devices */
console.log(copyText);
/* Copy the text inside the text field */
navigator.clipboard.writeText(copyText);
/* Remove the temporary input field */
document.body.removeChild(tempInput);
/* Show a toast message */
var toast = document.createElement("div");
toast.innerText = "Copied to clipboard!";
toast.style.position = "fixed";
toast.style.bottom = "20px";
toast.style.left = "50%";
toast.style.transform = "translateX(-50%)";
toast.style.background = "#673AB7";
toast.style.color = "#ffffff";
toast.style.padding = "10px";
toast.style.borderRadius = "5px";
document.body.appendChild(toast);
/* Remove the toast message after 3 seconds */
setTimeout(function () {
document.body.removeChild(toast);
}, 3000);
}
function showAndHide(elementId,liId){
let element = document.getElementById(elementId);
let li = document.getElementById(liId);
element.classList.contains('hiddencopy')? element.classList.remove('hiddencopy'):element.classList.add('hiddencopy');
element.classList.contains('hiddencopy')? li.classList.remove('clicked'):li.classList.add('clicked');
}
function replaceHebrew(elementId, stff){
let element = document.getElementById(elementId);
if (stff == 'Administrative staff'){
element.innerText = "מותר לשימוש בידי צוות מנהלי";
}
else if(stff == 'Students')
{
element.innerText = "מותר לשימוש בידי סטודנטים";
}
}
function insertWarning(elementId, before, lang="en"){
if (elementId == true){
if(lang == "he"){
console.log('fuck');
let elem = document.createElement("div");
elem.id = "התראה";
elem.innerText = "הבהרה: המסך החכם של מיקרוסופט ימנע את ריצת התוכנה. יש ללחוץ על פרטים נוספים -> אפשר";
elem.style.color="#ffffff";
let nodebefore = document.getElementById(before);
nodebefore.insertBefore(elem, nodebefore.children[7])
}
else{
console.log('fuck');
let elem = document.createElement("div");
elem.id = "Warning";
elem.innerText = "Warning: Has Microsoft SmartScreen blue window of block from running. Press more details -> Allow Running";
elem.style.color="#ffffff";
let nodebefore = document.getElementById(before);
nodebefore.insertBefore(elem, nodebefore.children[7])
}
}
}
function downloadValue(elementId, filename){
let text = document.getElementById(elementId).innerText;
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
function scriptPackage(rowid, extracommand, line){
let text = `winget install ${rowid} -s huji`;
console.log(extracommand)
let fub = extracommand.indexOf(' &amp;&amp;')
console.log(`${rowid}, ${fub}`)
console.log(`${rowid}, ${extracommand.length < 2}`)
try{
console.log(text)
if(fub == 0){
text += extracommand;
}
else if((extracommand.length > 2)){
text = extracommand + " && " + text;
}
else if ((fub == -1))
{
text = text;
}
}
catch{
text = text;
}
document.getElementById(`id-${line}`).innerHTML = text;
}
function convertHtml(dt){
return dt.replace("")
}