Giter VIP home page Giter VIP logo

raweb's Introduction

RetroAchievements Logo

RAWeb is RetroAchievements.org's platform application. It is a Laravel application (TALL stack).

Requirements

Validated to run on Windows, macOS, and Linux with any of the setup options below (Docker via Laravel Sail, VM with either nginx or Apache, Laravel Valet on macOS).

Docker Compose (Windows, Linux, macOS)

See Laravel Sail documentation.

XAMPP (Windows, Linux, macOS)

Install the XAMPP version packaged with PHP 8.2 to run an Apache web server, MySQL/MariaDB, and PHP on your system.

You might have to enable some extensions in php.ini (see the ext-* requirements in composer.json):

extension=curl
extension=gmp
extension=mysqli
extension=pdo_mysql
extension=gd
extension=intl
extension=sockets

Laravel Valet (macOS only)

A local valet driver is provided.

Upgrade

Refer to the upgrade guides to upgrade your existing installation.

Installation

composer install

Run setup script

composer setup

Note In case you want to rely on the shipped composer.phar instead of a global installation read all mentions of composer within commands as php composer.phar. I.e. run php composer.phar setup if you haven't aliased it.

Configure

The environment configuration file (.env) contains a sensible set of default values.

Docker/Laravel Sail

No additional configuration is needed; the configuration automatically detects whether it's running the application via the Laravel Sail application container and adjusts hosts and ports accordingly.

However, you might want to adjust the forwarded container port numbers to your liking (APP_PORT, FORWARD_*).

Now is a good time to create the containers. Sail forwards commands to Docker Compose:

sail up
# Daemonize:
sail up -d

Note Mentions of sail commands assume that it has been aliased to the ./sail executable according to Sail's docs. I.e. run ./sail up if you haven't aliased it.

XAMPP/Valet

Adjust the local environment configuration (.env):

  • Enter the credentials of your local database instance (DB_*)
  • Change the application URL (APP_URL) - static assets URL (ASSET_URL) should be the same as APP_URL

Note APP_URL varies depending on your setup. By default it's configured to use the forwarded application Docker container port. E.g. using an Apache vhost or linking a domain via Laravel Valet this should be adjusted accordingly:

APP_URL=https://raweb.test
ASSET_URL=https://raweb.test

Hybrid Docker setup

When running the application locally (i.e. web server and PHP via XAMPP/Valet) it's possible to use the provided Docker services, too.

Use database and redis services:

DB_PORT=${FORWARD_DB_PORT}
REDIS_PORT=${FORWARD_REDIS_PORT}

Note Connect with a database client of your choice using the forwarded ports or use phpMyAdmin which runs at http://localhost:64080 by default.

Use mailpit as SMTP server for local mails testing:

MAIL_MAILER=smtp

Note Runs at http://localhost:64050 by default.

Use minio as an AWS S3 drop-in replacement:

AWS_MINIO=true

Note In order to use S3 features you'll have to create a local bucket manually first. Runs at http://localhost:64041/buckets/add-bucket by default.

Build frontend assets

npm install
npm run build
# Using Sail:
sail npm install
sail npm run build

Create filesystem symlinks

php artisan ra:storage:link --relative
# Using Sail:
sail artisan ra:storage:link --relative

Setup database

php artisan migrate
# Using Sail:
sail artisan migrate

Seed your database with additional test data:

php artisan db:seed
# Using Sail:
sail artisan db:seed

Open the application in your browser.

Depending on the setup you chose the application should run.

Usage

Developing achievements locally

Add a host.txt file next to RAIntegration.dll in your local RALibRetro's directory. The file should contain the URL to your local RAServer instance. Any of the following will work:

  • http://localhost:64000 when running the server via Docker, composer start or artisan serve.
  • https://raweb.test (example) when running the server via Valet
  • http://raweb.test (example) as a configured vhost

Security Vulnerabilities

Please see our Security Policy.

Contributing

Please see our Contribution Guidelines and Code of Conduct.

