Skip to content

Commit f6ec4b7

Browse files
committed
minor fixes
1 parent 0732ba3 commit f6ec4b7

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

Spixi/MiniApps/MiniApp.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ public MiniApp(string[] app_info, string? app_url = null)
8686
break;
8787

8888
case "url":
89-
url = value;
89+
if (IxiUtils.IsValidUrl(value))
90+
{
91+
url = value;
92+
}
9093
break;
9194

9295
case "contentUrl":

Spixi/MiniApps/MiniAppManager.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void stop()
133133
public string installFromUrl(MiniApp fetchedAppInfo)
134134
{
135135
// Check for contentUrl first
136-
if (string.IsNullOrWhiteSpace(fetchedAppInfo.contentUrl) || !Uri.TryCreate(fetchedAppInfo.contentUrl, UriKind.Absolute, out Uri uri) || uri.Scheme != Uri.UriSchemeHttps)
136+
if (string.IsNullOrWhiteSpace(fetchedAppInfo.contentUrl) || !IxiUtils.IsValidUrl(fetchedAppInfo.contentUrl))
137137
{
138138
Logging.error("Invalid or insecure app content URL: " + fetchedAppInfo.contentUrl);
139139
return null;
@@ -169,7 +169,7 @@ public string installFromUrl(MiniApp fetchedAppInfo)
169169
}
170170
}
171171

172-
app_name = installFromPath(source_app_file_path, fetchedAppInfo.contentUrl);
172+
app_name = installFromPath(source_app_file_path, fetchedAppInfo.url);
173173
if (File.Exists(source_app_file_path))
174174
{
175175
File.Delete(source_app_file_path);
@@ -283,7 +283,10 @@ public string installFromPath(string source_path, string? url = null)
283283

284284
app.contentSize = new FileInfo(source_path).Length;
285285
app.checksum = Crypto.sha256OfFile(source_path);
286-
app.url = url;
286+
if (url != null)
287+
{
288+
app.url = url;
289+
}
287290
app_name = app.name;
288291

289292
// TODO sig check

Spixi/Pages/Home/HomePage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ public void loadChats()
853853
else if (msgs == null
854854
|| msgs.Count == 0)
855855
{
856-
friend.metaData.setLastMessage(null, 0);
856+
lastmsg.sent = true;
857857
friend.metaData.unreadMessageCount = 0;
858858
friend.saveMetaData();
859859
continue;

0 commit comments

Comments
 (0)