-
Posts
1,360 -
Joined
-
Last visited
-
Days Won
49
Everything posted by flydev
-
But actuals logs, stack and software version plus taking note of all files timestamp before doing any modif should be the minimum to help here.
-
Its just a matter of organizing my directory tree structure. when I was using MAMP, WAMP and even now in Caddytron, I was used to put in every root site folder a wwwroot folder that was the root folder of the virtualhost, so I can keep related meta files, log files, backups, or whatever, on the same directory, without having it accessible from internet. It's basically the same setup as your. To illustrate: - htdocs - wwwroot - index.php - wire … or - /var/www/html - website1 - readme.md - wwwroot - website1 - readme.md - wwwroot About the node_modules folder, just keep in mind that is a dev folder not uploaded on production. So it doesn’t matter where you put the folder as no scripts are linked or interfering with your pw files. If you are working for example on a react app, svelte or vue or even a simple js/ta app, your app will be « talking » with your pw setup from Ajax call or static routes. You only want the final built scripts to be shipped on your production (i mean your pw setup). They will be included the same way like any other script files you are used to do.
-
Hi @protro I didn't read the thread linked, but I will try to give a small insight of how I am used to dev with ProcessWire, and a note of ES6+ modules, with the answer of the import statements error, I will give you a starter module too at the end of this thread. And sorry, I have to be quick, so I am posting screenshot instead of a good formatted post, see the setup image at the end. First, there is nothing wrong about using a package manager like node/npm, but you should do it in order to make you the life easier. It's more true when working with all the crypto mess. A word on your previous message, almost all lib/packages are developed using JS (TypeScript) so it will work with quite every frameworks/libs (React, Svelte, Vue, whatever). Some implementation are specialized for React, not surprising, React is in JS world what Wordpress is in the PHP world (check the stats in the linked thread below, fellow members here seem to not used it, hooray, react syntax is weird and slow). My setup of almost every app (stay tuned as the whole things are coming published for free): About the ES6+ module, when working with them, you need to use JS and for production building the app, OR you can call them in your `<script></script>` by setting up the script as module by writing `<script type="module"></script>`. Keep in mind that writing calls like that in templates, make global objects, like window, not available until the document is ready making things like binding events to DOM a bit tiresome.. And a draft of a module. It should not work as is, but it's just to give you an "image" more than words and could be written in templates. Writing JS like that (module or template) is not the better way to do it, and should be avoided, it makes things complicated when they're actually quite simple, even more when speaking about Metamask. Check the method `writeWeb3ModalScript()`, you can see that libs can be used from a CDN when published (unpkg make automatically available dist files of any packages): <?php namespace ProcessWire; class Web3 extends WireData implements Module, ConfigurableModule { const WEB3MODAL_PROJECT_ID = ''; // read from db or .env file const ALCHEMY_API_KEY = ''; // read from db or .env file public static function getModuleInfo() { return [ 'title' => 'Web3', 'version' => '0.0.1', 'summary' => 'Web3 for ProcessWire', 'autoload' => false, 'icon' => '', 'requires' => [], 'installs' => [], ]; } public function writeWeb3ModalScript($buttonDomID) { $scriptTag = <<<EOT <link rel="stylesheet" href="https://unpkg.com/@rainbow-me/rainbowkit@1.0.7/dist/index.css" /> <script type="module"> import Onboard from 'https://unpkg.com/@web3-onboard/core' import injected from 'https://unpkg.com/@web3-onboard/injected-wallets' window.onload = async function() { const MAINNET_RPC_URL = 'https://mainnet.infura.io/v3/[APIKEY-HERE]' const onboard = Onboard({ wallets: [injected], chains: [ { id: '0x1', token: 'ETH', label: 'Ethereum Mainnet', rpcUrl: MAINNET_RPC_URL } ] }) const wallets = await onboard.connectWallet() console.log(wallets) const connectButton = document.getElementById("$buttonDomID"); // 3. Sign In window.onSignIn = function() { console.log(connectButton); console.log(window, window.onSignIn); } } </script> EOT; return $scriptTag; } // wallet can be an ENS formatted address public function getTokensForWallet($wallet) { $url = "https://eth-mainnet.g.alchemy.com/nft/v3/" . self::ALCHEMY_API_KEY; $url .= "/getNFTsForOwner?owner=" . $wallet; // send get request to alchemy api $http = new WireHttp(); $response = $http->getJSON($url); return $response; } // two fields in the backend /** * Config inputfields * * @param InputfieldWrapper $inputfields */ public function getModuleConfigInputfields($inputfields) { $modules = $this->wire()->modules; /** @var InputfieldFieldset $fs */ $fs = $modules->get('InputfieldFieldset'); $fs->label = $this->_('API Configuration'); $inputfields->add($fs); /** @var InputfieldCheckbox $f */ $f = $modules->InputfieldText; $f_name = 'web3modal_project_id'; $f->name = $f_name; $f->label = $this->_('Web3Modal Project ID'); $f->description = $this->_('Get Key there: https://cloud.walletconnect.com'); $f->columnWidth = 50; $f->value = $this->web3modal_project_id; $fs->add($f); /** @var InputfieldText $f */ $f = $modules->InputfieldText; $f_name = 'alchemy_api_key'; $f->name = $f_name; $f->label = $this->_('Alchemy API Key'); $f->description = $this->_('Get Key there: https://dashboard.alchemy.com'); $f->columnWidth = 50; $f->value = $this->alchemy_api_key; $fs->add($f); } } (The NPM package is still not available publicly, but not fully required) I will come back later with a working example using a CDN and a small example of a built js app working with PW. In the meantime, I'll leave you to ponder.
-
Did you read the doc if there is something you might missed ? https://processwire.com/docs/front-end/front-end-editing/
-
Hi, This message is to be taken as informational and being transparency, NOT as a security alert. In short: The module code do not contain vulnerabilities, you are safe to use it. In depth: Years ago, I could spot some offsec users cloning/forking the project on Github. Theses last days, the project got more activities that can be seen on this graph and it look like the module is now included in some open-source offensive security tools. I took a few hours to find and go back to these tools and took the liberty of testing them myself on three online sites, based on Processwire with the module installed. I obtained no negative results, no red flags to deplore. What's more, the code is now monitored to automatically find and correct vulnerabilities in open source code and dependencies with security tools and DeepCode AI. If you ever find something or even if you are not sure about it, feel free to contact me by following the Security Policy. Have a nice day.
- 30 replies
-
- 6
-
- antispiders
- anticrawler
-
(and 2 more)
Tagged with:
-
Hi @theoretic Without details about how "big" the database is, I do not see any risks to upgrade to InnoDB. You should read the introduction made by @teppo and the post written by @ryan https://weekly.pw/issue/223/ https://processwire.com/blog/posts/using-innodb-with-processwire/ A nice and short explanation by @clsource : https://github.com/joyofpw/how-to-install-processwire#which-engine-is-better-myisam-or-innodb And of course, ingesting the official mysql dev doc (choose the right version according to your setup): https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html You might need to adjust some buffer settings, to get a first insight of it, you could run mysql-tuner, it take seconds to install and run, in order to get an easy to read report (steps below). ### Install wget (mandatory) ``` apt-get update apt-get install -y wget ``` ### Download mysqltuner ``` wget http://mysqltuner.pl/ -O mysqltuner.pl wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O basic_passwords.txt wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O vulnerabilities.csv ``` ### Run MySQLTuner ``` chmod u+x mysqltuner.pl ./mysqltuner.pl --user $MYSQL_USER --pass $MYSQL_PASSWORD ```
- 1 reply
-
- 4
-
I also use AppApi frequently, you can pull it from AppApi if the code is server side, or, with js dotenv(): // .env file SECRET_API_TOKEN=abcd00001234 // your module/template code <script> const MyApiCall = async (url) => { let connect = await fetch(url, { method: 'GET', credentials: 'same-origin', mode: 'same-origin', headers: { 'x-api-key': process.env.SECRET_API_TOKEN, } }) let result = await connect.json() return result } </script> But it seem you are writing js code from php templates instead of using js components and/or a built app, then: <?php // load .env $dotenv = Dotenv\Dotenv::createImmutable(__DIR__ /* where is .env file */); $dotenv->load(); // ?> <script> const MyApiCall = async (url) => { let connect = await fetch(url, { method: 'GET', credentials: 'same-origin', mode: 'same-origin', headers: { 'x-api-key': <?php $_ENV['SECRET_API_TOKEN'] ?>, } }) let result = await connect.json() return result } </script> dotenv. You just do not want to leak it, whatever the method used. Maybe just try to find an article that correspond you better to understand the process.
-
What Steve said. And if you need it from your js components, there is dotenv. Take care to not leak the token, if you build the app with Vite, only variable with VITE prefix are exposed as import.meta.env.* eg. VITE_BAAAAAAD=abcd1234 (leaked) DEADBEEF=abcd1234 (not leaked / undefined)
-
Its copied on the bottom because its an example of a feature not finished on another (not really) WIP module. it does what you are talking about. Copy image from another field, or from a screenshot, it doesnt matter, I understood you was talking about « clipboard ». The specific reason is as you are limited on mimetypes when working with the clipboard write api, in the example above it render the blob in a canvas, on différent format, including webp. Voila ?
-
Something like that ? I remember i had started to implement the feature in the not finished module editorjs. I can put my hand on it if you want, it shouldn't be missing lot of work as the upload between the two inputfields is still working.. Click "copy" button on the first pasge, CTRL/COMMAND+V on the second. Enregistrement #62.mp4 Edit: I must admit that this feature could be handy in the core image things.
-
[solved] multiple URL hooks with named arguments not working
flydev replied to dotnetic's topic in General Support
It's friday ? -
Glad to hear it, thanks for the kind of words., do not hesitate to try Duplicator integration in wire-cli. To get back to the topic, understood, then you should be able to get started quickly, With both web3 you will get users/guest wallet connected. To interact with Ethereum and smart-contracts, the easier way is to use one of the cleanest API made by Alchemy through their alchemy-sdk. You will be able with something like ten lines of code to get the tokens (fungible or not) from the contract(s) of your choices and then send ajax request to your scripts/templates to set something in the user session and let user view the hiddens pages and/or medias. Do you use a "vanilla" JS/PHP frontend or are you on React, Svelte or something?
-
Hi, I "don't get what you have in mind" when you say "managed by" but things are pretty easy. Just associate public wallet address(es) of an user in the system user template by adding a new field to it. You will need a custom module and/or some hooks to interact with ProcessWire's session, brainstorming needed there before going further. The workflow then could be: the user land on the site he process to log in by connecting his wallet address if this address is known then proceed to log in after the user sign the transaction if there are no account associated with this address, create the account with user approbation (signing transaction) The account creation will be only made after the user selected hs wallet, and signed the transaction you sent to it. Then I highly suggest you to use a battle tested solution to interact with wallets as there are multiple way of interacting with them, knowing that all wallet do not use the same method. For example you will find different process between CoinbaseWallet, TrustWallet using WalletConnect and Metamask/Phantom, not to mention the various blockchains implementation, eg. Ripple. So, about the lib to use, just use Web3Modal made by WalletConnect or Web3-Onboard made by Blocknative. Another solution which is good to know it exist, I used it in january when I built a desktop app wallet (this one is not the cheapest you will find and it's more focused for established companies), is WaaS (wallet as a service) by cryptoapis.io and using HD wallets (xPub, yPub, zPub), TSS and distributed key. More complex things. Feel free to ask more infos, as I had planned to write a module for all this mess and it might be a good starting point while interacting with some users starting with Web3 and ProcessWire ? --- Edit: About the connector/solution you posted above, it look legit, but I think we never heard about them here in the forum, it seem to be an indian company. You might want to contact them directly from the official website, note that the ProcessWire connector IS NOT listed there. The SHA fingerprints of the GoDaddy certificate on both urls are the same.
-
You want to use RecordRTC.js, you will find a lot of demos and code there: https://www.webrtc-experiment.com/RecordRTC/
- 9 replies
-
- 4
-
- exam
- video recording
-
(and 1 more)
Tagged with:
-
@dotnetic @MarkE was refering about multi-instance issue, where there are some hints with Ryan intervention, it might help:
-
Hello, welcome. A template file is required only if you want to navigate to or view a page associated with this template on the frontend side. So in your case, you need to create a file partner_3.php (empty or not) in site/templates. What you mean by « no access to theme files » ?
-
It look like a namespace issue. To debug it, what I would do in first instance, is to make backup of databases of the fresh installs which is working, and then the others. After that, I would compare dbs with a good tools like BeyondCompare. In second instance, I would write a script to extract all namespace declaration and use directives to see if there is something to spot.
-
This is a bit hackish and add only obscurity. There is a better way that not everyone are aware of to achieve what OP ask if it's ok to let users log in into the backend, I didn't followed all the topic previously. Keep in mind that you can override parts of the AdminTheme. To give you an example, let's assuming you are on a default setup with AdminThemeUikit, then follow theses steps: create a new directory AdminThemeUikit in site/templates create a file called _restricted-masthead.php and paste the code you will find at the end of this post copy the file _main.php from /wire/modules/AdminTheme/AdminThemeUikit/_main.php into /site/templates/AdminThemeUikit adjust the behavior of the admin theme as you want in _main.php (example below, just replace the full code) Code of _main.php ? Code of _restricted-masthead.php ? Result Enregistrement #61.mp4 - https://streamable.com/jg2l0p More informations there: https://github.com/processwire/processwire/blob/dev/wire/modules/AdminTheme/AdminThemeUikit/README.md Enjoy ✌️
-
Hello! Looking to choose a CMS to replace an old Drupal install.
flydev replied to Roadwolf's topic in Getting Started
Could you give us a bit more of details of how your structure / pages tree look like ? Also, which "output strategy" did you choose ? Basically, the main page - which by default is called `home` with a template also called `home` - doesn't require something special. You have full control of what and how things are displayed. If for example, your tree look like the following: Page Title [template name] -------------------------- |- Home [home] |--- Blog Parent [blog] |------ Post1 [blogpost] |------ Post2 [blogpost] To show blog posts in the frontend page Home [home] (home.php) you want to write something like: <?php namespace ProcessWire; $blogposts = $pages->find("template=blogpost, limit=10"); // this is a selector, $blogposts will contain the two page objetcs Post1 and Post2 // loop through all blogposts contained in variable $blogposts foreach($blogposts as $post) { echo "<h2>$post->title</h2"; // echo title field $excerpt = substr($post->body, 0, 150); // simple excerpt to illustrate, 150 chars from body field echo "<p>$excerpt</p>"; } Hope you get the idea. -
Hello! Looking to choose a CMS to replace an old Drupal install.
flydev replied to Roadwolf's topic in Getting Started
Another link from the official doc for more informations about multisite: https://processwire.com/docs/more/multi-site-support/ -
You can find here the release of wire-cli, successor to wire shell, a powerful command-line interface (CLI) tool designed specifically for ProcessWire developers. Optimize your workflow, automate repetitive tasks, and manage your ProcessWire projects with ease. Wire-cli leverages the Symfony Console Component to provide a robust CLI experience, offering a wide range of features and commands to enhance your development process. From creating new projects and managing fields, templates, roles, and users, to performing database backups and serving your ProcessWire projects with a built-in web-server. Still in development, there might be some glitch, I will continuously improve and expand its functionality based on the feedback and needs of the ProcessWire community. Also mentioning that we will be probably working towards merging the features of wire-cli and rockshell to provide a unified CLI solution for ProcessWire. To get started with wire-cli, check out the GitHub repository or simply install it now from your terminal using Composer: composer global require wirecli/wire-cli Contributions are welcome. If you encounter any issues or have suggestions for improvements, please submit an issue, a pull request or post it here.
-
Hello, What @cwsoft said. Adding, for example, if you need using it in your own namespace, you can connect ProcessWire like this: <?php namespace Foo\App; use Foo\BarClass; use ProcessWire\Page; class PwConnector { public function init() { $this->bootstrapProcessWire(); } protected function bootstrapProcessWire() { $pw_dir = '/var/lib/www/pw'; // example, processwire is installed here if (!function_exists('\ProcessWire\wire')) include($pw_dir . '/index.php'); echo \ProcessWire\wire('pages')->get('/')->title; // echo home title } // ... } He will still benefit an easy API to use to access them by using the $database object, if stored externally.
-
Hello! Looking to choose a CMS to replace an old Drupal install.
flydev replied to Roadwolf's topic in Getting Started
Hello @Roadwolf welcome here ! I will let other members giving you a better written introduction and greeting and I will most try to give some answers and thread links to confirm you ended on the right place. Your 18 years old website/blog deserve a good software to run on. Recently, a member posted about his website thats was not working (spoiler: we are talking about the backend side) where it turns out to be more of a "problem" with the hosting provider configuration. Just speaking about it, first because ProcessWire get updated every friday (this can be tracked on github and in the announcement section here in the forum), it let you being confident on how robust and secure the software is, secondly, we almost never seen an upgrade being problematic, even going from major version 2 to 3, assuming you have a small technical habits to follow basics steps. About multisite, I think yes, but I have never personally tried, so others will answer to it. Then you will love it ? Even GPT tends to throw a lot of confettis on this community, if you ask her, you will love it ?x 2 ? Interesting. The answer is no, at least there is no built-in solution, and from what I know, there is no module available for that. But it can be achieved really easily, thanks to ProcessWire freedom. The day you start to put your hands on it, do not hesitate to ping me, I have personally some experiences with NFTs, smart-contract and all this mess so I could give some help in this regard. Yo will find a lot of resources here on the forum, well explained, and do not be afraid if you see some tens years old junks of code, they will almost all still work ? , give a read to the nice blog posts, register to weekly.pw to receive the best of it each weekend for nice read while taking coffee. Enjoy your PW journey ? -
I was going to suggest it. Unfortunately, I don't own it I think as I have the very first version. I will take a look. But you could ask Ryan directly. Playing with InputfieldImage and InputfieldFile from frontend is not trivial, as is. If you do not get an answer, I will come back to this thread once I get my hand on the module source-code. Edit: Just in case, you can also implement a custom form for files (https://gist.github.com/jacmaes/6691946) and play with a bit of JS to render things dynamic. And to generate random links, you can take a look at this (I am still using it, even if the module is born almost ten years ago: https://github.com/plauclair/FieldGenerator)