mirror of
https://repo.getmonero.org/AnonDev/xmrmemes.git
synced 2025-05-13 06:52:12 -04:00
Finish rough draft of website
Update the payment code so everything is working now Improve DB structure Improve design Add API Validate XMR Address upon registration And Much More... Still Need to work on: - SEO - Dropdown in menu (bug, not dropping down)
This commit is contained in:
parent
dbfda5cf9e
commit
821fb9b1ed
30 changed files with 186 additions and 261 deletions
|
@ -1,85 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Address;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AddressController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Address $address
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Address $address)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Address $address
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Address $address)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\Address $address
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Address $address)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Address $address
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Address $address)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ class ApiController extends Controller
|
|||
public function documentation()
|
||||
{
|
||||
$data = [
|
||||
'memes_example' => json_encode(Meme::get(), JSON_PRETTY_PRINT),
|
||||
'memes_example' => json_encode(Meme::limit(1)->get(), JSON_PRETTY_PRINT),
|
||||
'memes_endpoint' => url('api/memes'),
|
||||
];
|
||||
return view('api', ['data' => $data]);
|
||||
|
|
14
app/Http/Controllers/ContactController.php
Normal file
14
app/Http/Controllers/ContactController.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ContactController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = [];
|
||||
return view('contact', ['data' => $data]);
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ use App\Models\User;
|
|||
use App\Models\Address;
|
||||
use Illuminate\Http\Request;
|
||||
use chillerlan\QRCode\{QRCode, QROptions};
|
||||
use MoneroIntegrations\MoneroPhp\walletRPC;
|
||||
|
||||
class MemeController extends Controller
|
||||
{
|
||||
|
@ -77,11 +78,8 @@ class MemeController extends Controller
|
|||
'image' => ['required', 'image'],
|
||||
]);
|
||||
$user = \Auth::user();
|
||||
$used_ids = Meme::pluck('address_id')->toArray();
|
||||
$address = Address::whereNotIn('id', $used_ids)->first('id');
|
||||
return Meme::create([
|
||||
Meme::create([
|
||||
'user_id' => $user->id,
|
||||
'address_id' => $address->id,
|
||||
'title' => $request->input('title'),
|
||||
'caption' => $request->input('caption'),
|
||||
'image' => $request->file('image'),
|
||||
|
@ -96,7 +94,7 @@ class MemeController extends Controller
|
|||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$meme = Meme::where('id', $id)->with(['user', 'tips', 'address'])->firstOrFail();
|
||||
$meme = Meme::where('id', $id)->with(['user', 'tips'])->firstOrFail();
|
||||
|
||||
$share = \Share::page(url()->current(), $meme->title, ['class' => 'fa-lg', 'target' => '_blank'])
|
||||
->facebook()
|
||||
|
@ -108,7 +106,7 @@ class MemeController extends Controller
|
|||
|
||||
$data = [
|
||||
'meme' => $meme,
|
||||
'qr' => (new QRCode)->render($meme->address->address),
|
||||
'qr' => (new QRCode)->render($meme->address),
|
||||
'share' => preg_replace("/<a(.*?)>/", "<a$1 target=\"_blank\">", $share),
|
||||
];
|
||||
|
||||
|
@ -141,10 +139,19 @@ class MemeController extends Controller
|
|||
public function approve($id)
|
||||
{
|
||||
if (\Auth::user()->is_admin === 1) {
|
||||
$meme = Meme::withoutGlobalScope('approved')->find($id);
|
||||
$meme->is_approved = 1;
|
||||
$meme->save();
|
||||
return redirect()->away(url()->previous());
|
||||
try {
|
||||
$walletRPC = new walletRPC(config('app.xmr_daemon_ip'), config('app.xmr_network_port')); // Change to match your wallet (monero-wallet-rpc) IP address and port; 18083 is the customary port for mainnet, 28083 for testnet, 38083 for stagenet
|
||||
$open_wallet = $walletRPC->open_wallet(config('app.xmr_wallet_name'), '');
|
||||
$account = $walletRPC->create_account();
|
||||
$meme = Meme::withoutGlobalScope('approved')->find($id);
|
||||
$meme->is_approved = 1;
|
||||
$meme->account_index = $account['account_index'];
|
||||
$meme->address = $account['address'];
|
||||
$meme->save();
|
||||
return redirect()->away(url()->previous());
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue