Skip to content

meda10/Love-blocks-web

Repository files navigation

Love Blocks

Love Blocks is web based code editor for LÖVE or Lua. You can use block based programing or classic text editor. You can find the application here https://loveblocks.tk/. If you want simple way to download your games to Android download the Love Blocks - Android from Play Store.

Used Technologies

  • Laravel
  • MySQL
  • VueJS + InertiaJS
  • Monaco Code Editor + Blockly Code Editor
  • Tailwind CSS
  • Lua Language Server
  • Firebase Cloud Messaging (Communication with Android phone)
  • Docker

How it works

Docker

Folder docker contains all files needed to create docker images

Maintenance

Script blockMaintenance.sh checks if all blocks are working with current version of LÖVE

Installation

Define environment variables

Create .env file for Docker configuration. Set USE_LOCAL_CA=1 or change domain name and SSL certificates, otherwise HTTPS will not work.

  • If you want authentication with Google and GitHub you need to add provider information to .env file. More information here.
  • If you want to connect to Love Blocks - Android. First you will need to set up your Firebase account and create new project. Here you will need to create new web app ande new android app. Then download the web app configuration in .json and specify the file path in your .env file under FIREBASE_CREDENTIALS. You also need to add google-services.json to your Love Blocks - Android app.
cp .env.example .env

Create docker containers

docker-compose up --build -d

MySQL configuration

Open MySQL container

docker-compose exec mysql bash

Create database user and add privileges. The USERNAME, PASSWORD and DB_NAME must be same as in .env file.

mysql -u root -p
show databases;
CREATE USER 'USERNAME'@'%' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON * . * TO 'USERNAME'@'%';
FLUSH PRIVILEGES;
CREATE DATABASE 'DB_NAME';
USE 'DB_NAME';
GRANT ALL ON 'DB_NAME'.* TO 'USERNAME'@'%';
FLUSH PRIVILEGES;
EXIT;
exit

Init laravel app

Install composer dependencies

docker-compose run --rm composer install

Generate key for app

docker-compose run --rm artisan key:generate

Create storage link

docker-compose run --rm artisan storage:link

Migrate database and add initial data.

  • If you want to create user with specific role you can do that in RolePermissionSeeder.php
docker-compose run --rm artisan migrate:fresh --seed

Install npm dependencies and run

docker-compose run --rm npm install
docker-compose run --rm npm run dev

In production

Cache config and route

docker-compose run --rm composer dump-autoload
docker-compose run --rm artisan config:cache
docker-compose run --rm artisan route:cache

Install npm dependencies and run production

docker-compose run --rm npm install
docker-compose run --rm npm run production

If something doesn't work

If Laravel shows Permission denied error for storage:

sudo chmod -R 777 storage bootstrap/cache
  • If Language server doesn't work check if binary has execute permission
  • If you use ARM architecture use docker-compose-arm.yml

About

Love Blocks is web based code editor for LÖVE or Lua. You can use block based programing or classic text editor.

Resources

License

Stars

Watchers

Forks

Languages