License

RAWeb is open-sourced software licensed under the GPL-3.0 License.

Console Icons by yspixel.jpn.org and Tatohead.

raweb's People

Contributors

anegoda1995 avatar ciymax avatar coliff avatar coolcanuck avatar dependabot[bot] avatar drisc avatar emoonx avatar falsepopsky avatar gamedragon2k avatar gboquizosanchez avatar gdeoo avatar jamiras avatar juherr avatar kdecks avatar krylan avatar liquifiedsnow avatar luchaos avatar magmarfire avatar meleu avatar mrownership avatar msgoodman avatar oddgoo avatar pinguupinguu avatar rzumer avatar scottfromderby avatar stt avatar televandalist avatar tsearo avatar wedgesparda avatar wescopeland 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

raweb's Issues

Centralized Audit Log of all developer and admin actions

Including:

  • Changing/adding game page info and images
  • Changing/adding/removing leaderboards
  • Closing Tickets
  • Changing/Adding rich presence
  • Adding/Demoting/Editing achievements
  • Renaming a Game
  • Removing leaderboard scores
  • Unlinking/Linking MD5s
  • Deleting a forum thread
  • Deleting comments (admin)
  • Editing forum comments (admin)
  • Banning (admin)
  • Untracking (admin)
  • Manually added achievements (admin)

what else?

Re-adjusted Retro ratio

It needs to take in account revisions and additions to the set.

Also possibly not have the point value tied to the dev value, this would been to be experimented on.

Game page achievements not showing number of winners

On the game pages some achievements are not displaying the number of earners:
image

Why is this happening?
There are earners on the list that don't have an account.
-- I know this is the problem here for Bonus Star Fox 64, as I made typos while manually awarded achievements to players therby giving points to players which do not exist.

http://retroachievements.org/Game/10630, http://retroachievements.org/Achievement/57625,
Also see "Phantom Penance" http://retroachievements.org/Game/1447.

There may be a second issue that has something to do with untracking, this is when this problem started appearing.
http://retroachievements.org/Game/1701

Event System Tracking

The RA events have been great and a nice system that automatically does everything from awarding points to awarding titles to updating the leader boards would be great addition to the RA site.

Add a framework

