Skip to content

Commit 311fe15

Browse files
committed
fiddle
1 parent 006b517 commit 311fe15

File tree

295 files changed

+106628
-55
lines changed

Some content is hidden

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

295 files changed

+106628
-55
lines changed

Sloader.Hosts.Web/Controllers/HomeController.cs

-32
This file was deleted.

Sloader.Hosts.Web/Views/Home/Index.cshtml

-8
This file was deleted.

Sloader.Hosts.Web/Views/_ViewImports.cshtml

-3
This file was deleted.

Sloader.sln

+7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sloader.Hosts.Console", "sr
3030
EndProject
3131
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sloader.Hosts.Web", "Sloader.Hosts.Web\Sloader.Hosts.Web.csproj", "{82112B67-5E21-41FE-BB37-B3983AB64A8E}"
3232
EndProject
33+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sloader.Fiddle", "src\Sloader.Fiddle\Sloader.Fiddle\Sloader.Fiddle.csproj", "{1A2C1F17-3249-4BD4-B03A-44C5C16126FA}"
34+
EndProject
3335
Global
3436
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3537
Debug|Any CPU = Debug|Any CPU
@@ -68,6 +70,10 @@ Global
6870
{82112B67-5E21-41FE-BB37-B3983AB64A8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
6971
{82112B67-5E21-41FE-BB37-B3983AB64A8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
7072
{82112B67-5E21-41FE-BB37-B3983AB64A8E}.Release|Any CPU.Build.0 = Release|Any CPU
73+
{1A2C1F17-3249-4BD4-B03A-44C5C16126FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
74+
{1A2C1F17-3249-4BD4-B03A-44C5C16126FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
75+
{1A2C1F17-3249-4BD4-B03A-44C5C16126FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
76+
{1A2C1F17-3249-4BD4-B03A-44C5C16126FA}.Release|Any CPU.Build.0 = Release|Any CPU
7177
EndGlobalSection
7278
GlobalSection(SolutionProperties) = preSolution
7379
HideSolutionNode = FALSE
@@ -81,6 +87,7 @@ Global
8187
{AEF2E474-95DF-4D35-847B-AF47AE82997C} = {5F5D253F-DF32-4C0C-8D58-F7E403C04017}
8288
{8E9B3324-02FD-40FE-ACE3-F221664EA06D} = {AAD09B6A-4BEA-4506-B515-8A62C7376BFB}
8389
{82112B67-5E21-41FE-BB37-B3983AB64A8E} = {AAD09B6A-4BEA-4506-B515-8A62C7376BFB}
90+
{1A2C1F17-3249-4BD4-B03A-44C5C16126FA} = {AAD09B6A-4BEA-4506-B515-8A62C7376BFB}
8491
EndGlobalSection
8592
GlobalSection(ExtensibilityGlobals) = postSolution
8693
SolutionGuid = {6FE999C3-F9AA-4EDA-A577-BE89B9066CE5}

src/Sloader.Config/SloaderConfig.cs

+13-1
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,25 @@ public SloaderConfig()
3434
/// </summary>
3535
/// <param name="ymlLocation">yml-file location as FilePath or URL</param>
3636
/// <param name="secrets">List of secret replacements</param>
37-
/// <returns></returns>
37+
/// <returns>Sloader Config with embedded secrets</returns>
3838
public static async Task<SloaderConfig> Load(string ymlLocation, Dictionary<string, string> secrets)
3939
{
4040
Trace.TraceInformation($"{nameof(SloaderConfig)} loading invoked for '{ymlLocation}'.");
4141
return await SloaderConfigLoader.GetAsync(ymlLocation, secrets);
4242
}
4343

44+
/// <summary>
45+
/// Parse and instantiate the config from a given Yml-string.
46+
/// </summary>
47+
/// <param name="fullConfig">yml-config</param>
48+
/// <param name="secrets">List of secret replacements</param>
49+
/// <returns>Sloader Config with embedded secrets</returns>
50+
public static SloaderConfig Parse(string fullConfig, Dictionary<string, string> secrets)
51+
{
52+
var config = SloaderConfigDeserializer.GetConfigWithEmbeddedSecrets(fullConfig, secrets);
53+
return config;
54+
}
55+
4456
/// <summary>
4557
/// Common list of secrets used for multiple drops or crawlers.
4658
/// </summary>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Sloader.Engine;
3+
using Sloader.Fiddle.Models;
4+
using System.Diagnostics;
5+
6+
namespace Sloader.Fiddle.Controllers
7+
{
8+
public class HomeController : Controller
9+
{
10+
private readonly ILogger<HomeController> _logger;
11+
12+
public HomeController(ILogger<HomeController> logger)
13+
{
14+
_logger = logger;
15+
}
16+
17+
public IActionResult Index()
18+
{
19+
HomeViewModel viewModel = new HomeViewModel();
20+
21+
string sample = """
22+
Crawler:
23+
FeedsToCrawl:
24+
- Url: http://blog.codeinside.eu/feed
25+
LoadSocialLinkCounters: true
26+
Key: Blog
27+
""";
28+
29+
viewModel.Input = sample;
30+
31+
return View(viewModel);
32+
}
33+
34+
[HttpPost]
35+
public async Task<IActionResult> Fiddle(HomeViewModel viewModel)
36+
{
37+
try
38+
{
39+
var runner = new SloaderRunner(Sloader.Config.SloaderConfig.Parse(viewModel.Input, new Dictionary<string, string>()));
40+
var crawlerRun = await runner.RunAllCrawlers();
41+
42+
var json = crawlerRun.ToJson(Newtonsoft.Json.Formatting.Indented);
43+
viewModel.Output = json;
44+
}
45+
catch (Exception exc)
46+
{
47+
viewModel.HasError = true;
48+
viewModel.Output = exc.Message;
49+
}
50+
51+
ModelState.Clear();
52+
53+
return View("Index", viewModel);
54+
}
55+
56+
public IActionResult Privacy()
57+
{
58+
return View();
59+
}
60+
61+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
62+
public IActionResult Error()
63+
{
64+
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
65+
}
66+
}
67+
}

Sloader.Hosts.Web/Models/ErrorViewModel.cs src/Sloader.Fiddle/Sloader.Fiddle/Models/ErrorViewModel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Sloader.Hosts.Web.Models
1+
namespace Sloader.Fiddle.Models
22
{
33
public class ErrorViewModel
44
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Sloader.Fiddle.Models
2+
{
3+
public class HomeViewModel
4+
{
5+
public string Input { get; set; }
6+
public string Output { get; set; }
7+
public bool HasError { get; set; }
8+
}
9+
}
File renamed without changes.

Sloader.Hosts.Web/Properties/launchSettings.json src/Sloader.Fiddle/Sloader.Fiddle/Properties/launchSettings.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
"windowsAuthentication": false,
55
"anonymousAuthentication": true,
66
"iisExpress": {
7-
"applicationUrl": "http://localhost:56776",
8-
"sslPort": 44381
7+
"applicationUrl": "http://localhost:42216",
8+
"sslPort": 44368
99
}
1010
},
1111
"profiles": {
1212
"http": {
1313
"commandName": "Project",
1414
"dotnetRunMessages": true,
1515
"launchBrowser": true,
16-
"applicationUrl": "http://localhost:5169",
16+
"applicationUrl": "http://localhost:5265",
1717
"environmentVariables": {
1818
"ASPNETCORE_ENVIRONMENT": "Development"
1919
}
@@ -22,7 +22,7 @@
2222
"commandName": "Project",
2323
"dotnetRunMessages": true,
2424
"launchBrowser": true,
25-
"applicationUrl": "https://localhost:7284;http://localhost:5169",
25+
"applicationUrl": "https://localhost:7042;http://localhost:5265",
2626
"environmentVariables": {
2727
"ASPNETCORE_ENVIRONMENT": "Development"
2828
}

Sloader.Hosts.Web/Sloader.Hosts.Web.csproj src/Sloader.Fiddle/Sloader.Fiddle/Sloader.Fiddle.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

9+
<ItemGroup>
10+
<ProjectReference Include="..\..\Sloader.Engine\Sloader.Engine.csproj" />
11+
</ItemGroup>
12+
913
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
@model Sloader.Fiddle.Models.HomeViewModel
2+
3+
@section Scripts {
4+
<script src="~/lib/monaco-editor/min/vs/loader.js"></script>
5+
<script>
6+
7+
require.config({ paths: { 'vs': '@Url.Content("~/lib/monaco-editor/min/vs")' } });
8+
9+
require(['vs/editor/editor.main'], function() {
10+
var editor = monaco.editor.create(document.getElementById('sloader-output'), {
11+
value: document.getElementById('sloader-output-value').value,
12+
language: 'json'
13+
});
14+
});
15+
16+
</script>
17+
}
18+
19+
20+
21+
22+
<div class="text-center">
23+
<h1 class="display-4">Sloader Fiddle</h1>
24+
</div>
25+
26+
<form asp-controller="Home" asp-action="Fiddle" method="post">
27+
<div class="form-group">
28+
<label for="sloader-input">Input:</label>
29+
<textarea class="form-control rounded-0" id="sloader-input" asp-for="Input" rows="10"></textarea>
30+
</div>
31+
32+
<br/>
33+
34+
<div class="form-group">
35+
<button type="submit" class="btn btn-primary btn-block">Do it!</button>
36+
</div>
37+
38+
<div class="form-group">
39+
<label for="sloader-output">Output:</label>
40+
<input type="hidden" id="sloader-output-value" value="@Model.Output" />
41+
<div id="sloader-output" style="width:100%;height:600px;border:1px solid grey"></div>
42+
</div>
43+
</form>

Sloader.Hosts.Web/Views/Shared/_Layout.cshtml src/Sloader.Fiddle/Sloader.Fiddle/Views/Shared/_Layout.cshtml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
<head>
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>@ViewData["Title"] - Sloader.Hosts.Web</title>
6+
<title>@ViewData["Title"] - Sloader.Fiddle</title>
77
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
88
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
9-
<link rel="stylesheet" href="~/Sloader.Hosts.Web.styles.css" asp-append-version="true" />
9+
<link rel="stylesheet" href="~/Sloader.Fiddle.styles.css" asp-append-version="true" />
1010
</head>
1111
<body>
1212
<header>
1313
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
1414
<div class="container-fluid">
15-
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Sloader.Hosts.Web</a>
15+
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Sloader.Fiddle</a>
1616
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
1717
aria-expanded="false" aria-label="Toggle navigation">
1818
<span class="navbar-toggler-icon"></span>
@@ -38,7 +38,7 @@
3838

3939
<footer class="border-top footer text-muted">
4040
<div class="container">
41-
&copy; 2025 - Sloader.Hosts.Web - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
41+
&copy; 2025 - Sloader.Fiddle - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
4242
</div>
4343
</footer>
4444
<script src="~/lib/jquery/dist/jquery.min.js"></script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@using Sloader.Fiddle
2+
@using Sloader.Fiddle.Models
3+
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "3.0",
3+
"defaultProvider": "cdnjs",
4+
"libraries": [
5+
{
6+
"provider": "cdnjs",
7+
"library": "[email protected]",
8+
"destination": "wwwroot/lib/monaco-editor/"
9+
}
10+
]
11+
}

src/Sloader.Fiddle/Sloader.Fiddle/wwwroot/lib/monaco-editor/min-maps/nls.messages.de.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Sloader.Fiddle/Sloader.Fiddle/wwwroot/lib/monaco-editor/min-maps/nls.messages.es.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Sloader.Fiddle/Sloader.Fiddle/wwwroot/lib/monaco-editor/min-maps/nls.messages.fr.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Sloader.Fiddle/Sloader.Fiddle/wwwroot/lib/monaco-editor/min-maps/nls.messages.it.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Sloader.Fiddle/Sloader.Fiddle/wwwroot/lib/monaco-editor/min-maps/nls.messages.ja.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Sloader.Fiddle/Sloader.Fiddle/wwwroot/lib/monaco-editor/min-maps/nls.messages.ko.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Sloader.Fiddle/Sloader.Fiddle/wwwroot/lib/monaco-editor/min-maps/nls.messages.ru.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Sloader.Fiddle/Sloader.Fiddle/wwwroot/lib/monaco-editor/min-maps/nls.messages.zh-cn.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Sloader.Fiddle/Sloader.Fiddle/wwwroot/lib/monaco-editor/min-maps/nls.messages.zh-tw.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Sloader.Fiddle/Sloader.Fiddle/wwwroot/lib/monaco-editor/min-maps/vs/base/worker/workermain.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Sloader.Fiddle/Sloader.Fiddle/wwwroot/lib/monaco-editor/min-maps/vs/editor/editor.main.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Sloader.Fiddle/Sloader.Fiddle/wwwroot/lib/monaco-editor/min-maps/vs/loader.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)