Okay, I will take all the info an reconsider certain parts of the project. Thank you so much!!
Latest posts made by H25E
-
RE: Best way to have two output (nested) folders
-
RE: Best way to have two output (nested) folders
Thanks for your answers.
I have read about x-sendfile before, maybe I have to reconsider the inner work of the backend.
But either with x-sendfile, readfile(), or rewritemap, there has to be a trigger that tells apache to process the request by the php backend. I think there are three options:
-
Redirect all the requests to a php file that will decide what to do with the request. I think that this is the option that both of you are proposing. The script will check if the user is authorized, but first of all has to check if the requested file is protected or public. So there should be an array of public files in memory, that should be checked in every request to know if the requested file is protected or not. Don’t know if this scalates pretty well.
-
Place all web app (or the private files) outside the public server folder. Place the public files in the public server folder. Tell apache to redirect to the php script when no file can’t be found. The script will search the file in the private folder. This way there is no need to keep a list with the protected files, but for the private ones, two file searches will be needed.
-
Achieve to have the Quasar CLI output in two folders: “./private/…” and “./pubic/…” or “./” All the requests to ./private/… will be redirected first to the php script to check user credentials. I thought that this is the best way because it’s straightforward and fast for apache to know if the file can be served directly or a script needs to be called. But I don’t know if this kind of output can be achieved.
What do you think?
Sorry if this is drifting a little bit offtopic, but it has been useful for me. Thanks for your time,
H25E
-
-
RE: Best way to have two output (nested) folders
There is the rewriteMap directive. With it you can check & modify the URL requested by the client (before being processed) with an external script or executable, and then allow apache to do it’s job as usually. It’s the best way? I don’t know… For me it’s working well for the moment.
You are talking about having only one php file that would redirect you (or not) to the desired content? Something like a php loader?
With PHP API you mean a third-party API or your own writted API? Am I reinventing the wheel?
Regarding to the original question, there is a way that Quasar puts all the content I consider that needs to be protected in a single folder when building the SPA?
Thanks for your time @s-molinari
-
RE: Best way to have two output (nested) folders
No.
Apache directly serves the files that the quasar CLI outputs in the dist folder. No PHP here.
PHP only checks if the user has a valid session. If not, rewrites the requested URL to a safe one (for example ./private/confidential.pdf || ./private/embarassing.jpeg || ./private/non-pulic-bundle.js || … to for example: ./index.html/#/login). Or return an empty response with an error status code, and web app will redirect conviniently. The point is to not serve protected files to unauthorized clients.
There are also private php scripts that returns confidential JSON data that gets fetched with ajax request to populate certain contents. But PHP isn’t directly delivering html.
So that’s why I want to have all the protected files in (ideally) one subfolder inside the dist folder when building.
Does that make sense?
-
RE: Best way to have two output (nested) folders
No please, no need to apologize.
The control of what is accesible or not is done in the server, with php (plain, no framework in the backend) sessions and apache mod rewrite (for this private directory). There is confidential information shown in the app (images, documents, data returned by php scripts) that hasn’t to be accessible for unauthenticated users. If I control this only in the router the confidential files/data would be accesible from outside with web scrapping/robot.
I don’t know what do you mean with API in your answer.
EDIT: I’m doing something wrong? Should I do it different? I’m far to be an expert in web development, so any help is welcome.
-
RE: Best way to have two output (nested) folders
An URL rewritting map script. If client tryes to fetch a file inside the ./App/ directory, the script will check credentials and return to login/error if needed.
-
Best way to have two output (nested) folders
Hello everybody,
The biggest part of my application is private behind a login. So, I should compile my application in a root folder where the public files are going to be (vendor.js, main.css, login.js, index.html, login images…). Then inside this folder there should be another one (for example ./App/…) that is going to be protected by apache in production, with all the app code, images, documents…
What’s the best way to achieve something like this?
Thanks for your time,
H25E
-
Use Quasar components in Vue CLI 4.x
Hello everybody,
I’m doing a rework in the frontend of a web application, and for this I have choosen Vue & Quasar. It’s going to be my first project with both of them so I’m a newbie here.
I have tried both of them with the direct <script src=""> mode. Then I decided to learn how to use the Vue CLI in order to have a better project organization and so on.
Now I wanted to integrate Quasar in the Vue CLI. Only the web components. I like the Quasar framework functionalities, and they are the reason why I have choosen Quasar, but I’m not going to use them now. Not in the first version of the rework.
In order to use Quasar web components in the same way I was using them in the <script src> mode, but in the Vue CLI, I tried to add this in the head of the vueFolder/public/index.html:
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons" rel="stylesheet" type="text/css"> <link href="https://cdn.jsdelivr.net/npm/quasar@1.9.15/dist/quasar.css" rel="stylesheet" type="text/css"> <script> window.quasarConfig = { brand: {...} } </script> <script src="https://cdn.jsdelivr.net/npm/quasar@1.9.15/dist/quasar.umd.js"></script>
But I get:
quasar.umd.js:1893 Uncaught TypeError: Cannot read property ‘extend’ of undefined
at quasar.umd.js:1893
at quasar.umd.js:10
at quasar.umd.js:11Created by the <script src = “quasar.js”> line. I have tried also to include the following in the Vue main.js:
import Quasar from "https://cdn.jsdelivr.net/npm/quasar@1.9.15/dist/quasar.umd.js" Vue.use(Quasar);
But I get:
Failed to compile.
./src/main.js
Module not found: Error: Can’t resolve ‘https://cdn.jsdelivr.net/npm/quasar@1.9.15/dist/quasar.umd.js’ in ‘C:…’So, there is a reliable way to include Quasar UMD into Vue CLI 4.x?
There are also two more options:
- Vue CLI Quasar Plugin: I have read in the documentation that this path can lead into errors because integration of the plugin isn’t the best. Is this a really realiable way?
- Quasar CLI: In the future we would like to create mobile and desktop applications. But now we only want to build a web frond-end. And I have barely learned Vue CLI right now. Do you think it will worth to spend more time to learn Quasar CLI and use it directly when we are going to use only the web components?
Thanks for your help in these learning moments,
H25E
-
RE: Programatically populated nested levels drawer
I’m currently at this point: https://jsfiddle.net/EMCCi/3p2ov6rg/
I have used an event bus, to avoid to propagate the event also recursively. But I don’t know if that’s the correct way.
Also I’m not being able to use v-model in my component. I have been reading examples ( https://paulund.co.uk/use-v-model-on-custom-vue-component ) but I can’t make it work. Could it be due to the event bus arquitechture?
@s-molinari There is a demo example? It’s difficult for me to interpret all the raw code at once.
-
RE: Programatically populated nested levels drawer
Thanks for your answers.
@metalsadman Thanks, that’s what I was looking for. I’m reading it carefully to understand it 100%.
@s-molinari Sorry, I haven’t understand your answer. Do you mean in https://github.com/quasarframework/quasar/tree/dev/docs ?