Giter VIP home page Giter VIP logo

serlo / serlo.org-legacy Goto Github PK

View Code? Open in Web Editor NEW
18.0 8.0 3.0 340.4 MB

Legacy implementation of https://serlo.org/

Home Page: https://serlo.org/

License: Apache License 2.0

JavaScript 8.54% TypeScript 0.62% Dockerfile 0.04% HTML 3.54% CSS 0.02% PHP 30.46% Shell 0.01% JavaScript 8.54% TypeScript 7.39% Dockerfile 0.08% HTML 3.54% CSS 0.02% PHP 30.95% Shell 0.01% SCSS 1.13% Twig 5.12%
legacy-code php typescript zend zend-framework serlo

serlo.org-legacy's Introduction

Serlo Logo

serlo.org

Monolith that still serves parts of serlo.org. Head over to api.serlo.org and frontend for new development.

Kanban board

Setup

You need Docker, Node.js v16 and Yarn installed on your system.

Now follow the upcoming instructions.

Clone

# Clone the project:
$ git clone https://github.com/serlo/serlo.org.git
$ cd serlo.org

Bootstrap

On Linux or macOS, just open a terminal and run the following commands:

$ cp docker-compose.dist.yml docker-compose.yml

Setting up hosts

On Windows, please add

127.0.0.1 de.serlo.localhost
127.0.0.1 en.serlo.localhost

to your C:\Windows\System32\drivers\etc\hosts.txt file. Then run ipconfig /flushdns in cmd.exe and restart your browser.

On macOS / Unix:

$ sudo nano /etc/hosts

# add lines
127.0.0.1    de.serlo.localhost
127.0.0.1    en.serlo.localhost

# flush macOS DNS cache
$ sudo killall -HUP mDNSResponder

Development

Install dependencies

Run yarn to install the dependencies of all packages.

Start

Run yarn start to start everything needed to run serlo.org locally. Now open http://de.serlo.localhost:4567. Happy coding!

Test users

You can use the following users at http://de.serlo.localhost:4567. The password for all users is 123456. Their names correspond to the roles they have:

  • login
  • german_reviewer
  • german_helper
  • english_langhelper
  • admin

Stop

Interrupt the yarn start command to stop webpack and run yarn stop:server to stop the docker containers.

Repository structure

This repository is managed as a monorepo consisting of the following packages. Check out their READMEs for package-specific details:

  • packages/private contains helper packages for deployment and packages used by multiple other packages. Specifically:
    • cloudflare contains helpers to work with Cloudflare
    • dev-tools contains npm packages that are only needed for development (to speed up builds of docker images)
    • docker handles building, tagging and deploying of our Docker images
    • editor-helpers (de-)stringifies editor states
    • edtr-io contains the Edtr.io integration
    • edtr-io-storybook contains a Storybook to start the Edtr.io integration in isolation
    • gcloud contains helpers to work with Google Cloud Platform
    • legacy-editor-to-editor converts legacy editor state to editor state
    • markdown defines our Serlo-flavored markdown as used in the legacy editor
    • mathjax contains helpers to work with Mathjax
  • packages/public contains packages that are deployed somehow. Specifically:
    • client contains our assets used in the client (e.g. JavaScript bundle & stylesheet)
    • editor-renderer is the server-side renderer for our editor
    • legacy-editor-renderer is the server-side renderer for our legacy editor
    • notifications-job handles the delivery of notification emails
    • server is the serlo.org backend
    • static-assets contains static assets (e.g. images)

