Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/corowne/lorekeeper into …
Browse files Browse the repository at this point in the history
…extension/criteria-rewards

# Conflicts:
#	app/Console/Commands/AddSiteSettings.php
#	app/Console/Commands/MigrateAliases.php
#	app/Console/Commands/SetupAdminUser.php
#	app/Console/Commands/UpdateExtensionTracker.php
#	app/Console/Kernel.php
#	app/Helpers/AssetHelpers.php
#	app/Helpers/Helpers.php
#	app/Http/Controllers/Admin/Characters/CharacterController.php
#	app/Http/Controllers/Admin/Characters/CharacterImageController.php
#	app/Http/Controllers/Admin/Data/CharacterCategoryController.php
#	app/Http/Controllers/Admin/Data/CurrencyController.php
#	app/Http/Controllers/Admin/Data/FeatureController.php
#	app/Http/Controllers/Admin/Data/GalleryController.php
#	app/Http/Controllers/Admin/Data/ItemController.php
#	app/Http/Controllers/Admin/Data/PromptController.php
#	app/Http/Controllers/Admin/Data/SpeciesController.php
#	app/Http/Controllers/Admin/DesignController.php
#	app/Http/Controllers/Admin/FileController.php
#	app/Http/Controllers/Admin/GalleryController.php
#	app/Http/Controllers/Admin/HomeController.php
#	app/Http/Controllers/Admin/PageController.php
#	app/Http/Controllers/Admin/RaffleController.php
#	app/Http/Controllers/Admin/SalesController.php
#	app/Http/Controllers/Admin/SubmissionController.php
#	app/Http/Controllers/Admin/Users/UserController.php
#	app/Http/Controllers/Auth/LoginController.php
#	app/Http/Controllers/Auth/RegisterController.php
#	app/Http/Controllers/BrowseController.php
#	app/Http/Controllers/Characters/CharacterController.php
#	app/Http/Controllers/Characters/DesignController.php
#	app/Http/Controllers/Characters/MyoController.php
#	app/Http/Controllers/Comments/CommentController.php
#	app/Http/Controllers/Comments/CommentControllerInterface.php
#	app/Http/Controllers/GalleryController.php
#	app/Http/Controllers/HomeController.php
#	app/Http/Controllers/NewsController.php
#	app/Http/Controllers/PermalinkController.php
#	app/Http/Controllers/PromptsController.php
#	app/Http/Controllers/SalesController.php
#	app/Http/Controllers/ShopController.php
#	app/Http/Controllers/Users/AccountController.php
#	app/Http/Controllers/Users/InventoryController.php
#	app/Http/Controllers/Users/SubmissionController.php
#	app/Http/Controllers/Users/TradeController.php
#	app/Http/Controllers/Users/UserController.php
#	app/Http/Controllers/WorldController.php
#	app/Http/Middleware/CheckAlias.php
#	app/Http/Middleware/TrustProxies.php
#	app/Models/Character/Character.php
#	app/Models/Character/CharacterBookmark.php
#	app/Models/Character/CharacterCategory.php
#	app/Models/Character/CharacterDesignUpdate.php
#	app/Models/Comment.php
#	app/Models/Feature/Feature.php
#	app/Models/Feature/FeatureCategory.php
#	app/Models/Gallery/GalleryCollaborator.php
#	app/Models/Gallery/GallerySubmission.php
#	app/Models/Item/Item.php
#	app/Models/Item/ItemCategory.php
#	app/Models/News.php
#	app/Models/Notification.php
#	app/Models/Prompt/Prompt.php
#	app/Models/Prompt/PromptCategory.php
#	app/Models/Prompt/PromptReward.php
#	app/Models/Raffle/Raffle.php
#	app/Models/Raffle/RaffleTicket.php
#	app/Models/Rank/Rank.php
#	app/Models/Rarity.php
#	app/Models/Sales/Sales.php
#	app/Models/Sales/SalesCharacter.php
#	app/Models/Shop/Shop.php
#	app/Models/SitePage.php
#	app/Models/Species/Species.php
#	app/Models/Species/Subtype.php
#	app/Models/User/User.php
#	app/Models/User/UserAlias.php
#	app/Models/User/UserSettings.php
#	app/Models/User/UserUpdateLog.php
#	app/Policies/CommentPolicy.php
#	app/Providers/EventServiceProvider.php
#	app/Services/CharacterCategoryService.php
#	app/Services/CharacterManager.php
#	app/Services/CurrencyManager.php
#	app/Services/CurrencyService.php
#	app/Services/FeatureService.php
#	app/Services/GalleryManager.php
#	app/Services/GalleryService.php
#	app/Services/InventoryManager.php
#	app/Services/Item/BoxService.php
#	app/Services/Item/SlotService.php
#	app/Services/ItemService.php
#	app/Services/LinkService.php
#	app/Services/PageService.php
#	app/Services/PromptService.php
#	app/Services/RaffleManager.php
#	app/Services/RaffleService.php
#	app/Services/SalesService.php
#	app/Services/Service.php
#	app/Services/ShopManager.php
#	app/Services/ShopService.php
#	app/Services/SpeciesService.php
#	app/Services/SubmissionManager.php
#	app/Services/TradeManager.php
#	app/Services/UserService.php
#	app/Traits/Commentable.php
#	config/auth.php
#	config/broadcasting.php
#	config/cache.php
#	config/database.php
#	config/hashing.php
#	config/logging.php
#	config/lorekeeper/admin_sidebar.php
#	config/lorekeeper/comments.php
#	config/lorekeeper/extension_tracker.php
#	config/lorekeeper/extensions.php
#	config/lorekeeper/group_currency_form.php
#	config/lorekeeper/image_files.php
#	config/lorekeeper/item_tags.php
#	config/lorekeeper/notifications.php
#	config/lorekeeper/powers.php
#	config/lorekeeper/settings.php
#	config/queue.php
#	database/migrations/2014_10_12_000000_create_users_table.php
#	database/migrations/2014_10_12_100000_create_password_resets_table.php
#	database/migrations/2019_02_27_075638_create_game_tables.php
#	database/migrations/2019_04_07_130129_add_site_settings.php
#	database/migrations/2019_04_09_090831_create_user_log_table.php
#	database/migrations/2019_04_09_095513_create_currency_tables.php
#	database/migrations/2019_04_12_123405_fix_data_descriptions.php
#	database/migrations/2019_04_13_094613_add_owned_currencies.php
#	database/migrations/2019_04_14_121447_add_transfer_flag_to_items.php
#	database/migrations/2019_04_15_122508_add_prompts_table.php
#	database/migrations/2019_04_16_062617_add_parsed_text_to_site_pages.php
#	database/migrations/2019_04_16_080112_add_invitation_keys.php
#	database/migrations/2019_04_19_125212_fix_inventory_tables.php
#	database/migrations/2019_04_20_140827_fix_user_item_log.php
#	database/migrations/2019_04_29_080228_fix_inventory_tables_again.php
#	database/migrations/2019_04_30_070721_add_notification_data.php
#	database/migrations/2019_05_04_091240_add_news.php
#	database/migrations/2019_05_11_045038_update_character_tables.php
#	database/migrations/2019_05_12_064538_add_species_id_to_images.php
#	database/migrations/2019_05_12_100722_make_features_nonunique.php
#	database/migrations/2019_05_19_054413_make_character_image_id_nullable.php
#	database/migrations/2019_05_20_075936_add_character_sort.php
#	database/migrations/2019_06_01_121701_add_changed_data_to_character_log.php
#	database/migrations/2019_06_10_083954_create_character_transfer_tables.php
#	database/migrations/2019_07_09_063021_create_raffles.php
#	database/migrations/2019_07_13_095608_create_loot_tables.php
#	database/migrations/2019_07_13_101743_create_prompt_categories.php
#	database/migrations/2019_07_15_090200_add_prompt_rewards.php
#	database/migrations/2019_07_21_161720_add_prompt_submissions.php
#	database/migrations/2019_08_06_092958_add_submission_count_to_user_settings.php
#	database/migrations/2019_08_09_123451_make_submission_prompt_id_nullable.php
#	database/migrations/2019_08_10_120818_add_myo_slots.php
#	database/migrations/2019_08_24_101751_add_design_updates.php
#	database/migrations/2019_09_02_101303_drop_images_character_foreign_key.php
#	database/migrations/2019_09_08_060400_drop_character_images_foreign_keys.php
#	database/migrations/2019_09_08_063923_add_submitted_at_to_design_updates.php
#	database/migrations/2019_09_17_110010_rename_design_approval_status.php
#	database/migrations/2019_09_28_040911_create_shops.php
#	database/migrations/2019_10_02_085738_add_shop_purchase_limits.php
#	database/migrations/2019_10_12_095632_add_bans.php
#	database/migrations/2019_10_21_081343_add_secure_trades.php
#	database/migrations/2019_11_05_062623_modify_trade_confirmation_flags.php
#	database/migrations/2019_12_02_090542_add_staff_id_to_trades.php
#	database/migrations/2019_12_23_062730_add_item_tags.php
#	database/migrations/2020_02_23_135512_make_prompt_category_nullable.php
#	database/migrations/2020_03_07_065050_add_bookmarks.php
#	database/migrations/2020_03_14_090241_make_character_log_sender_nullable.php
#	database/migrations/2020_03_14_124534_add_subtypes.php
#	database/migrations/2020_03_27_113928_add_subtype_to_features.php
#	database/migrations/2020_04_25_114747_drop_log_foreign_keys.php
#	database/migrations/2020_05_02_152118_drop_character_myo_counts.php
#	database/migrations/2020_06_01_124250_add_parsed_submission_comments.php
#	database/migrations/2020_07_31_185640_add_type_to_design_updates.php
#	database/migrations/2020_07_31_193235_set_design_update_type_null.php
#	database/migrations/2020_10_30_170108_add_gift_writing_status_to_characters.php
#	database/migrations/2020_11_09_201534_add_user_id_to_character_image_creators.php
#	database/migrations/2022_02_19_014311_add_admin_only_to_prompts.php
#	database/migrations/2023_05_19_052929_add_is_visible_to_item_categories.php
#	package-lock.json
#	public/css/lorekeeper.css
#	resources/lang/en/validation.php
#	resources/views/admin/galleries/_galleries.blade.php
#	resources/views/admin/galleries/create_edit_gallery.blade.php
#	resources/views/admin/galleries/galleries.blade.php
#	resources/views/admin/galleries/submissions_currency_index.blade.php
#	resources/views/admin/prompts/create_edit_prompt.blade.php
#	resources/views/admin/submissions/submission.blade.php
#	resources/views/galleries/_archive_submission.blade.php
#	resources/views/galleries/_sidebar.blade.php
#	resources/views/galleries/_thumb.blade.php
#	resources/views/galleries/create_edit_submission.blade.php
#	resources/views/galleries/gallery.blade.php
#	resources/views/galleries/index.blade.php
#	resources/views/galleries/submission.blade.php
#	resources/views/galleries/submission_log.blade.php
#	resources/views/home/_inventory_stack.blade.php
#	resources/views/home/_report.blade.php
#	resources/views/home/_report_content.blade.php
#	resources/views/home/_submission_content.blade.php
#	resources/views/home/account_search.blade.php
#	resources/views/home/bug_report_index.blade.php
#	resources/views/home/create_submission.blade.php
#	resources/views/home/inventory.blade.php
#	resources/views/home/reports.blade.php
#	resources/views/home/submissions.blade.php
#	resources/views/home/submissions_closed.blade.php
#	routes/lorekeeper/admin.php
#	routes/lorekeeper/members.php
#	routes/web.php
#	yarn.lock
  • Loading branch information
