node red cannot GET /myfile from directory - httprequest

I would like to ask.
I have file in C:\users\nxf68958\.Node-red\report.html
And when I would like to open this file by: localhost:1880/report.html
I get:
Cannot GET /report.html
in Log I have: "Nov 09:52:00 - [info] User directory : \Users\nxf68958\.node-red"
I am using:
NR: 3.0.2
Node: 18.12.0
It worked perfectly on older versions of: NR: 2.2 and Node: 16.13.
Then I actualized and it stopped working.
In settings.js is option: "fileWorkingDirectory" I tried to change it, but without change.
What I am doing wrong?
Thank you

Node-RED will not serve static files by default, you have to explicitly enable it by settings the httpStatic option in the settings.js file.
Settings the httpStatic value to point to the userDir (which is what you have basically done by setting it to __dirname) is a bad idea from a security point of view because this means anybody can download your flows.json and flows_creds.json files and the files like settings.js and .config.runtime.json (which holds the default encryption key for the creds file).
fileWorkDirectory is purely to set the default working directory for the code nodes that interact with the filesystem, it will have no effect on what files are served by the HTTP server.

Related

Expo application doesn't get changes in .env file

I have an Expo managed react native application. I created my .env file in the root of my project, installed react-native-dotenv and set up babel to use it. After a while I managed to get it to work.
I have my environment variable
ENDPOINT=http://127.0.0.1:8000/api
and i use it with
process.env.ENDPOINT
After a while I decided to test the android version of the app, so i changed the endpoint url to my LAN ip and restarted the server. The problem is that even after restarting the server, the cache and the computer, when I call process.env.ENDPOINT it keeps the first url I set.
Here's a list of the things i tried:
restarting the server
restarting the server and the cache
restarting the whole computer
change the variable name to REACT_APP_ENDPOINT as many suggested (I get undefined, it's still stuck to ENDPOINT)
empty expo cache
The strange thing is that I already changed that same variable twice (from 127.0.0.1:8000 to 127.0.0.1:8080 and back for a problem with backend) and had the same problem, but it went away by itself after a couple of minutes (and server restarts).
This time I've been trying to get it to work for 7 hours and nothing has changed.
Any idea?
I had the same issue and managed to run the app with .env changes after using the following command.
expo r -c
reference: https://github.com/goatandsheep/react-native-dotenv/issues/75#issuecomment-728055969
After a couple hundred more tests I gave up and implemented a "custom" solution, without any external library:
Switched .env files to TypeScript files (E.g. .env.development -> env.development.ts)
Set up an object named env that has all environmental variables as properties
export const env = {
VAR1: 'foo',
...
}
Imported this constant inside the application entry point (in my case App.tsx)
Inside the main constructor assign env to global.env
Use global.env instead of process.env
Not sure if this is the best practice, but solved my problem for now, works like a charm and doesn't require me to reload my application at every change. I'm a bit concerned by the security aspect of having the environment in a global variable inside a js project, so any suggestion is still welcome

Custom ejabberd authentication no longer working

I have created an authentication module which was build against
ejabberd 16.02 and runs fine when auth_method is set. It also works against
16.03.
However, from 16.04 onwards it gives me the error "[error] ignoring
option 'auth_method' with invalid value: [jwt]"
I checked the code diff between those releases and the only change
seems to be to the mod_pubsub.erl file, specifically adding the
following:
ServerHost = serverhost(Host),
+ ejabberd_hooks:run(pubsub_subscribe_node, ServerHost,
+ [ServerHost, Host, Node, Subscriber, SubId]),
https://github.com/processone/ejabberd/commit/639c2fb6401391663206c0e4c946d1a699689ac7
I have tried disabling this module and even deleting the beam file as
i don't use it, but i can't seem ti get round it.
Does anyone have any insight as to why these changes will have broken
my authentication module?
My source is at the link below, but as i say has worked fine for a year:
https://github.com/ParamountVentures/ejabberd-auth-jwt
The answer is that from 16.04 onwards you need to drop the .erl file into the ejabberd src folder and compile it with the source. Dropping in the .beam file to use alternative authentication modules no longer works.

Which IntelliJ config files should I save in my dotfiles?

I would like to keep my IntelliJ config files in my dotfiles repo but my ~/.IntelliJIdea2016.1 folder weights > 1.3G :(
~/.IntelliJIdea2016.1/config/ still weights > 215M...
~/.IntelliJIdea2016.1/config/plugins/ contains lots of binaries... not the best candidates for dotfiles :(
Anyone tried to save IntelliJ config without Export/Import settings menu option?
No need to store IntelliJ config file, just use
IDE Settings Sync plugin.
See this post: Better Synchronization of your Settings Across Devices
Sadly, it's not simple. The user configuration folders are not well-documented and have historically included a bunch of default junk, which is slowly being stripped out (see https://youtrack.jetbrains.com/issue/IDEA-128660 and https://youtrack.jetbrains.com/issue/IDEA-163616). The documentation of settings files is also very poor; my request for improvement was declined https://youtrack.jetbrains.com/issue/IDEA-154157).
I version control my settings. If you request access, you can see it at https://gitlab.com/jcrben-staples/dotfiles-group/dotfiles/tree/master/config/intellij-idea-latest with notes at https://gitlab.com/jcrben-staples/dotfiles-group/dotfiles/tree/master/config/intellij-idea-latest/MY_CONFIG_DOCS.md).
I set up my .gitignore to ignore everything by default, and then I whitelist the files that I want. With IntelliJ, I didn't know where to start, so I whitelisted the entire folder and then blacklisted a bunch of the files.
My blacklist doesn't exactly answer your question about what files to include, but it does give you an idea of what to exclude. I'll try to update this if I figure out which ones to include at some point, but it's a mishmash of plugin files and such.
Right now the blacklist looks something like this:
# IntelliJ IDEA stuff
.idea
!config/intellij-idea-latest/**
!projects/bi-idea/workspace.xml
# statistics files
config/intellij-idea-latest/options/statistics*
config/intellij-idea-latest/options/feature.usage.statistics.xml
config/intellij-idea-latest/options/usage.statistics.xml
config/intellij-idea-latest/options/statistics.application.usages.xml
# user files ??
config/intellij-idea-latest/user*
# other
config/intellij-idea-latest/options/atlassian-ide-plugin.app.xml
config/intellij-idea-latest/options/cachedDictionary.xml
config/intellij-idea-latest/options/customization.xml
# has my autobracket disable
config/intellij-idea-latest/options/CodeGlance.xml
# config/intellij-idea/options/editor.codeinsight.xml
config/intellij-idea-latest/options/databaseDrivers.xml
config/intellij-idea-latest/options/debugger.xml
config/intellij-idea-latest/options/dimensions.xml
config/intellij-idea-latest/options/extensionsRootType.xml
config/intellij-idea-latest/options/filetypes.xml
config/intellij-idea-latest/options/find.xml
config/intellij-idea-latest/options/find.recents.xml
config/intellij-idea-latest/options/jdk.table.xml
config/intellij-idea-latest/options/gemmanager.xml
config/intellij-idea-latest/options/github_settings.xml
config/intellij-idea-latest/options/gradle.run.settings.xml
config/intellij-idea-latest/options/extensionsRootType.xml
config/intellij-idea-latest/options/hg.xml
config/intellij-idea-latest/options/ignore.xml
config/intellij-idea-latest/options/markdown.xml
config/intellij-idea-latest/options/multimarkdown.local.xml
config/intellij-idea-latest/options/multimarkdown.shared.xml
config/intellij-idea-latest/options/options.xml
config/intellij-idea-latest/options/other.xml
config/intellij-idea-latest/options/packages.xml
config/intellij-idea-latest/options/pomodoro.state.xml
config/intellij-idea-latest/options/project.default.xml
config/intellij-idea-latest/options/proxy.settings.pwd
config/intellij-idea-latest/options/recentProjects.xml
config/intellij-idea-latest/options/recentProjectDirectories.xml
config/intellij-idea-latest/options/remote-servers.xml
config/intellij-idea-latest/options/runner.layout.xml
config/intellij-idea-latest/options/scratches.xml
config/intellij-idea-latest/options/stubIndex.xml
config/intellij-idea-latest/options/updates.xml
config/intellij-idea-latest/options/usageView.xml
config/intellij-idea-latest/options/vcs.xml
config/intellij-idea-latest/options/window.manager.xml
config/intellij-idea-latest/options/window.state.xml
# turn off those auto-update messages...
config/intellij-idea-latest/port
config/intellij-idea-latest/plugins/*
config/intellij-idea-latest/tasks/*
config/intellij-idea-latest/extensions/
config/intellij-idea-latest/jdbc-drivers/*
# region START UNIGNORE IntelliJ
!config/intellij-idea-latest/scratches/
!config/intellij-idea-latest/consoles/
config/intellij-idea-latest/consoles/.history/*
# General settings
# config/intellij-idea-latest/sonarlint/
config/intellij-idea-latest/javascript/nodejs/**
# config/intellij-idea-latest/options/editor.codeinsight.xml # has my autobracket disable
# endregion END UNIGNORE Intellij
This leaves fair number of files which are not blacklisted - plus I symlink my .idea files sometimes and version control those settings, although workspace.xml has a lot of stuff and it changes all the time (see https://youtrack.jetbrains.com/issue/IDEA-163348).
Also, keep your eye out for "Share" buttons like the one shown for a scope below, as these seem to control whether the setting is shared to a configuration.
The most elegant set up for settings configuration comes from VSCode - hopefully at some point Jetbrains will figure this out and copy them:
You can either 'Share settings through a settings repository' or you can 'Share your settings with the Settings Sync plugin'.
More details can be found at https://www.jetbrains.com/help/idea/sharing-your-ide-settings.html. If the link ever expires please let me know in the comments below.

Safari Push Notifications - Verifying hashes in manifest.json failed even though correct

I have created a push package with the appropriate files as per the Apple spec for APNS. This manifest file represents all of the files that are present:
{
"icon.iconset/icon_128x128.png": "78609fcff69688f969a38f957ac2f10fc79d6732",
"icon.iconset/icon_128x128#2x.png": "78609fcff69688f969a38f957ac2f10fc79d6732",
"icon.iconset/icon_16x16.png": "d348589e2cf37d8f23940f8545afe75a2e98b4ac",
"icon.iconset/icon_16x16#2x.png": "d348589e2cf37d8f23940f8545afe75a2e98b4ac",
"icon.iconset/icon_32x32.png": "e4418a1c5f2ecfbb702961515aaa65d5449b1c53",
"icon.iconset/icon_32x32#2x.png": "e4418a1c5f2ecfbb702961515aaa65d5449b1c53",
"website.json": "45be9c4a6f1bf96e27a9eecab219304b35c5ac24"
}
I have manually checked the sha1 values on the CLI and they are all correct, along with the file locations. And yet I still get this error back from Safari each time I try to get permission:
{ '{"logs":': { '"Verifying hashes in manifest.json failed"]': '' } }
Which is not valid JSON either. Any ideas why this would be failing?
I recently implemented push notifications through pushwoosh. They automatically created the package for me and I checked how they done it. The only difference between mine manifest file and your is a back slash before the normal slash. Maybe it could do the difference for you. Copy and paste this code in your manifest (I have already added your SHA1 values):
{"icon.iconset\/icon_16x16.png":"d348589e2cf37d8f23940f8545afe75a2e98b4ac","icon.iconset\/icon_16x16#2x.png":"d348589e2cf37d8f23940f8545afe75a2e98b4ac","icon.iconset\/icon_32x32.png":"e4418a1c5f2ecfbb702961515aaa65d5449b1c53","icon.iconset\/icon_32x32#2x.png":"e4418a1c5f2ecfbb702961515aaa65d5449b1c53","icon.iconset\/icon_128x128.png":"78609fcff69688f969a38f957ac2f10fc79d6732","icon.iconset\/icon_128x128#2x.png":"78609fcff69688f969a38f957ac2f10fc79d6732","website.json":"45be9c4a6f1bf96e27a9eecab219304b35c5ac24"}
I created a small ruby script for generating these manifests based on the code in https://github.com/SymmetricInfinity/push_package/blob/master/lib/push_package.rb.
Copy the script into a directory containing an icon.iconset directory and your website.json. Then you can run ruby gen_manifest.rb inside that directory and the script will write the manifest.json. At the very least it may be a sanity check to see that everything is correct. The script is here: https://gist.github.com/adamvduke/7934457
If you don't have any ruby experience, comment back and I can walk you through it.

XUL standalone application not starting

I recently took on a project built on XUL (standalone, using xulrunner) - However I can't get it to properly run.
I'm getting this error when I attempt to start it using the command line (xulrunner.exe ../application.ini -jsconsole):
No chrome package registered for chrome://case_scenario_builder/content/case_scenario_builder.xul
The chrome.manifest file looks like this:
content case_scenario_builder file:chrome/case_scenario_builder/content/ contentaccessible=yes
content jslib jar:chrome/jslib.jar!/
skin case_scenario_builder skin file:chrome/case_scenario_builder/skin/
locale case_scenario_builder en-US chrome/case_scenario_builder/locale/en-US/
Any ideas on where I could start debugging?
I figured it out!
In case anyone else runs into this as well:
It was due to the caching system in place by default and the use of .jar containers instead of folders.
The XUL environment had cached both JS and XUL files - and even after disabling those, I had to extract everything that was in the .jar file to the content folder and update the chrome.manifest file.
Thanks for your suggestions on debugging! - they helped the process.
I guess your manifest just isn't getting loaded. To test that I'd introduce an intentional syntax error and check the error console. E.g. if you put
asdfasd
on its own line, you should get a Warning: Ignoring unrecognized chrome manifest directive 'asdfasd'. in the Error console.
(Note to other experts: initially I wanted to suggest dropping 'file:' prefix and avoiding underscores in the package name, but I tested it on a Firefox nightly, and it works fine.)
Your chrome package clearly didn't get registered. From what I can tell, the reason is the bogus file: prefix, you should drop it when specifying relative paths:
content case_scenario_builder chrome/case_scenario_builder/content/ contentaccessible=yes
Btw, I suspect that you copied contentaccessible=yes from somewhere - you should drop it as well unless you know what it does.