From 97d08c62d581558b0b799bd94eb0d1288fe7d925 Mon Sep 17 00:00:00 2001
From: xander <63683502+xander113@users.noreply.github.com>
Date: Wed, 23 Mar 2022 11:02:23 -1200
Subject: [PATCH 1/2] started catalog
cock
---
web/app/Http/Controllers/Controller.php | 28 ++++
web/app/Models/CatalogCategory.php | 20 +++
web/app/Models/Inventory.php | 19 +++
web/app/Models/Item.php | 15 ++
web/app/Models/User.php | 8 +-
.../2021_12_16_011849_create_users_table.php | 1 +
.../2022_03_23_215614_create_items_table.php | 40 ++++++
..._03_23_215624_create_inventories_table.php | 36 +++++
...215847_create_catalog_categories_table.php | 33 +++++
web/resources/js/components/Navbar.js | 17 ++-
web/resources/js/layouts/App.js | 9 ++
web/resources/js/pages/Catalog.js | 131 ++++++++++++++++++
web/resources/js/pages/Forum.js | 2 +-
web/resources/js/pages/Settings.js | 4 +-
web/resources/sass/Graphictoria.scss | 57 ++++++++
web/routes/apis.php | 4 +
16 files changed, 413 insertions(+), 11 deletions(-)
create mode 100644 web/app/Models/CatalogCategory.php
create mode 100644 web/app/Models/Inventory.php
create mode 100644 web/app/Models/Item.php
create mode 100644 web/database/migrations/2022_03_23_215614_create_items_table.php
create mode 100644 web/database/migrations/2022_03_23_215624_create_inventories_table.php
create mode 100644 web/database/migrations/2022_03_23_215847_create_catalog_categories_table.php
create mode 100644 web/resources/js/pages/Catalog.js
diff --git a/web/app/Http/Controllers/Controller.php b/web/app/Http/Controllers/Controller.php
index 63bfe5c..0b881b8 100644
--- a/web/app/Http/Controllers/Controller.php
+++ b/web/app/Http/Controllers/Controller.php
@@ -12,6 +12,9 @@ use App\Models\Category;
use App\Models\Post;
use App\Models\Reply;
use App\Models\Staff;
+use App\Models\CatalogCategory;
+use App\Models\Item;
+use App\Models\Inventory;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
@@ -41,6 +44,8 @@ class Controller extends BaseController
$array = $user->toArray();
$staff = Staff::where('user_id', $user->id)->first();
if ($staff) {$array['power'] = $staff->power_level;}
+ $array['bank'] = $user->bank;
+ $array['email'] = $user->email;
return Response()->json(["data"=>$array]);
break;
case "fetchedUser":
@@ -86,6 +91,29 @@ class Controller extends BaseController
}
+ public function fetchCategoriesCatalog() {
+
+ $categories = CatalogCategory::get();
+
+ return Response()->json(["categories"=>$categories]);
+
+ }
+
+ public function fetchCategoryCatalog($id) {
+
+ $category = CatalogCategory::where('id', $id)->first();
+
+ if (!$category) {return Response()->json(false);}
+
+ $items = $category->items()->orderBy('updated_at', 'desc')->paginate(25);
+
+ foreach ($items as &$item) {
+ $item['creator'] = User::where('id', $item['creator_id'])->first();
+ }
+
+ return Response()->json(["data"=>$category, "items"=>$items]);
+ }
+
public function fetchCategory($id) {
$category = Category::where('id', $id)->first();
diff --git a/web/app/Models/CatalogCategory.php b/web/app/Models/CatalogCategory.php
new file mode 100644
index 0000000..588671a
--- /dev/null
+++ b/web/app/Models/CatalogCategory.php
@@ -0,0 +1,20 @@
+morphMany('App\Models\Item', 'category');
+ }
+
+}
diff --git a/web/app/Models/Inventory.php b/web/app/Models/Inventory.php
new file mode 100644
index 0000000..f7bdf38
--- /dev/null
+++ b/web/app/Models/Inventory.php
@@ -0,0 +1,19 @@
+belongsTo(Item::class);
+ }
+
+}
diff --git a/web/app/Models/Item.php b/web/app/Models/Item.php
new file mode 100644
index 0000000..935f698
--- /dev/null
+++ b/web/app/Models/Item.php
@@ -0,0 +1,15 @@
+id)->first();
return $staff;
}
+
+ public function inventory() {
+ return $this->morphMany('App\Models\Inventory', 'owner');
+ }
}
diff --git a/web/database/migrations/2021_12_16_011849_create_users_table.php b/web/database/migrations/2021_12_16_011849_create_users_table.php
index f91f29d..3dd6eb8 100644
--- a/web/database/migrations/2021_12_16_011849_create_users_table.php
+++ b/web/database/migrations/2021_12_16_011849_create_users_table.php
@@ -20,6 +20,7 @@ class CreateUsersTable extends Migration
$table->timestamp('email_verified_at')->default(null);
$table->string('password');
$table->string('token');
+ $table->integer('bank')->default(150);
$table->string('about')->default(null);
$table->timestamps();
});
diff --git a/web/database/migrations/2022_03_23_215614_create_items_table.php b/web/database/migrations/2022_03_23_215614_create_items_table.php
new file mode 100644
index 0000000..ce26c93
--- /dev/null
+++ b/web/database/migrations/2022_03_23_215614_create_items_table.php
@@ -0,0 +1,40 @@
+id();
+ $table->string('title');
+ $table->string('description');
+ $table->string('thumbnail');
+ $table->integer('creator_id');
+ $table->integer('starting_price')->default(5);
+ $table->integer('current_price')->default(5);
+ $table->integer('category_id')->default(1);
+ $table->string('category_type');
+ //may need to add more later idk.
+ $table->timestamps();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::dropIfExists('items');
+ }
+}
diff --git a/web/database/migrations/2022_03_23_215624_create_inventories_table.php b/web/database/migrations/2022_03_23_215624_create_inventories_table.php
new file mode 100644
index 0000000..00387e9
--- /dev/null
+++ b/web/database/migrations/2022_03_23_215624_create_inventories_table.php
@@ -0,0 +1,36 @@
+id();
+ $table->string('item_id');
+ $table->string('owner_id');
+ $table->string('owner_type');
+ $table->string('uid'); //unique id | used for limiteds, the original id of the inventory row. once set, it never changes
+ $table->boolean('status')->default(true);
+ $table->timestamps();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::dropIfExists('inventories');
+ }
+}
diff --git a/web/database/migrations/2022_03_23_215847_create_catalog_categories_table.php b/web/database/migrations/2022_03_23_215847_create_catalog_categories_table.php
new file mode 100644
index 0000000..c0c259c
--- /dev/null
+++ b/web/database/migrations/2022_03_23_215847_create_catalog_categories_table.php
@@ -0,0 +1,33 @@
+id();
+ $table->string('title');
+ $table->string('description');
+ $table->timestamps();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::dropIfExists('catalog_categories');
+ }
+}
diff --git a/web/resources/js/components/Navbar.js b/web/resources/js/components/Navbar.js
index ce7099e..aba49c0 100644
--- a/web/resources/js/components/Navbar.js
+++ b/web/resources/js/components/Navbar.js
@@ -51,13 +51,16 @@ const Navbar = (props) => {
<>
{props.user?
-
-
-
- : Login / Sign up}
+
+
Bank: ${props.user.bank}
+
+
+
+
+
: Login / Sign up}
>
:
null
diff --git a/web/resources/js/layouts/App.js b/web/resources/js/layouts/App.js
index 92c6667..7735033 100644
--- a/web/resources/js/layouts/App.js
+++ b/web/resources/js/layouts/App.js
@@ -35,6 +35,7 @@ import CreatePost from '../pages/CreatePost.js';
import CreateReply from '../pages/CreateReply.js';
import Settings from '../pages/Settings.js';
import User from '../pages/User.js';
+import Catalog from '../pages/Catalog.js';
axios.defaults.withCredentials = true
@@ -155,6 +156,14 @@ const App = () => {
+
+
+
+
+
+
+
+
diff --git a/web/resources/js/pages/Catalog.js b/web/resources/js/pages/Catalog.js
new file mode 100644
index 0000000..15c1b3e
--- /dev/null
+++ b/web/resources/js/pages/Catalog.js
@@ -0,0 +1,131 @@
+// © XlXi 2021
+// Graphictoria 5
+
+import axios from 'axios';
+import React, { useEffect, useState } from "react";
+import { Link, useHistory, useParams } from "react-router-dom";
+
+import Config from '../config.js';
+
+import SetTitle from "../Helpers/Title.js";
+
+import Loader from '../Components/Loader.js';
+
+import { GenericErrorModal } from './Errors.js';
+import { Card, CardTitle } from '../Layouts/Card.js';
+import { paginate } from '../helpers/utils.js';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+
+var url = Config.BaseUrl.replace('http://', '');
+var protocol = Config.Protocol;
+
+const Catalog = (props) => {
+
+ var id = useParams().id;
+ const [state, setState] = useState({offline: false, loading: true});
+ const [categories, setCategoires] = useState([]);
+ const [category, setCategory] = useState([]);
+ const [items, setItems] = useState({items: [], currentPage: 1, meta: []});
+ const user = props.user;
+
+ if (!id) id = 1;
+
+ const fetchCategories = async () => {
+ await axios.get(`${protocol}apis.${url}/fetch/categories/catalog`, {headers: {"X-Requested-With":"XMLHttpRequest"}}).then(data=>{
+ setCategoires(data.data.categories);
+ }).catch(error=>{console.log(error);});
+ }
+
+ const fetchCategory = async () => {
+ await axios.get(`${protocol}apis.${url}/fetch/category/catalog/${id}?page=${items.currentPage}`, {headers: {"X-Requested-With":"XMLHttpRequest"}}).then(data=>{
+ if (!data.data) {window.location.href=`/forum`;return;}
+ setCategory(data.data.data);
+ setItems({...items, items: data.data.items.data, meta: data.data.items});
+ }).catch(error=>{console.log(error);});
+ }
+
+ const paginateitems = async (decision) => {
+ paginate(decision, items.currentPage, items.meta).then(res=>{
+ switch(res){
+ case "increase":
+ setItems({...items, currentPage: items.currentPage+1});
+ break;
+ case "decrease":
+ setItems({...items, currentPage: items.currentPage-1});
+ break;
+ default:
+ break;
+ }
+ }).catch(error=>console.log(error));
+ }
+
+ useEffect(async ()=>{
+ SetTitle(`Catalog`);
+ await fetchCategory();
+ await fetchCategories();
+ setState({...state, loading: false});
+ }, []);
+
+ useEffect(async()=>{
+ setState({...state, loading: true});
+ await fetchCategory();
+ setState({...state, loading: false});
+ }, [items.currentPage]);
+
+ return (
+ state.loading || categories.length <= 0
+ ?
+
+ :
+
+
+
+
+
+
Categories:
+ {categories.map(category=>(
+ <>
+ {category.title}
+ >
+ ))}
+
+
+
+
Options:
+
+
Search for an item:
+
+
+
+
+
+ {items.items.length <= 0 ?
There are currently no items!
: null}
+
+ {items.items.map(item=>(
+ <>
+
+
+ [Thumbnail.]
+
+
+
{item.title}
+
+
${item.current_price}
+
+
+
+ >
+ ))}
+
+ {items.items.length >= 1?
+
+ {items.currentPage >= 2? : null}
+ {items.currentPage < items.meta.last_page? : null}
+
: null}
+
+
+
+ );
+}
+
+export default Catalog;
diff --git a/web/resources/js/pages/Forum.js b/web/resources/js/pages/Forum.js
index d5d1a1a..001c140 100644
--- a/web/resources/js/pages/Forum.js
+++ b/web/resources/js/pages/Forum.js
@@ -73,7 +73,7 @@ const Forum = (props) => {
}, [posts.currentPage]);
return (
- state.loading
+ state.loading || categories.length <= 0
?
:
diff --git a/web/resources/js/pages/Settings.js b/web/resources/js/pages/Settings.js
index c752109..3647fe5 100644
--- a/web/resources/js/pages/Settings.js
+++ b/web/resources/js/pages/Settings.js
@@ -68,8 +68,8 @@ const Settings = (props) => {
{validity.error?
-
-
+
diff --git a/web/resources/sass/Graphictoria.scss b/web/resources/sass/Graphictoria.scss
index 65ce360..143fa64 100644
--- a/web/resources/sass/Graphictoria.scss
+++ b/web/resources/sass/Graphictoria.scss
@@ -330,6 +330,7 @@ html {
.graphictoria-nav-splitter {
margin-top: 16px;
+ margin-bottom: 16px !important;
}
.graphictoria-search, #graphictoria-search-dropdown {
@@ -928,10 +929,34 @@ p {
margin: 0px !important;
}
+.fs10 {
+ font-size: 10px !important;
+}
+
+.fs11 {
+ font-size: 11px !important;
+}
+
.fs12 {
font-size: 12px !important;
}
+.fs13 {
+ font-size: 13px !important;
+}
+
+.fs14 {
+ font-size: 14px !important;
+}
+
+.fs15 {
+ font-size: 15px !important;
+}
+
+.fs16 {
+ font-size: 16px !important;
+}
+
.padding-none {
padding: 0px !important
}
@@ -956,6 +981,26 @@ p {
margin-bottom: 15px !important;
}
+.mb-5 {
+ margin-bottom: 5px !important;
+}
+
+.mt-5 {
+ margin-bottom: 5px !important;
+}
+
+.mb-10 {
+ margin-bottom: 10px !important;
+}
+
+.mt-10 {
+ margin-bottom: 10px !important;
+}
+
+::marker {
+ display: none !important;
+}
+
.graphic-post {
padding: 1rem 1rem;
text-align: start;
@@ -968,6 +1013,18 @@ p {
align-items: center !important;
}
+.graphic-post-column {
+ padding: 1rem 1rem;
+ text-align: start;
+ color: inherit !important;
+ text-decoration: none !important;
+ background-color: #222 !important;
+ border-radius: 0.25px;
+ display: flex;
+ flex-direction: column;
+ align-items: center !important;
+}
+
.error-dialog {
padding: 5px;
margin-bottom: 10px;
diff --git a/web/routes/apis.php b/web/routes/apis.php
index b720633..bb80f0c 100644
--- a/web/routes/apis.php
+++ b/web/routes/apis.php
@@ -31,6 +31,10 @@ Route::get('/fetch/categories', 'Controller@fetchCategories');
Route::post('/fetch/categories/post', 'Controller@fetchCategoriesFP');
+Route::get('/fetch/categories/catalog', 'Controller@fetchCategoriesCatalog');
+
+Route::get('/fetch/category/catalog/{id}', 'Controller@fetchCategoryCatalog');
+
Route::get('/fetch/category/{id}', 'Controller@fetchCategory');
Route::get('/fetch/posts/{id}', 'Controller@fetchPosts');
--
2.40.1
From e67e83c1b6f2cd4e35524027094d882156a116de Mon Sep 17 00:00:00 2001
From: gtoriadotnet
Date: Thu, 24 Mar 2022 00:05:07 -0400
Subject: [PATCH 2/2] ClientSettings api
---
web/app/Helpers/COMHelper.php | 15 +++
web/app/Helpers/GridHelper.php | 35 ++++++
web/app/Helpers/JSON.php | 21 ++++
web/app/Http/Controllers/AppSettings.php | 106 ++++++++++++++++++
web/app/Models/FFlag.php | 14 +++
web/app/Models/FastGroup.php | 11 --
web/app/Models/Fbucket.php | 19 ++++
web/app/Providers/RouteServiceProvider.php | 5 +
web/config/database.php | 32 +++++-
.../2021_12_15_224204_create_fflags_table.php | 9 +-
...21_12_16_011850_create_fbuckets_table.php} | 13 ++-
web/database/seeders/FFlagSeeder.php | 18 +--
.../seeders/WebConfigurationSeeder.php | 10 ++
web/routes/appsettings.php | 28 +++++
14 files changed, 306 insertions(+), 30 deletions(-)
create mode 100644 web/app/Helpers/COMHelper.php
create mode 100644 web/app/Helpers/GridHelper.php
create mode 100644 web/app/Helpers/JSON.php
create mode 100644 web/app/Http/Controllers/AppSettings.php
delete mode 100644 web/app/Models/FastGroup.php
create mode 100644 web/app/Models/Fbucket.php
rename web/database/migrations/{2021_12_16_011850_create_fastgroups_table.php => 2021_12_16_011850_create_fbuckets_table.php} (66%)
create mode 100644 web/routes/appsettings.php
diff --git a/web/app/Helpers/COMHelper.php b/web/app/Helpers/COMHelper.php
new file mode 100644
index 0000000..404f1cd
--- /dev/null
+++ b/web/app/Helpers/COMHelper.php
@@ -0,0 +1,15 @@
+ip();
+ $whitelistedIps = explode(';', WebsiteConfiguration::where('name', 'WhitelistedIPs')->first()->value);
+
+ return in_array($ip, $whitelistedIps);
+ }
+
+ public static function isAccessKeyValid($request) {
+ $accessKey = WebsiteConfiguration::where('name', 'ComputeServiceAccessKey')->first()->value;
+
+ return ($request->header('AccessKey') == $accessKey);
+ }
+
+ public static function hasAllAccess($request) {
+ if(COMHelper::isCOM()) return true;
+ if(GridHelper::isIpWhitelisted($request) && GridHelper::isAccessKeyValid($request)) return true;
+
+ return false;
+ }
+}
diff --git a/web/app/Helpers/JSON.php b/web/app/Helpers/JSON.php
new file mode 100644
index 0000000..9a6f6db
--- /dev/null
+++ b/web/app/Helpers/JSON.php
@@ -0,0 +1,21 @@
+header('Content-Type', 'application/json');
+ }
+}
diff --git a/web/app/Http/Controllers/AppSettings.php b/web/app/Http/Controllers/AppSettings.php
new file mode 100644
index 0000000..6f3ea66
--- /dev/null
+++ b/web/app/Http/Controllers/AppSettings.php
@@ -0,0 +1,106 @@
+ '',
+ 'Fast' => 'F',
+ 'Dynamic' => 'DF',
+ 'Synchronised' => 'SF'
+ ];
+
+ /**
+ * A list of flag types
+ *
+ * @var array
+ */
+ protected $types = [
+ 'Log' => 'Log',
+ 'Int' => 'Int',
+ 'String' => 'String',
+ 'Boolean' => 'Flag'
+ ];
+
+ /**
+ * Returns a JSON array with the error code and message.
+ *
+ * @return Response
+ */
+ private function error($data, $code = 400)
+ {
+ return response(['errors' => [$data]], 400);
+ }
+
+ /**
+ * Returns a JSON array of settings for the specified bucket.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @param string $bucketName
+ * @return Response
+ */
+ public function getBucket(Request $request, $bucketName)
+ {
+ $primaryBucket = Fbucket::where('name', $bucketName);
+
+ if($primaryBucket->exists()) {
+ $primaryBucket = $primaryBucket->first();
+
+ $bucketIds = [ $primaryBucket->id ];
+ $bucketIds = array_merge($bucketIds, json_decode($primaryBucket->inheritedGroupIds));
+
+ if($primaryBucket->protected == 1 && !GridHelper::hasAllAccess($request)) {
+ return $this->error([
+ 'code' => 2,
+ 'message' => 'You do not have access to this bucket.'
+ ], 401);
+ }
+
+ /* */
+
+ $flags = [];
+
+ foreach($bucketIds as $bucket) {
+ $fflags = FFlag::where('bucketId', $bucket)->get();
+
+ foreach($fflags as $flag) {
+ $prefix = $this->prefixes[$flag->type];
+ $dataType = $this->types[$flag->dataType];
+
+ $name = '';
+ if($prefix != 'Unscoped') {
+ $name = ($prefix . $dataType);
+ }
+
+ $name .= $flag->name;
+
+ $flags[$name] = $flag->value;
+ }
+ }
+
+ return JSON::EncodeResponse($flags);
+ } else {
+ return $this->error([
+ 'code' => 1,
+ 'message' => 'The requested bucket does not exist.'
+ ]);
+ }
+ }
+
+}
diff --git a/web/app/Models/FFlag.php b/web/app/Models/FFlag.php
index 40701e2..e1ef304 100644
--- a/web/app/Models/FFlag.php
+++ b/web/app/Models/FFlag.php
@@ -7,5 +7,19 @@ use Illuminate\Database\Eloquent\Model;
class FFlag extends Model
{
+ /**
+ * The database connection that should be used by the migration.
+ *
+ * @var string
+ */
+ protected $connection = 'mysql-fflag';
+
+ /**
+ * The table associated with the model.
+ *
+ * @var string
+ */
+ protected $table = 'fflags';
+
use HasFactory;
}
diff --git a/web/app/Models/FastGroup.php b/web/app/Models/FastGroup.php
deleted file mode 100644
index b2041d7..0000000
--- a/web/app/Models/FastGroup.php
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace($this->namespace)
->group(base_path('routes/apis.php'));
+ Route::domain('clientsettings.api.' . env('APP_URL'))
+ ->middleware('api')
+ ->namespace($this->namespace)
+ ->group(base_path('routes/appsettings.php'));
+
Route::domain('impulse.' . env('APP_URL'))
->middleware('admin')
->namespace($this->namespace)
diff --git a/web/config/database.php b/web/config/database.php
index 66d8670..a8f2466 100644
--- a/web/config/database.php
+++ b/web/config/database.php
@@ -15,7 +15,7 @@ return [
|
*/
- 'default' => env('DB_CONNECTION', 'mysql'),
+ 'default' => env('DB_CONNECTION', 'mysql-primary'),
/*
|--------------------------------------------------------------------------
@@ -38,17 +38,37 @@ return [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
- 'database' => env('DB_DATABASE', database_path('database.sqlite')),
+ 'database' => env('DB_PRIMARY_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
- 'mysql' => [
+ 'mysql-primary' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
- 'database' => env('DB_DATABASE', 'forge'),
+ 'database' => env('DB_PRIMARY_DATABASE', 'forge'),
+ 'username' => env('DB_USERNAME', 'forge'),
+ 'password' => env('DB_PASSWORD', ''),
+ 'unix_socket' => env('DB_SOCKET', ''),
+ 'charset' => 'utf8mb4',
+ 'collation' => 'utf8mb4_unicode_ci',
+ 'prefix' => '',
+ 'prefix_indexes' => true,
+ 'strict' => true,
+ 'engine' => null,
+ 'options' => extension_loaded('pdo_mysql') ? array_filter([
+ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
+ ]) : [],
+ ],
+
+ 'mysql-fflag' => [
+ 'driver' => 'mysql',
+ 'url' => env('DATABASE_URL'),
+ 'host' => env('DB_HOST', '127.0.0.1'),
+ 'port' => env('DB_PORT', '3306'),
+ 'database' => env('DB_FFLAG_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
@@ -68,7 +88,7 @@ return [
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
- 'database' => env('DB_DATABASE', 'forge'),
+ 'database' => env('DB_PRIMARY_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
@@ -83,7 +103,7 @@ return [
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
- 'database' => env('DB_DATABASE', 'forge'),
+ 'database' => env('DB_PRIMARY_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
diff --git a/web/database/migrations/2021_12_15_224204_create_fflags_table.php b/web/database/migrations/2021_12_15_224204_create_fflags_table.php
index 6ba9868..d460fae 100644
--- a/web/database/migrations/2021_12_15_224204_create_fflags_table.php
+++ b/web/database/migrations/2021_12_15_224204_create_fflags_table.php
@@ -6,6 +6,13 @@ use Illuminate\Support\Facades\Schema;
class CreateFflagsTable extends Migration
{
+ /**
+ * The database connection that should be used by the migration.
+ *
+ * @var string
+ */
+ protected $connection = 'mysql-fflag';
+
/**
* Run the migrations.
*
@@ -19,7 +26,7 @@ class CreateFflagsTable extends Migration
$table->string('value');
$table->enum('dataType', ['Log', 'Int', 'String', 'Boolean']);
$table->enum('type', ['Unscoped', 'Fast', 'Dynamic', 'Synchronised']);
- $table->bigInteger('groupId');
+ $table->bigInteger('bucketId');
$table->timestamps();
});
}
diff --git a/web/database/migrations/2021_12_16_011850_create_fastgroups_table.php b/web/database/migrations/2021_12_16_011850_create_fbuckets_table.php
similarity index 66%
rename from web/database/migrations/2021_12_16_011850_create_fastgroups_table.php
rename to web/database/migrations/2021_12_16_011850_create_fbuckets_table.php
index 98339ba..08a0141 100644
--- a/web/database/migrations/2021_12_16_011850_create_fastgroups_table.php
+++ b/web/database/migrations/2021_12_16_011850_create_fbuckets_table.php
@@ -4,8 +4,15 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateFastgroupsTable extends Migration
+class CreateFbucketsTable extends Migration
{
+ /**
+ * The database connection that should be used by the migration.
+ *
+ * @var string
+ */
+ protected $connection = 'mysql-fflag';
+
/**
* Run the migrations.
*
@@ -13,7 +20,7 @@ class CreateFastgroupsTable extends Migration
*/
public function up()
{
- Schema::create('fastgroups', function (Blueprint $table) {
+ Schema::create('fbuckets', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->boolean('protected')->default(false);
@@ -29,6 +36,6 @@ class CreateFastgroupsTable extends Migration
*/
public function down()
{
- Schema::dropIfExists('fastgroups');
+ Schema::dropIfExists('fbuckets');
}
}
diff --git a/web/database/seeders/FFlagSeeder.php b/web/database/seeders/FFlagSeeder.php
index 4b02ad1..7a323e1 100644
--- a/web/database/seeders/FFlagSeeder.php
+++ b/web/database/seeders/FFlagSeeder.php
@@ -5,7 +5,7 @@ namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\FFlag;
-use App\Models\Fastgroup;
+use App\Models\Fbucket;
class FFlagSeeder extends Seeder
{
@@ -16,41 +16,41 @@ class FFlagSeeder extends Seeder
*/
public function run()
{
- $appSettingsCommon = Fastgroup::create([
+ $appSettingsCommon = Fbucket::create([
'name' => 'AppSettingsCommon',
'protected' => true
]);
- $clientAppSettings = Fastgroup::create([
+ $clientAppSettings = Fbucket::create([
'name' => 'ClientAppSettings',
'inheritedGroupIds' => json_encode([ $appSettingsCommon->id ])
]);
- $cloudAppSettings = Fastgroup::create([
+ $cloudAppSettings = Fbucket::create([
'name' => 'CloudCompute',
'protected' => true,
'inheritedGroupIds' => json_encode([ $appSettingsCommon->id ])
]);
- $clientSharedSettings = Fastgroup::create([
+ $clientSharedSettings = Fbucket::create([
'name' => 'ClientSharedSettings'
]);
- $arbiterAppSettings = Fastgroup::create([
+ $arbiterAppSettings = Fbucket::create([
'name' => 'Arbiter'
]);
- $bootstrapperCommon = Fastgroup::create([
+ $bootstrapperCommon = Fbucket::create([
'name' => 'BootstrapperCommon',
'protected' => true
]);
- $windowsBootstrapperSettings = Fastgroup::create([
+ $windowsBootstrapperSettings = Fbucket::create([
'name' => 'WindowsBootstrapperSettings',
'inheritedGroupIds' => json_encode([ $bootstrapperCommon->id ])
]);
- $windowsStudioBootstrapperSettings = Fastgroup::create([
+ $windowsStudioBootstrapperSettings = Fbucket::create([
'name' => 'WindowsStudioBootstrapperSettings',
'inheritedGroupIds' => json_encode([ $bootstrapperCommon->id ])
]);
diff --git a/web/database/seeders/WebConfigurationSeeder.php b/web/database/seeders/WebConfigurationSeeder.php
index d3021d7..e70fa28 100644
--- a/web/database/seeders/WebConfigurationSeeder.php
+++ b/web/database/seeders/WebConfigurationSeeder.php
@@ -23,5 +23,15 @@ class WebConfigurationSeeder extends Seeder
'password' => '@bs0lut3lyM@55!v3P@55w0rd'
])
]); // please please please please please please please change the default password
+
+ WebsiteConfiguration::create([
+ 'name' => 'ComputeServiceAccessKey',
+ 'value' => '92a6ac6b-7167-49b1-9ccd-079820ac892b'
+ ]); // change this as well
+
+ WebsiteConfiguration::create([
+ 'name' => 'WhitelistedIPs',
+ 'value' => '127.0.0.1'
+ ]);
}
}
diff --git a/web/routes/appsettings.php b/web/routes/appsettings.php
new file mode 100644
index 0000000..a33712a
--- /dev/null
+++ b/web/routes/appsettings.php
@@ -0,0 +1,28 @@
+header('Cache-Control', 'private')
+ ->header('Content-Type', 'application/json; charset=utf-8');
+});
\ No newline at end of file
--
2.40.1