Goals:

  • apply php development best practices (avoid globals, pass by reference, echoing out complete html blocks), making code testable
  • preserve existing features and api to satisfy external consumers (toolkits, emulators, editor tools)
  • DRY (don't repeat yourself) - fixing issues and implementing new features once
  • streamlined setup for local development to make it attractive for contributors
  • SoC (separation of concerns), encapsulate features into components
  • simplify and stabilise CRUD (create, read, update, delete) tasks
  • principle of least exposure, clean api (no more .php in urls)
  • avoid huge files (dynrender has multiple thousand LoC)
  • environment agnostic configuration
  • global input sanitisation
  • common REST/json api
  • cli tooling

TODOs

  • Route everything through Laravel with catchall routes -> dispatch static files with legacy bootstrapping
  • Adjust .htaccess to single entrypoint, move all rewrite rules to routes (makes it work on nginx as well, no more dependency on apache)
  • Adjust .htaccess to not rely on images host apache redirects -> static host config & static_asset() view helper for aws hosted images
  • Auth service provider (reuse existing auth cookie, support salted md5 hashes through legacy user provider) to be replaced with #99
  • lowercase & legacy route redirects in .htaccess for apache on prod (to be sure links are case insensitive)
  • Replace all IsAtHome(), AT_HOST and AT_HOST_DOT with agnostic environment checks
  • Implement generalized grid paginator to be reused among resources' indexviews
  • Use service container instead of globals -> AppServiceProvider provides RA\RA
  • decorate resource routes with slugs (game, achievement, news, forum)
  • replace all references to service credentials with env vars and configs`
  • add layout & views for general error pages (404, 500, 503)
  • replace header location redirects with redirect responses
  • set up new server with upgraded runtimes
  • move request*.php to controller actions
  • email address to .env for error reporting
  • Custom logging (replace error_log())
  • environment check for recaptcha
  • provide a deployment script/tool
  • Flash errorCodes to session
  • use SES for email sending
  • Global exception handling
  • Set up frontend pipeline
  • add csrf token to all non-api post request forms
  • Move facebook fields to user_connections
  • AWS S3 uploads with test bucket
  • Password Resets
  • Mail authoring

Tests:

  • Integrations: make sure all app api v1 endpoints (/*.php) are working for external consumers. see #90 and #91 for details
  • test all users are found regardless of casing (case insensitive)
  • test all page responses for server errors
  • test all api v1 (/API/*.php) responses
  • test all legacy routes are redirected
  • test all rss feed responses

Database:

To ease collaboration Laravel's database migration and seeding features are used (via artisan cli tool).
Allows to document and roll out changes made to the database structure for all contributors.

Laravel provides those features out of the box.

  • Set up initial database migration
  • Provide mysqli support (legacy) -> AppServiceProvider provides RA\RA::mysqliConnection()
  • Set up models and their relationships using Eloquent (initally for seeds only)
  • Migrate database to charset utf8mb4, collate utf8mb4_unicode_ci
  • Migrate columns of type BIT to boolean/tinyint
  • Set up factories and database seeds
  • Migrate table and column names to meet framework conventions
  • Re-establish missing foreign keys
  • Email Confirmations -> verification field on users
  • Add Emulators
  • Comment Types to polymorphic relationship
  • Laravel Passport with implicit token grant for the frontend
  • Materialize User <-> Game relations
  • Support Markdown
  • Add Awards
  • Add Events (AotW)

Seeds:

  • Achievements
  • Consoles
  • Forums
  • Forum Categories
  • Forum Topics
  • Games
  • Users
  • News

Ignored for now:

  • Achievement Tickets
  • Awards (polymorphic)
  • Comments (polymorphic: User Wall, Forum Topic)
  • Events (polymorphic)
  • Game Alternatives
  • Game Code Notes
  • Game Hashes
  • Leaderboards
  • Leaderboard Entries
  • Messages
  • Ratings (polymorphic: Games, ...)
  • Streams
  • User Achievements (Awarded)
  • User Activities
  • User Awards
  • User History
  • User Relations (Friends, Blocks)
  • Votes (polymorphic: Achievements, ...)

Cannot test anything

So I loaded up the repo in NetBeans using IIS (Internet Information Services) as the web server for local testing (that's all I have). I'm assuming index.php is the entry point.

No matter what I do it says "Error: Could not connect to database. Please try again later." Is there a connection string or something missing? The live application/website still works though. Would appreciate knowing what tools are necessary to test and develop.

Bring back achievement rating

BUT only allow those who have mastered or completed the set to rate. Could lower the threshold to as low as 50% completed before you can rate.

Also when a set is revised, reset the rating.

Make it responsive

The frontend code could need some responsive treat to work well on smaller screens (mobile devices, tablets).

Require some major refactoring of the current markup generating files. Instead of echoing out single lines of html it should be html that has php markers in it. (see #20)

This will open up opportunities to have a more elaborated take on the frontend altogether (would result in a follow up issue/task).

add more info about the forum post on the email notification

Once I commented on that "What games you want achievements?" topic I feel like cursed. I'm not interested in following that thread. And, as there's no option to unsubscribe it, I would like to, at least, see the topic's title in the notification message. And then I could delete the message without having to click on the link and being frustrated...

IMO it would save some bandwidth too.

Checksum section for all game entries

This would bring information about the CRC32 checksums of all linked ROMs - information for all players to be able to identify correct version of the game. MD5 values, which are used by the system (and by developers to identify linked ROMs), could be maintained through improved Unliking page, which should be renamed to "Linked Version Manager" or something similiar. It would be the best if this section were updated authomatically, when the ROM is linked.

Official forum topics - ownership problem

Official forum topics first post not editable by devs (if another user opened it).
It also makes it seem like the one who opened the topic "owns" it or is the lead developer.

Either

  1. make it so official forum threads topics are created by the system instead of users
    and

  2. Developers need permission to edit this specific first post. (but not other posts)
    or just 2.

  3. What else? What could be a good solution here?

Details:
The problem is the first topic is used for providing the most important information about the game. Usually developers will need to this post add or make changes, and they only can if they've started the topic or they need to ask an admin to make changes.

READ ME section for all game entries

In this section every developer could add notes, especially about things the player should know about the set. It would be for the best to have this section visible in the emulator asap, to bring access to all necessary information about the set, with no need to access the site.

Forum: Move topic

For admin to have the ability to move a forum topic from one folder to another.

Achievement Quests

Alow admins to compose sets of achievements from different games which, after completion could give unique site award, plus optional other benefits for the player. Quests shlould be designed collectively by the community, but only admins should be allowed to edit them.

Forums: Delete Post

Forums:
Add the ability for admin to Delete specific forum posts
For users to delete their own post.

add forum sections for other consoles

currently we need sections for

  • Master System
  • Nintendo 64
  • Atari Lynx
  • Neo Geo Pocket
  • Atari 2600
  • Arcade

In the future we'll need a section for:

  • PlayStation

And maybe there are more to come!

Remove delete forum thread as a developer permission

This only causes problems (often) giving devs this permission, especially as official forum topics still link to the official topic.

Also I've noted that this should be logged into the developer log. #11

I'll make a separate issue for being able to reassign official threads. #33

Write basic integration tests

To make sure the main site features are still all working as intended after making changes to the code.
Doesn't have to be TDD all the way but at least cover the basics for convenience.
PHPUnit was added for that purpose with the initial project cleanup (#21).

Player Level feature

Points could be used to determine the level of the player (similiar feature is used on several gaming social networks like Steam for example). Additionaly reaching the level milestone (every 5 or 10 levels for example) the player could recieve seperate site award.

Control Panel: Clear Play History

Commonly requested feature. Right now play history shows 15 most recent changes.

Some players would like to be able to clear their play history for whatever reason. This shouldn't be too difficult, and I don't see much drawback.

PHP Templating

Instead of echoing out html through functions it should be html that has php markers in it, composed by includes.
Otherwise making changes to the frontend is needlessly time consuming.
Would make dynrender.php less of a beast as well ;)
A raw PHP templating engine like Plates might be useful - or at least leverage php file includes.

Unlink Game Entry Changes

1 Add a field where developers can label each MD5.
2 Add a CRC32 field. Hopefully this is generated automatically.
3. Change the name of Unlink Game Entry to Linked Version Manager.

See: #1 Show Linked hashes on game page

Follow basic PHP Project best practices

Most of what currently resides in the document root of the project should be moved to a public folder.

This will allow us to be in control over what is exposed through the site and what is only meant to be consumed by the backend (e.g. composer dependencies that will live in vendor, chat service node application in its own space, etc.)

The directory layout would look something like that:

/chat/package.json <- chat service npm dependencies
/chat/... <- chat node application
/public/... <- here be majority of scripts that are currently in the root of the project
/storage/... <- here be logs, cronjob created files, etc
/vendor/... <- composer dependencies
/composer.json
/composer.phar
/package.json <- npm frontend dependencies
/... <- other private, project relevant files like configs may live here

this makes it much easier to reason about where the source is that one might be looking for - clustering together scripts by usage. comes with the benefit of appearing much nicer in the ide/code editor of choice as well.

Moving to the public folder also means that the web server has to be configured to point to that directory instead.

Correct Twitch stream channel, or remove it from the main page

Change instances of "retrocheevos" in _dynrender.php to "retroachievementsorg." Former is the one Scott has streamed site development to on a few small occasions, latter is the one actually provided for streamers in account settings.

The stream being there at all adds clutter and load time to the page, so if users can't be trusted to stream to it, it may as well be removed.

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.