Skip to content

Commit 1f5e983

Browse files
author
reven
committed
got docker build going
1 parent ed99306 commit 1f5e983

File tree

75 files changed

+144
-74085
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+144
-74085
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ obj/
66
bin/
77
Server/Plugins/
88
VideoTests/*
9+
zpublish/*
10+
wpublish/*
11+
dockerbuild.ps1

Client/Components/Editor/Editor.razor.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,15 @@ private T GetParameter<T>(ElementField field, string parameter)
159159
var val = dict[parameter];
160160
if (val == null)
161161
return default(T);
162-
return (T)FileFlow.Shared.Converter.ConvertObject(typeof(T), val);
162+
try
163+
{
164+
return (T)FileFlow.Shared.Converter.ConvertObject(typeof(T), val);
165+
}
166+
catch (Exception)
167+
{
168+
Logger.Instance.ELog("Failed converted: " + parameter, val);
169+
return default(T);
170+
}
163171
}
164172

165173
private T GetValue<T>(string field, T @default = default(T))

Client/Pages/Libraries/Libraries.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public override async Task Edit(Library library)
6565
InputType = FileFlow.Plugin.FormInputType.Select,
6666
Name = nameof(library.Flow),
6767
Parameters = new Dictionary<string, object>{
68-
{ "Options", flowOptions }
68+
{ "Options", flowOptions.ToList() }
6969
}
7070
});
7171
fields.Add(new ElementField

Client/wwwroot/index.html

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,29 @@
3636
<a href="" class="reload">Reload</a>
3737
<a class="dismiss">🗙</a>
3838
</div>
39-
<script src="_framework/blazor.webassembly.js"></script>
39+
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
40+
<script type="module">
41+
import { BrotliDecode } from './scripts/decode.min.js';
42+
Blazor.start({
43+
loadBootResource: function (type, name, defaultUri, integrity) {
44+
if (type !== 'dotnetjs') {
45+
return (async function () {
46+
const response = await fetch(defaultUri + '.br', { cache: 'no-cache' });
47+
if (!response.ok) {
48+
throw new Error(response.statusText);
49+
}
50+
const originalResponseBuffer = await response.arrayBuffer();
51+
const originalResponseArray = new Int8Array(originalResponseBuffer);
52+
const decompressedResponseArray = BrotliDecode(originalResponseArray);
53+
const contentType = type ===
54+
'dotnetwasm' ? 'application/wasm' : 'application/octet-stream';
55+
return new Response(decompressedResponseArray,
56+
{ headers: { 'content-type': contentType } });
57+
})();
58+
}
59+
}
60+
});
61+
</script>
4062
<script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script>
4163
<script src="scripts/app.js"></script>
4264
<script src="scripts/flow.js"></script>

Client/wwwroot/scripts/decode.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM ubuntu:20.04
2+
#FROM alpine:3.14
3+
4+
# expose the ports we need
5+
EXPOSE 5000
6+
7+
RUN apt-get update \
8+
&& apt-get upgrade -y \
9+
&& apt-get dist-upgrade -y \
10+
&& apt-get install -fy \
11+
libssl-dev
12+
13+
# copy the publish into the app
14+
COPY /zpublish /app
15+
16+
# set the working directory
17+
WORKDIR /app
18+
19+
# run the server
20+
ENTRYPOINT [ "/app/Server", "--urls", "http://*:5000" ]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace FileFlow.Server.Controllers
2+
{
3+
using Microsoft.AspNetCore.Mvc;
4+
5+
public class HomeController : Controller
6+
{
7+
public IActionResult Spa() => File("~/index.html", "text/html");
8+
}
9+
}

Server/Controllers/PluginController.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,21 @@ public PluginInfo SaveSettings([FromRoute] Guid uid, [FromBody] ExpandoObject se
6868
public string LanguageFile([FromQuery] string langCode = "en")
6969
{
7070
var json = "{}";
71-
foreach (var jf in Directory.GetFiles("plugins", "*.json"))
71+
try
7272
{
73-
if (jf.Contains(".deps."))
74-
continue;
75-
try
73+
foreach (var jf in Directory.GetFiles("plugins", "*.json"))
7674
{
77-
string updated = JsonHelper.Merge(json, System.IO.File.ReadAllText(jf));
78-
json = updated;
75+
if (jf.Contains(".deps."))
76+
continue;
77+
try
78+
{
79+
string updated = JsonHelper.Merge(json, System.IO.File.ReadAllText(jf));
80+
json = updated;
81+
}
82+
catch (Exception) { }
7983
}
80-
catch (Exception) { }
8184
}
85+
catch (Exception) { }
8286
return json;
8387
}
8488
}

Server/Helpers/DbHelper.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ public class DbHelper
1414
private static IDatabase GetDb()
1515
{
1616

17-
if (!File.Exists("Data/FileFlow.sqlite"))
17+
if (File.Exists("Data/FileFlow.sqlite") == false)
1818
{
19+
if (Directory.Exists("Data") == false)
20+
Directory.CreateDirectory("Data");
21+
1922
SQLiteConnection.CreateFile("Data/FileFlow.sqlite");
2023

2124
string sql = @$"CREATE TABLE {nameof(DbObject)}(

Server/Helpers/PluginHelper.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ public static IPlugin GetPlugin(string assemblyName)
7979
public static List<PluginInfo> GetPlugins()
8080
{
8181
List<PluginInfo> results = new List<PluginInfo>();
82+
if (Directory.Exists("Plugins") == false)
83+
Directory.CreateDirectory("Plugins");
84+
8285
foreach (var dll in new DirectoryInfo("Plugins").GetFiles("*.dll"))
8386
{
8487
Logger.Instance.DLog("Checking dll: " + dll.Name);

0 commit comments

Comments
 (0)