Get more done on packageserver

This commit is contained in:
2025-07-12 03:33:45 -05:00
parent 35960d5db0
commit 92f21917b1
7 changed files with 137 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
bin
obj

26
Templates/gui/cross.json Normal file
View File

@@ -0,0 +1,26 @@
{
"dependencies": [
],
"info": {
"template_extra_text_ftles": [
"res/layout.json"
],
"template_ignored_files": [
"bin",
"obj"
],
"template_info": {
"type": "app",
"license": "MIT"
},
"template_name": "gui",
"template_project_dependencies": [
],
"repo": "https://onedev.site.tesses.net/CrossLang/CrossLangExtras",
"homepage": "https://crosslang.tesseslanguage.com/",
"type": "template",
"description": "A crosslang gui, using tesses-framework's gui library"
},
"name": "Tesses.CrossLang.Template.GUI",
"version": "1.0.0.0-prod"
}

View File

@@ -0,0 +1,33 @@
{
"Child": {
"Type": "AbsoluteView",
"Items": [
{
"Bounds": {
"X": 42,
"Y": 42,
"Width": 200,
"Height": 50
},
"Type": "ButtonView",
"Text": "Click Me",
"Id": "btn1",
"Active": true
}
]
},
"Palette": {
"IsDarkMode": true,
"Accent": "#DB0",
"Border": "#040",
"BorderActive":"#A00",
"BorderHover": "#00A",
"BorderHoverActive": "#A0A",
"FontSize": 20
},
"Size": {
"Width": 640,
"Height": 480
},
"Text": "%PROJECT_NAME%"
}

View File

@@ -0,0 +1,18 @@
func btn1_Click(sender,e)
{
Console.WriteLine("Button Clicked");
}
func main(args)
{
if(TypeOf(GUI) != "Dictionary")
{
Console.WriteLine("The GUI is not supported, please build tessesframework with TESSESFRAMEWORK_ENABLE_SDL2.");
return 1;
}
var window = GUI.Window.FromJSON(embed("layout.json"), SDL2.Window.Resizable);
var btn1 = window.FindViewById("btn1");
btn1.Click += btn1_Click;
VM.RunEventLoop();
btn.Click -= btn1_Click;
window.Dispose(); //we need to destroy it or it will leak
}

View File

@@ -0,0 +1,14 @@
func Pages.API.Index()
{
var pages=[{
active = true,
route = "/api",
text = "API Home"
}];
var html = <null>
<h1>API Home</h1>
<ul>
<li><a href="./api-v1">v1</a></li>
</ul></null>;
return Shell("CPKG API Home", pages,html);
}

View File

@@ -0,0 +1,34 @@
func Pages.API.V1()
{
var pages=[{
active = false,
route = "/api",
text = "API Home"
}];
var html = <null>
<h1>API v1</h1>
<ul>
<li>
GET /api/v1/package_icon.png?name=PACKAGENAME&version=1.0.0.0-prod<br>
Gets the package icon for the package<br>
<br>
query:<br>
<code>name</code>: the name of the package<br>
<code>version</code>: the version of the package<br>
<br>
response: image/png of package
</li>
<li>
GET /api/v1/latest?name=PACKAGENAME<br>
Gets the latest version of a package<br>
<br>
query:<br>
<code>name</code>: the name of the package<br>
<br>
response: json dictionary with a single key <code>version</code> with the string value of the latest version<br>
</li>
</ul>
</null>;
return Shell("CPKG API v1", pages,html);
}

View File

@@ -0,0 +1,10 @@
func Tesses.CrossLang.Shell.App(dd)
{
if(dd.Arguments.Count == 1)
{
var window = new GUI.Window("CrossLang",640,480,SDL2.Window.Resizable);
window.View = new GUI.ButtonView("My Favorite Button");
VM.RunEventLoop();
}
}