GithubHelp home page GithubHelp logo

codidact / core Goto Github PK

View Code? Open in Web Editor NEW
259.0 37.0 20.0 1.71 MB

The core Codidact Q&A software implementation

License: GNU Affero General Public License v3.0

C# 95.04% HTML 3.90% CSS 0.01% TypeScript 1.06%

core's Introduction

Codidact Logo

Website Chat Contributing

Huh?

Codidact is community-driven Q&A software: created, maintained, used, and run by the community, for the community. There's no money-making company behind this.

We're currently in the early stages of development, but once we have a working MVP, we'll be hosting a public Codidact instance for everyone to use. The software will also be available to download and run yourself to host your instance under your own rules.

Installation

There are install instructions for Windows and Linux.

License

AGPL v3.0.

Contributions

Very welcome! Please read our contributing guidelines before you start writing code.

core's People

Contributors

9034725985 avatar artofcode- avatar asynts avatar benjamin-allen avatar charliebrumbaugh avatar gldraphael avatar jflopezfernandez avatar linnydude3347 avatar lionelbergen avatar luap42 avatar masonwheeler avatar misha130 avatar ozewski avatar ranolfi avatar wbt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

core's Issues

Create API to communicate with Auth Project

Is your feature request related to a problem? Please describe.
In the auth project upon registration a member has to be created. Thus it needs to signal to the core project to make such a member and return a result if successful so registration can be done.

Describe the solution you'd like
An API project that does the following:

Describe alternatives you've considered
Other than gRPC its easy to create a good old REST API. Problem is with so many microservices for instance a service for imports it might be better to use gRPC.

Missing Migration execution at Runtime

As per c7dd9d8 currently the execution of the migration is execute via a cli command.

Rather than that, this line of code should be added somewhere on start:
dbContext.Database.Migrate()

Exception handling for this should also be implemented since there is no proper connection string.

Add setup instructions for Arch Linux

Current setup instructions point to a Microsoft download of dotnet core for various flavours of linux, which doesn't include Arch Linux. Luckily, packages exist and can be installed by the Arch package manager, pacman

Instructions should be updated to include steps to install on Arch Linux

I have added instructions to readme.md. PR coming.

Implement application work flow

This tasks refers to how in this project data should be queried from.
This flow should be universal and used for all the queries.

It can be:

Feel free to add.
(I realize there is no forum thread about this but I feel its too technical to post on the forum)

Setup WebUI (MVC) integration tests

All the controllers and each of the actions in each of the controllers should go through an integration test to verify that they are working properly.

Requires:

  • A factory to create a server for each test (ASP Core Server) based on the needs of the test
  • Since we need to test StatusCodes we should send Http Requests to this newly created server to verify.

Create a request for a new question

Is your feature request related to a problem? Please describe.
The user should have an ability to create new questions in the question after filling out the new question page.
Thus an API for that is needed.

Describe the solution you'd like
Create a repository inside of application project called Questions and create a new question based on the data received from the client.
Validate the request, return errors if not valid.
Should be authorized.

Some incorrect packages are referenced.

The infrastructure project references a package that belongs to the ".NET Framework" framework, not to the ".NET Core" framework, namely Microsoft.AspNet.Identity.EntityFramework.

https://github.com/asynts/codidact-core/blob/c1e82e109b8ef0ea67cf94f3a04471660d186878/src/Infrastructure/Infrastructure.csproj#L11


In another place the package Microsoft.AspNetCore.Http.Abstractions is included, it appears that this package was replaced by a "framework reference" whatever that is. I have not tested that but look dotnet/aspnetcore#6040 for details.

https://github.com/asynts/codidact-core/blob/c1e82e109b8ef0ea67cf94f3a04471660d186878/src/Infrastructure/Infrastructure.csproj#L12

Create a request to display question details

Is your feature request related to a problem? Please describe.
The question page details should display the questions and all relevant answers.
Thus an API for that is needed.

Describe the solution you'd like
Create a repository inside of application project called Questions and retrieve the necessary question details based on the question id received from the client.
Validate the request, return errors if not valid.
Should be authorized.

Outdated .NETStandard ?

Why are we using ASP.NET 2.1 instead of the newest (3.1) ?

I tried opening Codidact using Mono, and got this error:

Project Codidact.Infrastructure is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Project Codidact.Infrastructure supports: netstandard2.1 (.NETStandard,Version=v2.1)

Implement IdentityServer & Identity.NET

As per https://forum.codidact.org/t/what-kind-of-authorization-framework-library-should-we-use/642/7 it has been decided upon IdentityServer/Identity.NET

