mirror of
https://github.com/C9Glax/tranga.git
synced 2025-09-10 20:08:19 +02:00
Compare commits
4 Commits
bubez81/mw
...
cuttingedg
Author | SHA1 | Date | |
---|---|---|---|
57cb48cbd0 | |||
611e8a04df | |||
6231f9a842 | |||
7f9bea00a4 |
6
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
6
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -1,13 +1,13 @@
|
||||
name: Bug Report
|
||||
description: File a bug report
|
||||
title: "[It broke]: "
|
||||
title: "[Tranga broke]: <title>"
|
||||
labels: ["bug"]
|
||||
body:
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What is broken?
|
||||
description: What happened? How did we get here?
|
||||
placeholder: The place where you tell me what you expected to happen, and what happened instead.
|
||||
placeholder: Tell me what you expected to happen, and what happened instead.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
@@ -18,4 +18,4 @@ body:
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional stuff
|
||||
description: Screenshots, anything you think might help
|
||||
description: Screenshots, anything you think might help
|
13
.github/ISSUE_TEMPLATE/new_connector.yml
vendored
13
.github/ISSUE_TEMPLATE/new_connector.yml
vendored
@@ -1,6 +1,6 @@
|
||||
name: New Connector Request
|
||||
description: Request a new site to be added
|
||||
title: "[New Connector]: "
|
||||
title: "[New Connector]: <title>"
|
||||
labels: ["New Connector"]
|
||||
body:
|
||||
- type: input
|
||||
@@ -9,15 +9,12 @@ body:
|
||||
placeholder: https://
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Is the Website free to access?
|
||||
description: We can't support pay-to-use sites, or captcha-proxied sites as Cloudflare.
|
||||
options:
|
||||
- label: The Website is freely accessible.
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Anything else?
|
||||
validations:
|
||||
required: false
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
If you want implement this read [Contributing](https://github.com/C9Glax/tranga#contributing). Thank you!
|
31
.github/PULL_REQUEST_TEMPLATE/new_connector.yml
vendored
Normal file
31
.github/PULL_REQUEST_TEMPLATE/new_connector.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
name: New Connector Implementation
|
||||
description: New Connector
|
||||
title: "<title>"
|
||||
labels: ["New Connector"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for contributing. Please make sure you have read [Contributing](https://github.com/C9Glax/tranga#contributing).
|
||||
Just for the sake of completion:
|
||||
- type: checkboxes
|
||||
id: Contributing
|
||||
attributes:
|
||||
label: Contributing
|
||||
description: I have checked
|
||||
options:
|
||||
- label: Formatting (if not done yet, mark this PR as draft)
|
||||
required: false
|
||||
- label: I have read https://github.com/C9Glax/tranga#if-you-want-to-add-a-new-website-connector
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Existing Issue
|
||||
placeholder: #<Issue number>
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Anything else?
|
||||
validations:
|
||||
required: false
|
@@ -324,7 +324,7 @@ public class MangaDex : MangaConnector
|
||||
{
|
||||
string? id = jToken.Value<string>("id");
|
||||
JToken? attributes = jToken["attributes"];
|
||||
string? chapterStr = attributes?.Value<string>("chapter");
|
||||
string? chapterStr = attributes?.Value<string>("chapter") ?? "0";
|
||||
string? volumeStr = attributes?.Value<string>("volume");
|
||||
int? volumeNumber = null;
|
||||
string? title = attributes?.Value<string>("title");
|
||||
|
@@ -73,24 +73,23 @@ public abstract class BaseWorker : Identifiable
|
||||
{
|
||||
// Start the worker
|
||||
Log.Debug($"Checking {this}");
|
||||
this._cancellationTokenSource = new(TimeSpan.FromMinutes(10));
|
||||
this.State = WorkerExecutionState.Waiting;
|
||||
_cancellationTokenSource = new(TimeSpan.FromMinutes(10));
|
||||
State = WorkerExecutionState.Waiting;
|
||||
|
||||
// Wait for dependencies, start them if necessary
|
||||
BaseWorker[] missingDependenciesThatNeedStarting = MissingDependencies.Where(d => d.State < WorkerExecutionState.Waiting).ToArray();
|
||||
if(missingDependenciesThatNeedStarting.Any())
|
||||
return new Task<BaseWorker[]>(() => missingDependenciesThatNeedStarting);
|
||||
return new (() => missingDependenciesThatNeedStarting);
|
||||
|
||||
if (MissingDependencies.Any())
|
||||
return new Task<BaseWorker[]>(WaitForDependencies);
|
||||
return new (WaitForDependencies);
|
||||
|
||||
// Run the actual work
|
||||
Log.Info($"Running {this}");
|
||||
DateTime startTime = DateTime.UtcNow;
|
||||
Task<BaseWorker[]> task = new Task<BaseWorker[]>(() => DoWorkInternal().Result);
|
||||
State = WorkerExecutionState.Running;
|
||||
Task<BaseWorker[]> task = DoWorkInternal();
|
||||
task.GetAwaiter().OnCompleted(Finish(startTime, callback));
|
||||
this.State = WorkerExecutionState.Running;
|
||||
task.Start();
|
||||
return task;
|
||||
}
|
||||
|
||||
|
62
README.md
62
README.md
@@ -88,7 +88,7 @@ Endpoints are documented in Swagger. Just spin up an instance, and go to `http:/
|
||||
## Built With
|
||||
|
||||
- ASP.NET
|
||||
- Entity Framework Core
|
||||
- Entity Framework Core (EF Core)
|
||||
- [PostgreSQL](https://www.postgresql.org/about/licence/)
|
||||
- [Ngpsql](https://github.com/npgsql/npgsql/blob/main/LICENSE)
|
||||
- [Swagger](https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/master/LICENSE)
|
||||
@@ -140,7 +140,7 @@ Downloads (default) are stored in - but this can be configured in `settings.json
|
||||
- Linux `/Manga`
|
||||
- Windows `%currentDirectory%/Downloads`
|
||||
|
||||
#### Prerequisits
|
||||
### Prerequisits
|
||||
|
||||
[.NET-Core 9.0](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)
|
||||
|
||||
@@ -149,15 +149,54 @@ Downloads (default) are stored in - but this can be configured in `settings.json
|
||||
|
||||
If you want to contribute, please feel free to fork and create a Pull-Request!
|
||||
|
||||
General rules:
|
||||
- Strongly-type your variables. This improves readability.
|
||||
```csharp
|
||||
var xyz = Object.GetSomething(); //Do not do this. What type is xyz (without looking at Method returns etc.)?
|
||||
Manga[] zyx = Object.GetAnotherThing(); //I can now easily see that zyx is an Array.
|
||||
```
|
||||
Tranga is using a code-first Entity-Framework Core approach. If you modify the db-table structure you need to create a migration.
|
||||
### General rules
|
||||
|
||||
**A broad overview of where is what:**<br />
|
||||
- Strong-type your variables. This improves readability.
|
||||
- **DO**
|
||||
```csharp
|
||||
Manga[] zyx = Object.GetAnotherThing(); //I can see that zyx is an Array, without digging through more code
|
||||
```
|
||||
- **DO _NOT_**
|
||||
```csharp
|
||||
var xyz = Object.GetSomething(); //What is xyz? An Array? A string? An object?
|
||||
```
|
||||
|
||||
- Indent your `if` and `for` blocks
|
||||
- **DO**
|
||||
```csharp
|
||||
if(true)
|
||||
return false;
|
||||
```
|
||||
- **DO _NOT_**
|
||||
```csharp
|
||||
if(true) return false;
|
||||
```
|
||||
<details>
|
||||
<summary>Because try reading this</summary>
|
||||
|
||||
```csharp
|
||||
if (s.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || s.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) return s;
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
- When using shorthand, _this_ improves readability for longer lines (at some point just use if-else...):
|
||||
```csharp
|
||||
bool retVal = xyz is true
|
||||
? false
|
||||
: true;
|
||||
```
|
||||
```csharp
|
||||
bool retVal = xyz?
|
||||
?? abc?
|
||||
?? true;
|
||||
```
|
||||
|
||||
### Database and EF Core
|
||||
|
||||
Tranga is using a **code-first** EF-Core approach. If you modify the database(context) structure you need to create a migration.
|
||||
|
||||
### A broad overview of where is what:
|
||||
|
||||

|
||||
|
||||
@@ -167,7 +206,8 @@ Tranga is using a code-first Entity-Framework Core approach. If you modify the d
|
||||
- `MangaDownloadClients/**` Networking-Clients for Scraping
|
||||
- `Controllers/**` ASP.NET Controllers (Endpoints)
|
||||
|
||||
If you want to add a new Website-Connector: <br />
|
||||
##### If you want to add a new Website-Connector:
|
||||
|
||||
1. Copy one of the existing connectors, or start from scratch and inherit from `API.Schema.MangaConnectors.MangaConnector`.
|
||||
2. Add the new Connector as Object-Instance in `Tranga.cs` to the MangaConnector-Array `connectors`.
|
||||
|
||||
|
Reference in New Issue
Block a user