Giter Site home page Giter Site logo

calinou / godot-asset-library-laravel Goto Github PK

View Code? Open in Web Editor NEW
65.0 9.0 16.0 1.92 MB

Experimental Godot Asset Library rewrite using the Laravel framework

License: MIT License

PHP 71.54% TypeScript 3.38% Shell 0.88% Blade 24.20%
godot-engine godotengine asset-library laravel-application

godot-asset-library-laravel's Introduction


Warning

This repository is discontinued and will no longer be worked on. See issue #467 for an explanation.


Godot Asset Library

codecov

Screenshot

Installation

If you wish to contribute code to the Godot Asset Library, you'll need to install a local copy so you can test your changes.

To run it locally, you need to install and build both the backend and frontend.

Browser support

When working on new features, keep in mind this website only supports evergreen browsers:

  • Chrome (latest version and N-1 version)
  • Edge (latest version and N-1 version)
  • Firefox (latest version, N-1 version, and latest ESR version)
  • Opera (latest version and N-1 version)
  • Safari (latest version and N-1 version)

Internet Explorer isn't supported.

Development environment

This project uses Laravel Sail to supply you with a Docker-based development environment. Please take a moment to familiarize yourself with its concepts.

We also supply a small convenience shell script named sail in the project root which forwards all commands to the vendor/bin/sail command.

It also asks whether it should

  • install the composer dependencies using a container, if not finding the sail command.
  • install .env.sail as the current .env, if none is currently present.
    NOTE: If you already have an .env installed, consider replacing it with .env.sail as the DB_*/REDIS_* settings are important for operating inside the sail environment.
# Start the development environment
./sail up -d

# Continue with setting up the backend...
./sail artisan db:create
./sail artisan migrate --seed
./sail artisan key:generate
./sail artisan admin:create

# ...and the frontend
./sail yarn
./sail yarn development

The development environment will be available at http://localhost:8080 by default.

# Stop the development environment
./sail stop

Production environment

The production environment uses PHP 7.3. To preserve compatibility with the production environment, don't use language features only available in PHP 7.4 or later.

Backend

The backend uses the Laravel PHP framework.

  1. Install dependencies as described on the Laravel 8.x installation page.
  2. Set up a MySQL or MariaDB database.
  3. Copy the .env.example file as .env and edit the DB_* variables to add database credentials.
  4. Run the following commands in order:
# Install composer dependencies
composer install

# Create a database (credentials must be set in `.env` first)
php artisan db:create

# Run migrations and seed test data into the database
php artisan migrate --seed

# Create application key
php artisan key:generate

# Create an user with administrator privileges
# (you will be prompted for username/email/password)
php artisan admin:create

# Run a local Web server for development
php artisan serve

You can run php artisan migrate:refresh --seed to run all migrations and seed test data again.

Code quality tools

  • Feature tests are available. They use a secondary MySQL database configured in .env.testing. You need to create this database before running them.
  • This project follows the Laravel code style, applied using PHP CS Fixer.
  • Code is analysed with PHPStan thanks to Larastan.

Use the commands below:

# Run unit and feature tests
vendor/bin/phpunit

# Check PHP code for possible errors
vendor/bin/phpstan analyse

# Try to fix code style violations automatically
vendor/bin/php-cs-fixer fix

Frontend

The frontend uses the Tailwind CSS framework and TypeScript.

  1. Install Node.js (10.x or later) and Yarn (recommended over npm).
  2. Run the following commands in the project folder depending on your needs:
# Install dependencies (must be done before other Yarn commands)
yarn

# Build frontend files and watch for changes
yarn watch

# Build optimized frontend files for production
yarn production

# Lint CSS and TypeScript files for code style violations
yarn lint

# Try to fix code style violations automatically
yarn lint:css --fix
yarn lint:ts --fix

License

Copyright © 2019-2021 Hugo Locurcio and contributors

Unless otherwise specified, files in this repository are licensed under the MIT license; see LICENSE.md for more information.

godot-asset-library-laravel's People

Contributors

bits-by-brandon avatar calinou avatar dependabot-preview[bot] avatar dependabot[bot] avatar imgbotapp avatar redriderx avatar steffendietz avatar tomwor 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

godot-asset-library-laravel's Issues

Implement asset tagging

Asset uploaders should be able to add tags in a way similar to GitHub topics (e.g. platformer, input-management, …). This would it easier for users to discover assets.

To be more effective, tag names would be restricted to a subset of all possible characters (lowercase letters, numbers and dashes only). This will make tag duplications less likely.

We may also want to add autocompletion to the field used to add tags to assets, so that people reuse tags that are already used by other assets.

Allow logged in users to add assets as favorites

Add an "Add as favorite" button and a way to list favorite assets for logged in users.

This would only be exposed in the web interface, not in the Godot editor since the editor can't log into the asset library yet. (Implementing login support in the Godot editor is possible, but far from trivial.)

Allow third parties to bulk-add assets to the library

It would be great to mass import assets like Materials and finish in a BlenderKit style search inside godot editor. I mean: be able to let the free asset libraries to add their own free content to the godot library in bulk as a way to promote their services. Some kind of API or something like that...