The following adjustments should be:

  • Add IdentityServer and Identity configuration to Startup:
   app.UseAuthentication();
   app.UseIdentityServer();
   app.UseAuthorization();
  • Change ApplicationDbContext to inherit IdentityDbContext
  • Create an ApplicationUser that inherits IdentityUser
  • Add IdentityServer to DI in the infrastructure module:
   services.AddIdentityServer()
        .AddApiAuthorization<ApplicationUser, ApplicationDbContext>();

  • Set member id on create/delete/update
  • Integration tests for both WebUI/Infrastructure

Move the authentication stuff into it's own repository.

The idea is to run an authentication server (that deals with user passwords, etc.) in it's own process for security reasons.

The authentication stuff — I mean the stuff in src/Auth — should be moved into the authentication repository.

There must be some sort of API between the servers, as far as I know there wasn't a precise decision made yet.

The authentication stuff is mostly separate already, a direct copy won't be possible though, because this server would connect to a different database.


I already created my own repository and slowly start moving the stuff over, however, I don't have much time currently and likely won't be able to complete this in a reasonable amount of time.

Forum link on the readme header is incorrect

The current link URL is set to https://codidact.org/forum/, which results in a 404. The correct forum URL should be https://forum.codidact.org/. I'm in the process of submitting a pull request with this change.

Use user secrets.

Currently the connection strings are stored in the appsettings.json files. There is also a built in mechanism to store user secrets.

Essentially, it would look like this:

cd src/WebUI
dotnet user-secrets init
dotnet user-secrets set ConnectionStrings:DefaultConnection "Host=localhost;Database=codidact;Username=codidact"

This could also simplify the install instructions in #31.

It's not a must-have but I found that and would like to put it up for debate.

Installation documentation is out of date

Describe the bug
In windows-instructions.md, it says:

  1. Run the following command inside of 'src/WebUI' to install the connection string
dotnet user-secrets set "ConnectionStrings:DefaultConnection" "YOUR_CONNECTION_STRING"

but the src/WebUI folder does not exist in the current source tree.

The same problem exists in the Linux setup documentation.

Add instructions for setting up dev environment to README

Created from project card here

The README needs instructions for setup for various operating systems. These instructions will certainly need maintenance as the project evolves.

I'll be performing a from-scratch install on a Windows PC without C# development tools and noting steps as I go.

Project Logo Not Displaying on Project Github Page

For some reason the project image isn't display correctly. When I click on the link that's being displayed instead, it takes me to a page containing only the following message:

Error Message

The image info also says the image is only fifteen bytes, so I'm not sure what's going on.

Image Details

Refactor MVC to Razor Pages.

The project currently uses the Model-View-Controller (MVC) design pattern. It was decided (citation needed) to use Razor Pages instead.

Please note, that the src/Auth project will be moved into a separate repository, therefor, this part of should be refactored later (?).

Use local tools for ef

Is your feature request related to a problem? Please describe.
Setup instructions require us to use the dotnet-ef tool globally. This wasn't a problem pre-3.0 since the EF version was tied to the SDK version in global.json. It's not anymore and different developer machines could end up with tool versions eventually.

Describe the solution you'd like
The tool should be installed locally for the project instead, so that there's a guarantee that every developer ends up using the same local tool version.

Create a request to list all questions

Is your feature request related to a problem? Please describe.
The questions page should display all relevant questions.
Thus an API for that is needed.

Describe the solution you'd like
Create a repository inside of application project called Questions and retrieve the necessary questions based on the filters given from the client.
Validate the request, return errors if not valid.
Should be authorized.

Create a request for a new answer

Is your feature request related to a problem? Please describe.
The user should have an ability to create a new answer after filling out the new answer body.
Thus an API for that is needed.

Describe the solution you'd like
Create a repository inside of application project called Answers and create the answer based on the data received from the client.
Validate the request, return errors if not valid.
Should be authorized.

Make '.editorconfig' less verbose.

Refer to #55.

A lot of the values in that configuration are the default anyway, in my opinion we should use the defaults and then discuss which options should be turned on / off.

Add instructions on how to setup the Client Secret for authentication

Since the project is using secrets, the Client Secret for the authentication should be managed by the secrets as well.

An instruction on how to do this should be added to:
https://github.com/codidact/core/blob/develop/docs/linux-instructions.md
https://github.com/codidact/core/blob/develop/docs/windows-instructions.md

The client secret placeholder can also be removed from https://github.com/codidact/core/blob/develop/src/WebUI/appsettings.json

TODO list -- tasks can be found and assigned here

Codidact core software — Permanent TODO list

Welcome to the Codidact project. We are glad, that you want to contribute to the software. See core/CONTRIBUTING.md for more information, on what kind of contributions are most helpful.