Other commands

  • yarn build builds our packages (only needed for deployment)
  • yarn deploy:images deploys the docker images to our Container Registry (only needed for deployment)
  • yarn deploy:packages deploys the packages to our Package Registry (only needed for deployment)
  • yarn format formats all source code
  • yarn lint lints all source code
  • yarn license updates license headers in source files
  • yarn mysql connects to the running MySQL database (requires yarn start beforehand)
  • yarn mysql:dump updates the docker initialization file of the sql database with the current database state (requires yarn start beforehand)
  • yarn mysql:import-anonymous-data imports the latest anonymized dump (requires yarn start beforehand, only works on Unix currently)
  • yarn mysql:rollback resets the database (requires yarn start beforehand)
  • yarn oauth runs a OAuth workflow to manually test Hydra integration
  • yarn test:e2e runs all end-to-end tests (requires yarn start beforehand)
    • Use HEADLESS=false yarn test:e2e to run the tests in an actual browser.
    • Use HEADLESS=false SLOWMO=<number> yarn test:e2e to introduce a <number> of milliseconds delay between actions in tests.
  • yarn test:js runs all non-PHP unit tests
  • yarn test:php runs all PHP unit tests
  • yarn migrate:up runs all the database migration scripts
  • yarn c allows running composer commands, see yarn c --help
  • yarn start spins up the development environment

serlo.org-legacy's People

Contributors

ddavid avatar dependabot[bot] avatar elbotho avatar entkenntnis avatar fridosa avatar inyono avatar jacquesta avatar jakobwes avatar knorrke avatar kulla avatar lodifice avatar metzgaria avatar resirudo avatar thetaris avatar vroland avatar

Stargazers

 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

serlo.org-legacy's Issues

String translations

How can we support translating the strings in the plugins? Don't know the config in athene2-assets for that, but maybe this also works here?

merge "subject home" / "all topics"

"subject home" and "all topics" are redundant in subject breadcrums. Additionally both sides show a taxonomy overview

potential problems

  • at current state, "all topics" is needed in side navigation to build the subject taxonomy

Redirect from (trashed) entities

Use case: when merging multiple entities, every entity except the new canonical one gets trashed. We'd like authors to configure a redirection from these trashed entities to the canonical one (so that old links still work).

Even better: merge of entities as a new action so that we have the information about that (e.g. to show the histories of all merged entities)

Email notification of other tenants have wrong links

e.g. email contains link https://www.serlo.org/entity/view/41648 which redirects to de. instead of en.

Interestingly https://www.serlo.org/41648 works, as https://de.serlo.org/41648 tries to resolve the correct instance

Full subject navigation

The subject hierarchy of serlo is deep. Often one sees three dots in subject bar (id="subject-nav"). My recommendation is to provide a pull-menu to see full navigation branch to subject.

This improves context awareness and thus improves didactics.

Invalid RSS Feed items

reported by @getJack

The items of your RSS feeds seem to be invalid. I tried to open your feed https://de.serlo.org/entity/api/rss/article/5/feed.rss with Firefox 46 which did not display the links of your content. I then had a look at the xml and saw that in your property the links have no valid URL but relative paths.

Please see the result for your self https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fde.serlo.org%2Fentity%2Fapi%2Frss%2Farticle%2F5%2Ffeed.rss

If you look up the specification of RSS https://validator.w3.org/feed/docs/rss2.html#hrelementsOfLtitemgt you will see that items require a URL and a path is not a valid URL according to https://www.ietf.org/rfc/rfc3986.txt

Review mcrypt_decrypt

Seems like mcrypt_decrypt is deprecated and doesn't work right now (e.g. when using the debugger).

e2e: requests can't be handled

When running cypress, i frequently get errors, when the requests are sent too quickly after each other.

Fatal error: Uncaught ErrorException: include(/var/www/html/src/vendor/doctrine/doctrine-module/src/DoctrineModule/ServiceFactory/AbstractDoctrineServiceFactory.php): failed to open stream: No such file or directory in /var/www/html/src/vendor/composer/ClassLoader.php on line 444

ErrorException: include(/var/www/html/src/vendor/doctrine/doctrine-module/src/DoctrineModule/ServiceFactory/AbstractDoctrineServiceFactory.php): failed to open stream: No such file or directory in /var/www/html/src/vendor/composer/ClassLoader.php on line 444

