mirror of
https://repo.getmonero.org/AnonDev/xmrmemes.git
synced 2025-05-03 23:15:04 -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
|
@ -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