ScuffedNewt committed Oct 30, 2023
2 parents 26f4e3e + 0bd8f60 commit 3f638d4
Show file tree
Hide file tree
Showing 540 changed files with 31,642 additions and 12,641 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/format_blade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Format (Blade)

on:
push:
branches:
- '**'

jobs:
blade-formatter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'npm'

- name: Install packages
run: npm install

- name: Run blade-formatter
run: npm run format

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'refactor: fix blade formatting'
27 changes: 27 additions & 0 deletions .github/workflows/format_php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Format (PHP)

on:
push:
branches:
- '**'

jobs:
pint:
runs-on: ubuntu-latest
steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: '8.1'
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Install
run: composer install

- name: Run pint
run: composer lint

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'refactor: fix PHP styling'
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/composer.lock
*.env
/composer.phar
*.cache
10 changes: 10 additions & 0 deletions app/Console/Commands/AddSiteSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ public function handle() {

$this->addSiteSetting('gallery_submissions_require_approval', 1, '0: Gallery submissions do not require approval, 1: Gallery submissions require approval.');

$this->addSiteSetting('is_maintenance_mode', 0, '0: Site is normal, 1: Users without the Has Maintenance Access power will be redirected to the home page.');

$this->addSiteSetting('deactivated_privacy', 0, 'Who can view the deactivated list? 0: Admin only, 1: Staff only, 2: Members only, 3: Public.');

$this->addSiteSetting('deactivated_link', 0, '0: No link to the deactivated list is displayed anywhere, 1: Link to the deactivated list is shown on the user list.');

$this->addSiteSetting('deactivated_key', 0, 'Optional key to view the deactivated list. Enter "0" to not require one.');

$this->addSiteSetting('comment_dislikes_enabled', 0, '0: Dislikes disabled, 1: Dislikes enabled.');

$this->line("\nSite settings up to date!");
}