Implement server-side download hash computing

The server should compute the SHA-256 checksum of all version downloads (both if the link is inferred from the version tag or custom). It should then be persisted to the database.

This hash could also be displayed with small text on asset detail pages.

Declare supported Godot versions using a semver range rather than a minor version

Asset versions should be able to declare a supported version range, rather than a single minor version. Many assets (such as artwork) can work with almost any Godot version out there, or work with several minor versions at the same time (e.g. 3.1 and 3.2).

php-semver could be investigated for this. We should also provide example version strings in the asset submission form, for those unfamiliar with semver strings.

Fix or disable user registration email confirmation

Emails have broken HTML, which means their buttons aren't clickable. I don't know why this is happening.

Before deploying to production, we should either fix it or disable email confirmation temporarily.

[Question] Roadmap or help needed?

I noticed that this project is going forth rather slowly and with the release of Godot 4.0 I was surprised there's still the old asset store being used...
So I am very interested in helping out, even if I'm not sure how much I'm able to (occupied with work).
The problem is I'm not sure where to start.
Is there a roadmap somewhere or a list of features still missing, or a TODO? I noticed there's a "heroes wanted!" label but only one issue using it.
The CONTRIBUTING file is also not helping much...

Thanks in advance!

Implement asset submission

Things to do

  • Only allow HTTPS in icon/browse/download URLs
  • Infer a default icon URL if none is specified (icon.png as a raw file from the Git repository hoster)

Add a Docker image for easier development setup

Having a Docker image that can be spun up using docker-compose would make it easier to onboard new contributors. I didn't make one since I have no need for it myself, but help is welcome in adding a Docker setup.

The image should use PHP 7.2 for compatibility with the production setup.

Tailwind does not rebuild on `watch` or `watch-poll` commands

Neither watch nor watch-poll seem to detect changes to tailwind css classes.

Expected behavior

Adding a new tailwind class such as mb-4 triggers tailwind to rebuild a stylesheet

Observed behavior

Adding a new tailwind class such as mb-4 does not trigger a rebuild of the tailwind stylesheet. Have to manually rerun watch or development to see the new stylesheets

A case for a 5 star rating system

I noticed from the database migration files that you're using an upvote/downvote mechanic in the reviews which is then calculated as a score in the asset. However, this doesn't make for a good user experience for either the user or the asset author.

Not informative if used as a score

  • Asset X - score 30

This treats 60 upvotes and 30 downvotes in equal value to 30 upvotes and 0 downvotes which doesn't help the user in making a decision.

Visually confusing if used as upvote/downvote

  • Item 1 - 89x:+1:, 33x:-1:
  • Item 2 - 113x:+1:, 73x:-1:
  • Item 3 - 66x:+1:, 73x:-1:
  • Item 4 - 7x:+1:, 1x:-1:

Vs.

  • Item 1 - 4.9:star:
  • Item 2 - 4.5:star:
  • Item 3 - 3.0:star:
  • Item 4 - Not enough reviews

The second one is easier to determine when given 4 options, much less 400 options.

The above example is borrowed from an answer in stackexchange

It's discouraging for the author and limiting for the end-user

The end-users here are developers just like the asset author, they can give informative feedback and a more accurate score

Use Wilson or SteamDB score for sorting by rating instead of net score

Sorting by net score can be unreliable, since an asset with 60 upvotes and 30 downvotes will have the same rating as an asset with 30 upvotes and 0 downvotes. We should replace this with a different algorithm for the purposes of sorting.

If we decide to do this, sorting by rating should also be renamed to sorting by popularity.

SteamDB has introduced a custom algorithm that may be easier to integrate than Wilson score, but it may not scale down as well. Most assets on the site will have less than 20 reviews for a while, so we have to take that into account.

See #201 (comment).

Implement asset editing and removal

  • The uploader can edit their own assets
    • They can't remove their assets, as to avoid situations where people rely on an asset but it's removed without notice
  • Moderators can edit/remove any asset

DatabaseSeeder not found

Environment: Ubuntu 19.10

Running the step from the readme to seed the database results in an error:

godot-asset-library-laravel git:(master) ✗ php artisan db:seed   

   Illuminate\Contracts\Container\BindingResolutionException  : Target class [DatabaseSeeder] does not exist.

  at /home/tom/Projects/github/tomwor/godot-asset-library-laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php:805
    801| 
    802|         try {
    803|             $reflector = new ReflectionClass($concrete);
    804|         } catch (ReflectionException $e) {
  > 805|             throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e);
    806|         }
    807| 
    808|         // If the type is not instantiable, the developer is attempting to resolve
    809|         // an abstract type such as an Interface or Abstract Class and there is

  Exception trace:

  1   ReflectionException::("Class DatabaseSeeder does not exist")
      /home/tom/Projects/github/tomwor/godot-asset-library-laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php:803

  2   ReflectionClass::__construct("DatabaseSeeder")
      /home/tom/Projects/github/tomwor/godot-asset-library-laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php:803

The DatabaseSeeder class is in the autoload file though...

