Skip to content

Commit

Permalink
**update** initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
spaytac committed Feb 1, 2023
0 parents commit 0a1e04d
Show file tree
Hide file tree
Showing 89 changed files with 2,978 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
**/appsettings.json
**/appsettings.*.json
LICENSE
README.md
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/
**/.env
.env
13 changes: 13 additions & 0 deletions .idea/.idea.Linkding.Sync/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/.idea.Linkding.Sync/.idea/active-tab-highlighter.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/.idea.Linkding.Sync/.idea/aws.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

414 changes: 414 additions & 0 deletions .idea/.idea.Linkding.Sync/.idea/dbnavigator.xml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions .idea/.idea.Linkding.Sync/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .idea/.idea.Linkding.Sync/.idea/git_toolbox_prj.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/.idea.Linkding.Sync/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.Linkding.Sync/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions Dockerfile_Linkding
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["src/Linkding/Linkding.csproj", "src/Linkding/"]
RUN dotnet restore "src/Linkding/Linkding.csproj"
COPY . .
WORKDIR "/src/src/Linkding"
RUN dotnet build "Linkding.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Linkding.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
RUN mkdir ./data
ENTRYPOINT ["dotnet", "Linkding.dll"]
19 changes: 19 additions & 0 deletions Dockerfile_Wallabag
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["src/Wallabag/Wallabag.csproj", "src/Wallabag/"]
RUN dotnet restore "src/Wallabag/Wallabag.csproj"
COPY . .
WORKDIR "/src/src/Wallabag"
RUN dotnet build "Wallabag.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Wallabag.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
RUN mkdir ./data
ENTRYPOINT ["dotnet", "Wallabag.dll"]
61 changes: 61 additions & 0 deletions Linkding.Sync.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3167CB7E-6412-49DB-BB42-E91E07B51C5E}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Services", "Services", "{2775FBD9-7954-4A8B-8831-31C7670209A3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Linkding.Client", "src\Services\Linkding.Client\Linkding.Client.csproj", "{1880BB32-4013-45F5-9DB4-6864F9836525}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wallabag.Client", "src\Services\Wallabag.Client\Wallabag.Client.csproj", "{2776E05F-F35A-4421-A792-0F9B0CC48475}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Domain", "Domain", "{586A8F51-1A5D-42B9-8A37-8B2010905EB1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "src\Domain\Core\Core.csproj", "{0EA1E116-6560-4C1D-8EC8-6ACE3F5E1C25}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{953FCC4E-C759-47DD-B20A-78FBA2E34F35}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wallabag", "src\Wallabag\Wallabag.csproj", "{5EFB26BC-CD34-4DE6-B0E3-9F1E387D4177}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Linkding", "src\Linkding\Linkding.csproj", "{3E78F171-D237-46DF-8A27-DAADE7CA1940}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1880BB32-4013-45F5-9DB4-6864F9836525}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1880BB32-4013-45F5-9DB4-6864F9836525}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1880BB32-4013-45F5-9DB4-6864F9836525}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1880BB32-4013-45F5-9DB4-6864F9836525}.Release|Any CPU.Build.0 = Release|Any CPU
{2776E05F-F35A-4421-A792-0F9B0CC48475}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2776E05F-F35A-4421-A792-0F9B0CC48475}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2776E05F-F35A-4421-A792-0F9B0CC48475}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2776E05F-F35A-4421-A792-0F9B0CC48475}.Release|Any CPU.Build.0 = Release|Any CPU
{0EA1E116-6560-4C1D-8EC8-6ACE3F5E1C25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0EA1E116-6560-4C1D-8EC8-6ACE3F5E1C25}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0EA1E116-6560-4C1D-8EC8-6ACE3F5E1C25}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0EA1E116-6560-4C1D-8EC8-6ACE3F5E1C25}.Release|Any CPU.Build.0 = Release|Any CPU
{5EFB26BC-CD34-4DE6-B0E3-9F1E387D4177}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5EFB26BC-CD34-4DE6-B0E3-9F1E387D4177}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5EFB26BC-CD34-4DE6-B0E3-9F1E387D4177}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5EFB26BC-CD34-4DE6-B0E3-9F1E387D4177}.Release|Any CPU.Build.0 = Release|Any CPU
{3E78F171-D237-46DF-8A27-DAADE7CA1940}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E78F171-D237-46DF-8A27-DAADE7CA1940}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E78F171-D237-46DF-8A27-DAADE7CA1940}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E78F171-D237-46DF-8A27-DAADE7CA1940}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{2775FBD9-7954-4A8B-8831-31C7670209A3} = {3167CB7E-6412-49DB-BB42-E91E07B51C5E}
{1880BB32-4013-45F5-9DB4-6864F9836525} = {2775FBD9-7954-4A8B-8831-31C7670209A3}
{2776E05F-F35A-4421-A792-0F9B0CC48475} = {2775FBD9-7954-4A8B-8831-31C7670209A3}
{586A8F51-1A5D-42B9-8A37-8B2010905EB1} = {3167CB7E-6412-49DB-BB42-E91E07B51C5E}
{0EA1E116-6560-4C1D-8EC8-6ACE3F5E1C25} = {586A8F51-1A5D-42B9-8A37-8B2010905EB1}
{953FCC4E-C759-47DD-B20A-78FBA2E34F35} = {3167CB7E-6412-49DB-BB42-E91E07B51C5E}
{5EFB26BC-CD34-4DE6-B0E3-9F1E387D4177} = {3167CB7E-6412-49DB-BB42-E91E07B51C5E}
{3E78F171-D237-46DF-8A27-DAADE7CA1940} = {3167CB7E-6412-49DB-BB42-E91E07B51C5E}
EndGlobalSection
EndGlobal
126 changes: 126 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Linkding Sync
LinkdingSync is a collection of tools that make life with [Linkding](https://github.com/sissbruecker/linkding) easier.

One of the workers is for syncing to [Wallabag](https://wallabag.org/en).

## Getting Started
It is recommended to use the Docker images. Otherwise, a .NET 6 environment is required to customize and build the code.

## Environment Variables
For the containers to work, the environment variables must be passed. This can be done either directly via the Docker run **-e** switch, via the **environment** settings in a Docker compose definition, or via an environment variable file.

### WallabagSync
Environment variables for the wallabag worker.

| Variable | Value | Description | Attention |
|------------------------|-----------|--------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Worker__Intervall | int (>=0) | This value sets the execution schedule in minutes. 1 = every minute, 10 = every 10 minutes (default value 0) | 0 = runs only one time. The container will be stopped after the execution. This method is the preferred way to run the container with a scheduler (e.g. cron) |
| Worker__SyncTag | text | The linkding tag to create the bookmarks in Wallabag. (default value 'readlater') | |
| Linkding__Url | text | URL to the linkding instance | |
| Linkding__Key | text | The linkding application key | [Instructions](https://github.com/sissbruecker/linkding/blob/master/docs/API.md) |
| Wallabag__Url | text | URL to the Wallabag instance | |
| Wallabag__Username | text | Wallabag User Name | |
| Wallabag__Password | text | Wallabag User Password | |
| Wallabag__ClientId | text | Wallabag Client Id | |
| Wallabag__ClientSecret | text | Wallabag Client Secret | |

### LinkdingUpdater
Environment variables for the linkding worker.

| Variable | Value | Description | Attention |
|------------------------|-----------|--------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Worker__Intervall | int (>=0) | This value sets the execution schedule in minutes. 1 = every minute, 10 = every 10 minutes | 0 = runs only one time. The container will be stopped after the execution. This method is the preferred way to run the container with a scheduler (e.g. cron) |
| Worker__SyncTag | text | The linkding tag to create the bookmarks in Wallabag. | |
| Linkding__Url | text | URL to the linkding instance | |
| Linkding__Key | text | The linkding application key | [Instructions](https://github.com/sissbruecker/linkding/blob/master/docs/API.md) |

## Configuration
The following explains the configuration options.
### WallabagSync
The configuration is optional. In the configuration (**YAML File**) rules can be defined in regex to exclude certain domains from sync.

Exampel:
````yaml
excludedDomains:
- name: youtube
pattern: 'https://[[a-zA-Z0-9]+\.]?(youtube)\.com(?:/.*)?'
- name: ebay
pattern: 'https://[[a-zA-Z0-9]+\.]?(ebay)\.(com|de|fr)(?:/.*)?'
- name: amazon
pattern: 'https://[[a-zA-Z0-9]+\.]?(amazon)\.(com|de|fr)(?:/.*)?'
````
With this configuration every matching bookmark from linkding will be excluded from the sync.

### LinkdingUpdater
The configuration is optional. In the configuration (**YAML File**) rules can be defined in regex to assign tags dynamically. Additionally tags can be defined to domains.

If operated without a configuration file, only the year of the tag is added (currently).

Example:
````yaml
urlTagMapping:
- name: microsoft_azure
url: https://github.com/azure
- name: microsoft_azuread
url: https://github.com/AzureAD
- name: microsoft_dotnet
url: https://github.com/dotnet-architecture

taggingRule:
- name: reddit
pattern: https://(?:www\.)?(reddit)\.com(?:/r/)?([ a-zA-Z0-9\-\+_ ]+)?(?:/.*)?
replace: $1,$2
- name: microsoft
pattern: https://([ a-zA-Z0-9 ]+)?[ \. ]?(microsoft)\.com(?:/.*)?
replace: $1,$2
- name: microsoft_docs
pattern: 'https://(?:docs)\.(?:microsoft)\.com[ / ]?(?: [ a-zA-Z0-9\-\+_ ]+)(?:/)?([ a-zA-Z0-9\-\+_ ]+)?(?:/)?([ a-zA-Z0-9\-\+_ ]+)?(?:/.*)?'
replace: $1,$2
- name: youtube
pattern: https://[ [ a-zA-Z0-9 ]+\. ]?(youtube)\.com(?:/.*)?
replace: $1
- name: ebay
pattern: https://[ [ a-zA-Z0-9 ]+\. ]?(ebay)\.(com|de|fr)(?:/.*)?
replace: $1
- name: amazon
pattern: https://[ [ a-zA-Z0-9 ]+\. ]?(amazon)\.(com|de|fr)(?:/.*)?
replace: $1
- name: docker
pattern: https://([ a-zA-Z0-9 ]+)?[ \. ]?(docker)\.com(?:/.*)?
replace: $1,$2
- name: xbox
pattern: https://[ [ a-zA-Z0-9 ]+\. ]?(xbox)\.com(?:/.*)?
replace: $1
- name: github
pattern: https://([ a-zA-Z0-9 ]+)?[ \. ]?(github)\.com[ / ]?([ a-zA-Z0-9\-\+_ ]+)(?:/)?([ a-zA-Z0-9\-\+_ ]+)?(?:/.*)?
replace: $1,$2,$3,$4
- name: github.io
pattern: https://([ a-zA-Z0-9 ]+)\.(github)\.io[ / ]?([ a-zA-Z0-9\-\+_ ]+)(?:/)?([ a-zA-Z0-9\-\+_ ]+)?(?:/.*)?
replace: $1,$2,$3
````

## Docker Run
```
docker run --rm -it --env-file .env -v <path>/config.yml:/app/data/config.yml linkdingsync/wallabag:latest
```

You can also

## Docker Compose
You can find [examples](./examples/) in the examples folder..

- [Wallabag Example](./examples/wallabag/)
- [LinkdingUpdater Example](./examples/linkding/)


## Build Docker Image

### LinkdingUpdater
```
docker build -t linkdingsync/linkdingupdater:latest -f .\Dockerfile_Linkding .
```

### WallabagSync
```
docker build -t linkdingsync/wallabag:latest -f .\Dockerfile_Wallabag .
```
39 changes: 39 additions & 0 deletions examples/linkding/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
urlTagMapping:
- name: microsoft_azure
url: https://github.com/azure
- name: microsoft_azuread
url: https://github.com/AzureAD
- name: microsoft_dotnet
url: https://github.com/dotnet-architecture

taggingRule:
- name: reddit
pattern: https://(?:www\.)?(reddit)\.com(?:/r/)?([ a-zA-Z0-9\-\+_ ]+)?(?:/.*)?
replace: $1,$2
- name: microsoft
pattern: https://([ a-zA-Z0-9 ]+)?[ \. ]?(microsoft)\.com(?:/.*)?
replace: $1,$2
- name: microsoft_docs
pattern: 'https://(?:docs)\.(?:microsoft)\.com[ / ]?(?: [ a-zA-Z0-9\-\+_ ]+)(?:/)?([ a-zA-Z0-9\-\+_ ]+)?(?:/)?([ a-zA-Z0-9\-\+_ ]+)?(?:/.*)?'
replace: $1,$2
- name: youtube
pattern: https://[ [ a-zA-Z0-9 ]+\. ]?(youtube)\.com(?:/.*)?
replace: $1
- name: ebay
pattern: https://[ [ a-zA-Z0-9 ]+\. ]?(ebay)\.(com|de|fr)(?:/.*)?
replace: $1
- name: amazon
pattern: https://[ [ a-zA-Z0-9 ]+\. ]?(amazon)\.(com|de|fr)(?:/.*)?
replace: $1
- name: docker
pattern: https://([ a-zA-Z0-9 ]+)?[ \. ]?(docker)\.com(?:/.*)?
replace: $1,$2
- name: xbox
pattern: https://[ [ a-zA-Z0-9 ]+\. ]?(xbox)\.com(?:/.*)?
replace: $1
- name: github
pattern: https://([ a-zA-Z0-9 ]+)?[ \. ]?(github)\.com[ / ]?([ a-zA-Z0-9\-\+_ ]+)(?:/)?([ a-zA-Z0-9\-\+_ ]+)?(?:/.*)?
replace: $1,$2,$3,$4
- name: github.io
pattern: https://([ a-zA-Z0-9 ]+)\.(github)\.io[ / ]?([ a-zA-Z0-9\-\+_ ]+)(?:/)?([ a-zA-Z0-9\-\+_ ]+)?(?:/.*)?
replace: $1,$2,$3
Loading

0 comments on commit 0a1e04d

Please sign in to comment.