grafik

Add intl extension

https://de.serlo.org/datenschutz doesn't work on new system:

An exception has been thrown during the rendering of a template ("The Symfony\Component\Intl\DateFormatter\IntlDateFormatter::__construct() method's argument $locale value 'de_DE' behavior is not implemented. Only the locale "en" is supported.  Please install the "intl" extension for full localization capabilities.") in "static/de/datenschutz/partials/header" at line 23.

Create Tamil tenant

Database changes:

  1. Table language: ( You can find the language codes here: https://www.unicode.org/cldr/charts/latest/supplemental/language_territory_information.html)
INSERT INTO language (code, name, locale) VALUES ("ta", "Tamil", "ta_IN");
  1. Table instance:
INSERT INTO instance (language_id, name,subdomain) VALUES ((SELECT id FROM language WHERE code="ta"),"Tamil", "ta");
  1. roles and permissions (see below)
  2. taxonomy

File changes:

  1. (serlo.org/public/server): Add language to php config in Dockerfile https://github.com/serlo/serlo.org/blob/7f26740906d6e42de6058717a585df4d6da5e47f/packages/public/server/docker/php/Dockerfile#L7-L11
  2. (serlo.org/public/server): add folders and files in src/lang and src/lang/routes
  3. (serlo.org/public/server): add tenant branding configs to src/config/autoload/global https://github.com/serlo/serlo.org/blob/7f26740906d6e42de6058717a585df4d6da5e47f/packages/public/server/src/config/autoload/global.php#L41-L72
  4. (serlo.org/public/server): Add the instance with subject config (at least /community) to src/module/Subject/config/instances.config.php
  5. (serlo.org/public/cloudflare-workers): add tenant route
  6. (serlo.org/public/static-assets): Add the static assets for the tenant, e.g. home/about-serlo.svg
  7. (infrastructure): Add tenant specific secrets (e.g. tracking), increment build version of athene2 and add tenant to cloudflare (see https://github.com/serlo/infrastructure/pull/94)

On serlo.org (After everything is set up!)

  1. Add license through backend (/license/manage)
  2. Add pages for subjects through backend (/pages)
  3. Add subjects through backend (/taxonomy/term/organize-all)

Improve visibility of open discussions

  • It is not visible whether there are any open discussions
  • For grouped-text-exercises, it is not visible if there are discussions after scrolling to the end of the opened solution.

Review CloudFlare bot protection for logged in users

Sometimes (especially on ChromeBooks), CloudFlare bot protection kicks in when trying to save content (showing the reCAPTCHA every time and not saving the content). That shouldn't happen, especially for signed up users.

SEO(backlog): Image URLs – give URLs with keywords for images

This is a big task. Please make sure that you’ve got enough capacities in the Team and that there are no other important priorities before starting.

Vroni (SEO consulting) said that the images’ URL are very important for SEO. Improve the image URL structure to get URLs containing the image keywords and, also, the file path where they are deposited. For example, the URL should look like this:

and not like this:

SEO: XML-Sitemaps – collect URLs in XML-Sitemaps

This is a big task again ;). Please make sure that you’ve got enough capacities in the Team and that there are no other important priorities before starting.

Vroni (SEO consulting) said that collecting the URLs in XML-Sitemaps is very important for SEO. But once we collect them it’s imperative to update them regularly, so we should do this task just if we can make sure that we have enough capacities.

What shall we do with old blogs?

We have three blogs at serlo.org: https://de.serlo.org/blog

But we want to combine the different topics in one blog.

Can you please merge the blogs and copy the postst from https://de.serlo.org/dev-blog/ and from https://de.serlo.org/mathematik-blog/ to the main blog: https://de.serlo.org/blog/
(we can do the copying manualy, if you want?)

I also think we can reduce this unnecessary complicated structure and have just one /blog per language tenant (that was originally my fault, sorry)

Don't index course pages individually

Considering serlo/athene2#686 and the issues when searching for courses, we should have a view for the course itself that contains the content for all pages. Links to individual course pages should instead go to the root course (w/ JavaScript only showing the relevant page; see also https://support.google.com/webmasters/answer/66353?hl=en). This should solve all the issues (indexing courses, duplicated content). The only thing we lose with this (and let's discuss if that's a problem and if we could get around that), is that you can't get directly to an individual course page from the search (you would instead get to the beginning of the course). IMHO: this is fine since you'd usually won't start in the middle of the course, anyways.

Navigation: use curriculum topics for breadcrumbs

Navigation: Lehrplan vs. Themengliederung

Aus der Gliederung für einen Lehrplan kann ich auf einen Artikel klicken, der im Inhaltsverzeichnis für Themen aufgehängt ist. Beim Sprung vom Lehrplan in einen Artikel geht die Information verloren in welchem Lehrplan ich war.

So kommt man zwar leicht vom Lehrplan zu einem Artikel, aber zurück geht nichts mehr. Für den nächsten Punkt im Lehrplan muss man wieder durch den ganzen Lehrplan navigieren.

questions: how to do this with caching? What happens when following links in the article?

List of backlinks

When the editors split e.g. articles in multiple articles, it would be very helpful, if they can get a list of all entities that link to this entity, s.th. those links can be changed accordingly.

Howler Plugins

Currently we import at least one howler plugin we don't use (sparcial audio).

This goes back to this upstream issue:
goldfire/howler.js#971

We should keep on eye on that and update the library if it's fixed.

Deletion of users

Automate this:

  • Set user id to id 4 (fake combined user for deleted users) for all relevant tables (e.g. notifications are definitely not needed)
  • Delete user from user
  • Review where we could delete more (e.g. which events are not needed anymore, comments, ...?). E.g. look for usages of events, e.g. trash bin

Handle:

  • When rendering username, maybe handle id 4 specifically
  • Profile for id 4 (e.g. no activity log / stats), info that this is a deleted user
  • When user does not exist anymore, redirect profile to /4 since deleted.

Update alias on moving

Currently the Alias is only triggered, when editing. Can we trigger that too, when an Element is moved?

Things to consider:

  • We should also update child aliases (course pages)
  • What if an entity is copied to a different taxonomy? Maybe we don't want to trigger it then, and I think we can't even differentiate between those events.

Error messages when login fails are still in German

The error-messages when during login (like "Mit dieser Kombination ist bei uns kein Benutzer registriert.") are also in other language-versions still in german. I think this text-output should also be given by Crowdin, so that the message is in the respective language.
Function that gives the output/code-line: https://github.com/serlo/serlo.org/blob/0269019e8e00d29d0cbfa3e3994da204b30f4214/packages/public/server/src/module/Authentication/src/Authentication/Adapter/UserAuthAdapter.php#L102).

Review calls of toHtml() with id

The change to toHtml() in #16 caused problems in the legacy system (and might cause problems in other places, too):
When rendering the meta description of a course page, we go up to the parent and render that description instead. But when the parent (i.e. the course) doesn't have a description either, the Normalizer just returns the id as description (I assume, to handle the "go to parent" in course pages). Problem though: the id is a valid json (since it's an int) but can't be rendered by the editor renderers.

  • In legacy, we still cover this with try-catch and just return the id as a string (after applying the quickfix)
  • In kubernetes, we pass it to the renderer which will fail and therefore return an empty response

We should review whether there are other ints we try to render with toHtml that should be rendered. And probably fix meta description handling of courses since the id as a description doesn't make sense.

Quick fixes sign up

  • redirection to the page you visited before the registration process after completing the registration
  • you are already logged in after following the registration confirmation link in the email
  • If you singed up and go to sing in it says something like "Your account hasn't been approved yet". Here we should point to the confirmation email.
  • improve role descriptions (see comment below)

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.