'Cron\\MonthField' => $vendorDir . '/dragonmantank/cron-expression/src/Cron/MonthField.php',
    'Database\\Seeds\\DatabaseSeeder' => $baseDir . '/database/seeds/DatabaseSeeder.php',
    'Database\\Seeds\\MigrateLegacyDbSeeder' => $baseDir . '/database/seeds/MigrateLegacyDbSeeder.php',

Searchable descriptions

Assuming my guess as to what this contains is correct:
https://github.com/Calinou/godot-asset-library-laravel/blob/fb3ccd9f69674e94ff8553be8aa46d0a36dc287f/app/Asset.php

the search won't be searching description field. Probably also worth throwing in category (I know it'll probably be searchable separately, but including it in free-text search is usually useful)

    /**
     * The columns that can be searched for using the search string syntax.
     *
     * @var array
     * @see https://github.com/lorisleiva/laravel-search-string#configuring-columns
     */
    protected $searchStringColumns = [
        'title' => ['searchable' => true],
        'blurb' => ['searchable' => true],
        'cost' => 'license',
        'support_level_id',
        'tags' => ['searchable' => true],
        'created_at',
        'modify_date' => 'updated_at',
        'score',
    ];

```

I'd also probably expect that `support_level_id` to actually be `support_level`, and the `cost` to be `license` - but I'm only basing this on that one file.

Add a "maintenance status" property to assets

Inspired by https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section. We can probably reuse the categories as-is, except for Experimental which would be replaced by the Testing support level we already have.

While this is purely declarative, this could help people make better decisions when choosing an asset.

This maintenance statement would be displayed on the web frontend as a notice of the form "According to its author, this asset is actively developed."

Yarn command does nothing

Environment: MacOSX 10.14

Running the 'yarn' command like mentioned in the readme does not install any dependencies:

godot-asset-library-laravel on master [!?] via ⬢ v9.11.2 via 🐘 v7.1.32 took 1m 18s
➜ yarn
yarn

Commands:
  init   scaffold a new yarn site
  new    create new content
  build  build your site
  clean  cleans destination folder
  serve  serve your site with http-server
  watch  build, serve, and watch for file changes

Options:
  --incremental  only build files that have changed    [boolean] [default: true]
  --verbose      log out additional log information                    [boolean]
  --version, -v  installed version                                     [boolean]
  --help         Show help                                             [boolean]


'yarn watch' results in

godot-asset-library-laravel on  master [!?] via ⬢ v9.11.2 via 🐘 v7.1.32 took 2s
➜ yarn watch
yarn

/Users/tomwor/.nvm/versions/node/v9.11.2/lib/node_modules/yarn-cli/node_modules/yarnjs/dist/lib/config/index.js:156
        throw new Error('_config.yml requires a \'path\' value.');
        ^

Error: _config.yml requires a 'path' value.
    at Config.update (/Users/tomwor/.nvm/versions/node/v9.11.2/lib/node_modules/yarn-cli/node_modules/yarnjs/dist/lib/config/index.js:156:15)
    at Config.loadLocal (/Users/tomwor/.nvm/versions/node/v9.11.2/lib/node_modules/yarn-cli/node_modules/yarnjs/dist/lib/config/index.js:143:12)
    at Config.setRoot (/Users/tomwor/.nvm/versions/node/v9.11.2/lib/node_modules/yarn-cli/node_modules/yarnjs/dist/lib/config/index.js:127:14)
    at Function.create (/Users/tomwor/.nvm/versions/node/v9.11.2/lib/node_modules/yarn-cli/node_modules/yarnjs/dist/lib/config/index.js:227:14)
    at exports.default (/Users/tomwor/.nvm/versions/node/v9.11.2/lib/node_modules/yarn-cli/node_modules/yarnjs/dist/bin/serve.js:8:33)
    at exports.default (/Users/tomwor/.nvm/versions/node/v9.11.2/lib/node_modules/yarn-cli/node_modules/yarnjs/dist/bin/watch.js:9:23)
    at Object.<anonymous> (/Users/tomwor/.nvm/versions/node/v9.11.2/lib/node_modules/yarn-cli/node_modules/yarnjs/dist/bin/index.js:93:5)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
    at Object.<anonymous> (/Users/tomwor/.nvm/versions/node/v9.11.2/lib/node_modules/yarn-cli/node_modules/yarnjs/dist/bin/yarn.js:5:1)
    at Module._compile (internal/modules/cjs/loader.js:654:30)

yarn is at version '1.4.0'

Test form validation in the asset submission process

I added basic form testing in 42a5d48, but this doesn't actually check whether the asset is actually present in the database (or whether the form is even valid).

I tried doing this, but it seems Laravel kept resetting the database even if I did the assertions in the same method.

I also don't know how to check for the form validation in an HTTP test, as both valid and invalid forms result in a redirection to the same URL when testing.

Implement asset version history

This can be used by asset uploaders to give more information to users.

Multiple versions could be stored per asset, each with a version identifier, a date and some release notes (with possible Markdown formatting).

We could make old versions downloadable manually via the Web interface, but the editor integration would likely only provide the latest version for simplicity's sake.

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.