There is a list of open tasks at the bottom of this issue. See through them to find out, what you want to do. Completed tasks will be removed, tasks with a checked box are already assigned. Choose one and write a reply to this issue, saying that you want to claim it.

Claiming an issue means, that you have some responsibility. While this is an open-source project and nobody is paid for their work, we do expect tasks which have been claimed to be completed in a reasonable time. If you suddenly can’t continue, we’d be very glad, if you could give us notice and to publish everything you have already done to save others work.

You should also give us regular feedback. We will host regular meetings on our Discord server. We’ll announce a day, on which the feedback should be given there, soon. For all these status updates, ping @StatusUpdates. Just ask in any channel that seems to be appropriate, if you have any questions.

Todo list

  • a good and easy-to-follow development environment setup guide, ideally containing documentation or linking to official documentation on how to add routes/views/controllers and on how to change the models/db schemata if needed
  • having and deploying a development instance on a cloud service, which always contains the latest develop version
  • creation of user profiles on account creation (registration only creates network-wide “accounts” AFAIK) (models already exist)
  • showing user profiles (connecting with authentification, models already exist)
  • editing user profiles (models already exist)
  • showing questions (models already exist)
  • adding questions (models already exist)
  • editing questions (models already exist)
  • showing answers to questions (models already exist)
  • adding answers to questions (models already exist)
  • adding and editing (changing) votes (models already exist)
  • have and update trust levels (cron task?) (models already exist)

Make it decentralized

Can we please use ActivityPub to make the software decentralized? Why have "100" isolated servers (with redundant content) when we can have one network comprised of "100" federating instances (servers).

Permission denied to create extension "adminpack".

I am not sure when this was introduced but the build is currently broken:

$ cd src/WebApp && dotnet run
fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
      Failed executing DbCommand (2ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
      CREATE TYPE audit.history_activity_type AS ENUM ('CREATE', 'UPDATE_BEFORE', 'UPDATE_AFTER', 'DELETE');
      CREATE TYPE post_type AS ENUM ('question', 'answer', 'blog');
      CREATE EXTENSION IF NOT EXISTS adminpack;
fail: Codidact.Core.WebApp.Startup[0]
      Unable to apply database migrations. Check the connection string in your appsettings file.
crit: Microsoft.AspNetCore.Hosting.Diagnostics[6]
      Application startup exception
Npgsql.PostgresException (0x80004005): 42501: permission denied to create extension "adminpack"
   at Codidact.Core.WebApp.Startup.ApplyDatabaseMigrations(IApplicationBuilder app, ILogger logger) in /home/me/dev/codidact/core/src/WebApp/Startup.cs:line 163
   at Codidact.Core.WebApp.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger`1 logger) in /home/me/dev/codidact/core/src/WebApp/Startup.cs:line 140
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__2(IApplicationBuilder app)
   at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
  Exception data:
    Severity: ERROR
    SqlState: 42501
    MessageText: permission denied to create extension "adminpack"
    Hint: Must be superuser to create this extension.
    File: extension.c
    Line: 806
    Routine: execute_extension_script
Unhandled exception. Npgsql.PostgresException (0x80004005): 42501: permission denied to create extension "adminpack"
   at Codidact.Core.WebApp.Startup.ApplyDatabaseMigrations(IApplicationBuilder app, ILogger logger) in /home/me/dev/codidact/core/src/WebApp/Startup.cs:line 163
   at Codidact.Core.WebApp.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger`1 logger) in /home/me/dev/codidact/core/src/WebApp/Startup.cs:line 140
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__2(IApplicationBuilder app)
   at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Codidact.Core.WebApp.Program.Main(String[] args) in /home/me/dev/codidact/core/src/WebApp/Program.cs:line 13
   at Codidact.Core.WebApp.Program.<Main>(String[] args)
  Exception data:
    Severity: ERROR
    SqlState: 42501
    MessageText: permission denied to create extension "adminpack"
    Hint: Must be superuser to create this extension.
    File: extension.c
    Line: 806
    Routine: execute_extension_script

I remember having a discussion somewhere, that some of the generated code referenced the "adminpack" extension somewhere. It is mentioned in some of the database migrations.

We should remove this from the migrations and find the cause of this issue.

Getting the community scope

I think we need to have this before being able to work on posts and users:

https://github.com/codidact/core/projects/1#card-31579420

A system, which parses the URL, gets the community ID from it, verifies, whether that is in the DB and if it is, loads some information (name, tagline) into memory and passes that to the further controllers and views.

I'd do it, but I don't have enough knowledge in ASP.NET Core, so I'd like to ask for volunteers doing it. :)

Please reply here, when you can do this and I'll assign this task to you.

Registration Page Needed

There is currently no registration page for the site. I am currently working on implementing it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.