Expand Down
18 changes: 17 additions & 1 deletion app/Console/Commands/MigrateAliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
use App\Models\User\User;
use App\Models\User\UserAlias;
use App\Models\User\UserCharacterLog;
use DB;
use Illuminate\Console\Command;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class MigrateAliases extends Command {
Expand Down Expand Up @@ -114,6 +114,22 @@ public function handle() {
}

$this->info('Migrated: Character owner aliases');

$nullCharacters = Character::where('owner_url', 'https://deviantart.com/null')->get();
if ($nullCharacters->count()) {
$this->info('Fixing character owner URLs...');

foreach ($nullCharacters as $character) {
$logs = UserCharacterLog::where('character_id', $character->id)->where('recipient_url', '!=', null)->orderBy('id', 'DESC')->first();
if ($logs) {
$character->owner_url = $logs->recipient_url;
$character->save();
}
}
$this->info('Fixed: Character owner URLs');
} else {
$this->line('Skipped: Character owner URL fixes (nothing to fix)');
}
} else {
$this->line('Skipped: Character owner aliases (nothing to migrate)');
}
Expand Down
10 changes: 5 additions & 5 deletions app/Console/Commands/SetupAdminUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ public function handle() {
if ($confirm) {
$service = new UserService;
$user = $service->createUser([
'name' => $name,
'email' => $email,
'rank_id' => $adminRank->id,
'password' => $password,
'dob' => [
'name' => $name,
'email' => $email,
'rank_id' => $adminRank->id,
'password' => $password,
'dob' => [
'day' => '01',
'month' => '01',
'year' => '1970',
Expand Down
47 changes: 47 additions & 0 deletions app/Console/Commands/UpdateCommentTypes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace App\Console\Commands;

use App\Models\Comment;
use Illuminate\Console\Command;

class UpdateCommentTypes extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'update-comment-types';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Updates comment types.';

/**
* Create a new command instance.
*/
public function __construct() {
parent::__construct();
}

/**
* Execute the console command.
*
* @return int
*/
public function handle() {
$comments = Comment::where('commentable_type', 'App\Models\Report\Report')->where('type', 'User-User');

if ($comments->count()) {
$this->line('Updating comment types...');
$comments->update(['type' => 'Staff-User']);
} else {
$this->info('No comments to update!');
}

return 0;
}
}
56 changes: 41 additions & 15 deletions app/Console/Commands/UpdateExtensionTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Console\Commands;

use Config;
use DB;
use Illuminate\Console\Command;

Expand Down Expand Up @@ -34,40 +33,67 @@ public function __construct() {
* @return mixed
*/
public function handle() {
$extensions = Config::get('lorekeeper.extension_tracker');

$this->info("\n".'****************************');
$this->info('* UPDATE EXTENSION TRACKER *');
$this->info('****************************');

$extendos = [];
foreach (glob('config\lorekeeper\ext-tracker\*.php') as $extension) {
$extendos[basename($extension, '.php')] = include $extension;
}

$this->line('Adding site extensions...existing entries will be updated.'."\n");

foreach ($extensions as $data) {
$extension = DB::table('site_extensions')->where('key', $data['key']);
foreach ($extendos as $key => $data) {
$extension = DB::table('site_extensions')->where('key', $key);
if (!$extension->exists()) {
DB::table('site_extensions')->insert([
'key' => $data['key'],
'key' => $key,
'wiki_key' => $data['wiki_key'],
'creators' => $data['creators'],
'version' => $data['version'],
]);
$this->info('Added: '.$data['key'].' / Version: '.$data['version']);
$this->info('Added: '.$key.' / Version: '.$data['version']);
} elseif ($extension->first()->version != $data['version']) {
$this->info(ucfirst($data['key']).' version mismatch. Old version: '.$extension->first()->version.' / New version: '.$data['version']);
$confirm = $this->confirm('Do you want to update the listed version of '.$data['key'].' to '.$data['version'].'? This will not affect any other files.');
if ($confirm) {
DB::table('site_extensions')->where('key', $data['key'])->update([
'key' => $data['key'],
$this->info(ucfirst($key).' version mismatch. Old version: '.$extension->first()->version.' / New version: '.$data['version']);
$confirm = $this->confirm('Do you want to update the listed version of '.$key.' to '.$data['version'].'? This will not affect any other files.');
if ($confirm || !app()->runningInConsole()) {
DB::table('site_extensions')->where('key', $key)->update([
'key' => $key,
'wiki_key' => $data['wiki_key'],
'creators' => $data['creators'],
'version' => $data['version'],
]);
$this->info('Updated: '.$data['key'].' / Version: '.$data['version']);
$this->info('Updated: '.$key.' / Version: '.$data['version']);
} else {
$this->line('Skipped: '.$data['key'].' / Version: '.$extension->first()->version);
$this->line('Skipped: '.$key.' / Version: '.$extension->first()->version);
}
} else {
$this->line('Skipped: '.$data['key'].' / Version: '.$data['version']);
$this->line('Skipped: '.$key.' / Version: '.$data['version']);
}
}

if (app()->runningInConsole()) {
$extensions = DB::table('site_extensions')->pluck('key')->toArray();
$processed = array_keys($extendos);

$missing = array_merge(array_diff($processed, $extensions), array_diff($extensions, $processed));

if (count($missing)) {
$miss = implode(', ', $missing);
$this->line("\033[31m");
$this->error('The following extension'.(count($missing) == 1 ? ' is' : 's are').' not present as a file but '.(count($missing) == 1 ? 'is' : 'are').' still in your database:');
$this->line($miss);

$confirm = $this->confirm('Do you want to remove '.(count($missing) == 1 ? 'this extension' : 'these extensions').' from your database and extensions list? This will not affect any other files.');
if ($confirm) {
foreach ($missing as $ext) {
$extension = DB::table('site_extensions')->where('key', $ext)->delete();
$this->info('Deleted: '.$ext);
}
} else {
$this->line('Leaving extension'.(count($missing) == 1 ? '' : 's').' alone.');
}
}
}

Expand Down
88 changes: 88 additions & 0 deletions app/Console/Commands/UpdateStaffRewardActions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php

namespace App\Console\Commands;

use DB;
use Illuminate\Console\Command;

class UpdateStaffRewardActions extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'update-staff-reward-actions';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Run this command in order to add staff actions with configurable rewards.';

/**
* Create a new command instance.
*/
public function __construct() {
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle() {
$this->info("\n".'*******************************');
$this->info('* UPDATE STAFF REWARD ACTIONS *');
$this->info('*******************************');

$actions = [];
foreach (glob('config/lorekeeper/staff-reward-actions/*.php') as $action) {
$actions[basename($action, '.php')] = include $action;
}

$this->line('Adding staff actions...existing entries will be skipped.'."\n");

foreach ($actions as $key => $data) {
$action = DB::table('staff_actions')->where('key', $key);
if (!$action->exists()) {
DB::table('staff_actions')->insert([
'key' => $key,
'name' => $data['name'],
'description' => $data['description'],
'value' => 1,
]);
$this->info('Added: '.$key);
} else {
$this->line('Skipped: '.$key);
}
}

if (app()->runningInConsole()) {
$processed = array_keys($actions);
$actions = DB::table('staff_actions')->pluck('key')->toArray();

$missing = array_merge(array_diff($processed, $actions), array_diff($actions, $processed));

if (count($missing)) {
$miss = implode(', ', $missing);
$this->line("\033[31m");
$this->error('The following action'.(count($missing) == 1 ? ' is' : 's are').' not present as a file but '.(count($missing) == 1 ? 'is' : 'are').' still in your database:');
$this->line($miss);

$confirm = $this->confirm('Do you want to remove '.(count($missing) == 1 ? 'this action' : 'these actions').' from your database and actions list? This will not affect any other files.');
if ($confirm) {
foreach ($missing as $act) {
$action = DB::table('staff_actions')->where('key', $act)->delete();
$this->info('Deleted: '.$act);
}
} else {
$this->line('Leaving action'.(count($missing) == 1 ? '' : 's').' alone.');
}
}
}

$this->info("\n".'All actions have been added.'."\n");
}
}
Loading

0 comments on commit 3f638d4

Please sign in to comment.