dasblog-core icon indicating copy to clipboard operation
dasblog-core copied to clipboard

Support for Spam Filtering Using Akismet.

Open thousandtyone opened this issue 3 years ago • 4 comments

PR Contains Fix as described in #599. Entire end to end flow has been tested and works. Here are the high level changes that are done:

  1. Migrated the Akismet projects using DotNet Upgrade Assistant. More information about this tool is at: https://docs.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview. The migration was smooth without any errors and the entire project was moved over to .NET Core 6.0.
  2. Wrote code to integrate with the project. (Very similar to the old DasBlog project). Note that some simple changes were done to fit in the correct structure. E.g. Akismet with spam moderation works fine and integrates in correct comment moderation framework. Without comment moderation, any spam detected by Akismet is stopped from getting posted using validations.
  3. Config file already had the right XML nodes present but the Models in CS files had some of those attributes commented to uncommented those.

The end to end flows work. More documentation with screenshot of how this works appended with the issue. Happy to make any other changes that you feel might be required.

thousandtyone avatar Jan 28 '22 20:01 thousandtyone

I have submitted the PR but the checks keep failing with this log in the pipeline:

2022-01-28T20:39:26.9131489Z ##[section]Starting: DotNetCoreCLI 2022-01-28T20:39:26.9250902Z ============================================================================== 2022-01-28T20:39:26.9251488Z Task : .NET Core 2022-01-28T20:39:26.9251855Z Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command 2022-01-28T20:39:26.9252389Z Version : 2.198.0 2022-01-28T20:39:26.9252661Z Author : Microsoft Corporation 2022-01-28T20:39:26.9253034Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli 2022-01-28T20:39:26.9253428Z ============================================================================== 2022-01-28T20:39:27.3607660Z [command]C:\Windows\system32\chcp.com 65001 2022-01-28T20:39:27.3712512Z Active code page: 65001 2022-01-28T20:39:27.3742137Z Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version. 2022-01-28T20:39:28.7256705Z [command]C:\hostedtoolcache\windows\dotnet\dotnet.exe publish D:\a\1\s\source\DasBlog.Web.UI\DasBlog.Web.csproj --configuration Release --output D:\a\1\a/dasblog-core_20220128.4 --self-contained --no-build --no-restore 2022-01-28T20:39:28.8986300Z Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET 2022-01-28T20:39:28.8987756Z Copyright (C) Microsoft Corporation. All rights reserved. 2022-01-28T20:39:28.8988373Z 2022-01-28T20:39:31.2032819Z C:\hostedtoolcache\windows\dotnet\sdk\6.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(248,5): error MSB3030: Could not copy the file "D:\a\1\s\source\Subtext.Akismet\bin\Release\net6.0\Subtext.Akismet.dll" because it was not found. [D:\a\1\s\source\DasBlog.Web.UI\DasBlog.Web.csproj] 2022-01-28T20:39:31.2426036Z ##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1 2022-01-28T20:39:31.2429760Z ##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build 2022-01-28T20:39:31.2434427Z Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting 2022-01-28T20:39:31.2437654Z ##[error]Dotnet command failed with non-zero exit code on the following projects : D:\a\1\s\source\DasBlog.Web.UI\DasBlog.Web.csproj 2022-01-28T20:39:31.2571238Z ##[section]Finishing: DotNetCoreCLI

The Same command however works locally for me:

image

Not sure if I did something wrong or it's an issue with the pipeline in general. The whole flow is working perfectly on my machine and even seems to be passing build and test cases in the pipeline. Not sure why publish is failing. Right now I tried the same set of commands the pipeline is firing on my local machine and it all seems to work. If there is something that needs to be fixed at my end please do let me know and I'll be happy to fix. Not sure why the publish is unable to find the akismet dll on the pipeline box. I am leaving the PR open. It'll be really nice if you can review it once and please do let me know if I am doing something wrong or it's some issue that needs to be fixed on the pipeline. If I need to fix it, I'll do that right away.

thousandtyone avatar Jan 28 '22 20:01 thousandtyone

Documentation Available here: https://github.com/poppastring/dasblog-core/issues/599#issuecomment-1024602750

thousandtyone avatar Jan 28 '22 21:01 thousandtyone

@thousandtyone Thx for the PR. Sorry I took so long to respond. I will take a look at this in the next day or so.

poppastring avatar Mar 10 '22 02:03 poppastring

@thousandtyone Again thanks for your patience. I have been told I need to fix an issue with the build (Framework dependency is broken).

So my plan at first was to attempt to resolve this issue at the same time, but in all honesty I am feeling less comfortable about making Akismet part of the dasblog project directly. I have spent a lot of time trying to narrow the focus to the essential and necessary and just consume Nuget packages. Here are my thoughts:

  1. Create a new github repo for Akismet
  2. Develop the pipeline to create a Nuget package
  3. Consume the package in dasblog

I am not sure how you feel about doing this work, I also do not want to assume that I can just take your Akismet project and just make a Nuget package under my Github name (I am really happy to do this but again, how do you feel?). Please let me know which way you would prefer to go.

Again, thanks for your contributions!

poppastring avatar Mar 26 '22 01:03 poppastring

@poppastring Really sorry about the rather late response on this one. I am absolutely fine with taking any direction you would want to take. Please feel free to take my work and make a nuget package under your github name. No worries! As long as dasblog gets akismet support we all benefit from it! :)

Also if there is any way in which I can further contribute or help please feel free to let me know.

thousandtyone avatar Nov 03 '22 15:11 thousandtyone