cross-posted from: https://lemmy.world/post/48266338
I am learning how to use Symfony Mailer and am a bit lost on the encrypting message section.
This is my simple code below which works in sending the email.
<?php require 'vendor/autoload.php'; const FROM = 'me@example.com'; const TO = 'example@email.com'; const SUBJECT = 'My Subject'; const MESSAGE = 'Hello World'; const DSN = 'smtp://localhost:1025'; $transport = \Symfony\Component\Mailer\Transport::fromDsn(DSN); $mailer = new \Symfony\Component\Mailer\Mailer($transport); $email = (new \Symfony\Component\Mime\Email()) ->from(FROM) ->to(TO) ->subject(SUBJECT) ->text(MESSAGE); $encrypter = new \Symfony\Component\Mime\Crypto\SMimeEncrypter('my-certificate.crt'); $encryptedEmail = $encrypter->encrypt($email); try { $mailer->send($encryptedEmail); } catch (\Symfony\Component\Mailer\Exception\TransportExceptionInterface $error) { echo 'Unable to send email' . PHP_EOL; }And this is how I generated the certificate and key...
openssl genrsa -aes256 -out my-certificate.key 4096 openssl req -new -x509 -days 29220 -key my-certificate.key -out my-certificate.crtI am able to receive the email using SMTP tools like Mailpit.
My two questions are...
- My emails are encrypted using the certificate, but shouldn't it be done using PGP?
- How do I decrypt the email with SMTP testing tool or any online or CLI tool? I tried to decrypt the email and could not decrypt it even though I have all of the keys.
I am learning how to use Symfony Mailer and am a bit lost on the encrypting message section.
This is my simple code below which works in sending the email.
<?php
require 'vendor/autoload.php';
const FROM = 'me@example.com';
const TO = 'example@email.com';
const SUBJECT = 'My Subject';
const MESSAGE = 'Hello World';
const DSN = 'smtp://localhost:1025';
$transport = \Symfony\Component\Mailer\Transport::fromDsn(DSN);
$mailer = new \Symfony\Component\Mailer\Mailer($transport);
$email = (new \Symfony\Component\Mime\Email())
->from(FROM)
->to(TO)
->subject(SUBJECT)
->text(MESSAGE);
$encrypter = new \Symfony\Component\Mime\Crypto\SMimeEncrypter('my-certificate.crt');
$encryptedEmail = $encrypter->encrypt($email);
try {
$mailer->send($encryptedEmail);
} catch (\Symfony\Component\Mailer\Exception\TransportExceptionInterface $error) {
echo 'Unable to send email' . PHP_EOL;
}
And this is how I generated the certificate and key...
openssl genrsa -aes256 -out my-certificate.key 4096
openssl req -new -x509 -days 29220 -key my-certificate.key -out my-certificate.crt
I am able to receive the email using SMTP tools like Mailpit.
My two questions are...
- My emails are encrypted using the certificate, but shouldn't it be done using PGP?
- How do I decrypt the email with SMTP testing tool or any online or CLI tool? I tried to decrypt the email and could not decrypt it even though I have all of the keys.
I found this very promising app that looks like it can be an alternative to Ferdium, Rambox, Franz, Hamsket.
WebSpace is an app that brings websites and web apps together in one organized, streamlined interface. Any web app you can think off can be used in WebSpace in its own web instance instead of your main web browser. Basically it is a web browser but for web apps you use often and may want running in the background.
For use degoogled users who use website, web apps, PWAs over native apps, this makes using these services much easer.
WebSpace also adds many privacy features such as ad blocking and filtering, cookie isolation, and more.
Also it is written in Flutter! Meaning this could become available on desktop in the future! One app, one codebase for all major OSes!
Check it out and contribute!
I found this very promising app that looks like it can be an alternative to Ferdium, Rambox, Franz, Hamsket.
WebSpace is an app that brings websites and web apps together in one organized, streamlined interface. Any web app you can think off can be used in WebSpace in its own web instance instead of your main web browser. Basically it is a web browser but for web apps you use often and may want running in the background.
For use degoogled users who use website, web apps, PWAs over native apps, this makes using these services much easer.
WebSpace also adds many privacy features such as ad blocking and filtering, cookie isolation, and more.
Also it is written in Flutter! Meaning this could become available on desktop in the future! One app, one codebase for all major OSes!
Check it out and contribute!
I found this very promising app that looks like it can be an alternative to Ferdium, Rambox, Franz, Hamsket.
WebSpace is an app that brings websites and web apps together in one organized, streamlined interface. Any web app you can think off can be used in WebSpace in its own web instance instead of your main web browser. Basically it is a web browser but for web apps you use often and may want running in the background.
For use degoogled users who use website, web apps, PWAs over native apps, this makes using these services much easer.
WebSpace also adds many privacy features such as ad blocking and filtering, cookie isolation, and more.
Also it is written in Flutter! Meaning this could become available on desktop in the future! One app, one codebase for all major OSes!
Check it out and contribute!
I found this very promising app that looks like it can be an alternative to Ferdium, Rambox, Franz, Hamsket.
WebSpace is an app that brings websites and web apps together in one organized, streamlined interface. Any web app you can think off can be used in WebSpace in its own web instance instead of your main web browser. Basically it is a web browser but for web apps you use often and may want running in the background.
For use degoogled users who use website, web apps, PWAs over native apps, this makes using these services much easer.
WebSpace also adds many privacy features such as ad blocking and filtering, cookie isolation, and more.
Also it is written in Flutter! Meaning this could become available on desktop in the future! One app, one codebase for all major OSes!
Check it out and contribute!
To be able to run Nushell scripts from your File Manager and have the terminal window of the running script not close when the script is finished executing or if the scripts exits, you can use these instructions to achieve this.
This example is on Linux Mint using Nemo as a file manager and GNOME Terminal as a terminal app.
- Create the following script on your system and store the file where ever you like...
run-in-terminal.nu
def run-in-terminal [code: string] {
# Using GNOME Terminal
gnome-terminal -- nu -c ($code)
}
# The Nushell code that runs in the terminal
def get-terminal-code [script: string] {
return $"
try {
nu ($script)
print ''
print ''
print ''
print 'Script finished executing'
} catch {
print ''
print ''
print ''
print 'Script failed executing'
}
print ''
# Must press enter to close terminal window
input 'Press Enter to exit'
"
}
def main [script:string] {
run-in-terminal (get-terminal-code $script)
}
- Create the Nemo action file and in the file, replace
/path/to/run-in-terminal.nuwith the path to therun-in-terminal.nufile...
~/.local/share/nemo/actions/nushell.nemo_action
[Nemo Action]
Name=Run in Terminal
Comment=Execute script in Terminal
Exec=nu /path/to/run-in-terminal.nu %F
Icon-Name=terminal
Selection=Single
Extensions=nu;
Now simply right click on any Nushell script file (.nu) in Nemo and you will see an option Run In Terminal.
EDIT
I made a Nushell version of this script that is updated... https://lemmy.world/post/48010802
I created a simple Bash script that will always disable the default/internal monitor on your laptop when using AR glasses (or any other external monitor). I find this useful for when using AR glasses such as the XReal One which allows you to change the mode from regular mode to ultra-wide mode and when doing this, it will act as your unplugging the XReal ones and plugging in XReal one again in a new mode, causing the interal laptop display to become enabled.
To keep the laptop display always off, weather the laptop lid is either closed or open, this simple bash script will always disable the laptop screen every X seconds (You can change it by changing the wait variable)
Simply copy this script and create a new bash script such as disable-display.sh, make the script file executable and add it to your startup applications and it will run in the background. You will need to run xrandr command with all of your displays enabled to get the names of the displays and change the variable names in the script accordingly.
NOTE: This script may not work with a full Wayland setup and may only work on X11.
Enjoy
#!/bin/bash
#RUN xrandr TO GET THE NAMES OF THE DISPLAYS AND SET THE VARIABLES TO THESE NAMES
readonly default_display="eDP"
readonly external_display="USB-C-0"
readonly wait=5
while true; do
#Check if there is an external display connected
if xrandr | grep -q "$external_display connected"; then
#Disable the internal display
xrandr --output $default_display --off
fi
sleep $wait
done
EDIT
I made a Nushell version of this script that is updated... https://lemmy.world/post/48010802
I created a simple Bash script that will always disable the default/internal monitor on your laptop when using AR glasses (or any other external monitor). I find this useful for when using AR glasses such as the XReal One which allows you to change the mode from regular mode to ultra-wide mode and when doing this, it will act as your unplugging the XReal ones and plugging in XReal one again in a new mode, causing the interal laptop display to become enabled.
To keep the laptop display always off, weather the laptop lid is either closed or open, this simple bash script will always disable the laptop screen every X seconds (You can change it by changing the wait variable)
Simply copy this script and create a new bash script such as disable-display.sh, make the script file executable and add it to your startup applications and it will run in the background. You will need to run xrandr command with all of your displays enabled to get the names of the displays and change the variable names in the script accordingly.
NOTE: This script may not work with a full Wayland setup and may only work on X11.
Enjoy
#!/bin/bash
#RUN xrandr TO GET THE NAMES OF THE DISPLAYS AND SET THE VARIABLES TO THESE NAMES
readonly default_display="eDP"
readonly external_display="USB-C-0"
readonly wait=5
while true; do
#Check if there is an external display connected
if xrandr | grep -q "$external_display connected"; then
#Disable the internal display
xrandr --output $default_display --off
fi
sleep $wait
done
cross-posted from: https://lemmy.world/post/48010802
I created a simple Nushell script that will always disable the default/internal monitor(s) on your laptop or external display when using AR glasses. I find this useful for when using AR glasses such as the XReal One which allows you to change the mode from regular mode to ultra-wide mode and when doing this, it will act as your unplugging the XReal ones and plugging in XReal one again in a new mode, causing the other display to become enabled.
To keep the laptop display always off, weather the laptop lid is either closed or open, this simple Nushell script will always disable the screen every X seconds (You can change it by changing the
waitconstant)Simply copy this script and create a new Nushell script such as
disable-displays.nu, add it to your startup applications with the command ofnu /path/to/disable-displays.nuand it will run in the background. You will need to runxrandrcommand with all of your displays enabled to get the names of the displays and change the constants values in the script accordingly.NOTE: This script may not work with a full Wayland setup and may only work on X11.
Enjoy
# RUN xrandr TO GET THE NAMES OF THE DISPLAYS AND SET THE VARIABLES TO THESE NAMES const ar_glasses_display = 'USB-C-0' const displays = [ 'eDP', 'HDMI-0' ] const wait = 5 def is-ar-glasses-connected [] { return (xrandr | str contains $"($ar_glasses_display) connected") } def disable-display [display: string] { xrandr --output $display --off } def enable-display [display: string] { xrandr --output $display --auto } loop { if (is-ar-glasses-connected) { for current_display in $displays { disable-display $current_display } } else { for current_display in $displays { enable-display $current_display } } sleep ($wait * 1sec) }
cross-posted from: https://lemmy.world/post/48010802
I created a simple Nushell script that will always disable the default/internal monitor(s) on your laptop or external display when using AR glasses. I find this useful for when using AR glasses such as the XReal One which allows you to change the mode from regular mode to ultra-wide mode and when doing this, it will act as your unplugging the XReal ones and plugging in XReal one again in a new mode, causing the other display to become enabled.
To keep the laptop display always off, weather the laptop lid is either closed or open, this simple Nushell script will always disable the screen every X seconds (You can change it by changing the
waitconstant)Simply copy this script and create a new Nushell script such as
disable-displays.nu, add it to your startup applications with the command ofnu /path/to/disable-displays.nuand it will run in the background. You will need to runxrandrcommand with all of your displays enabled to get the names of the displays and change the constants values in the script accordingly.NOTE: This script may not work with a full Wayland setup and may only work on X11.
Enjoy
# RUN xrandr TO GET THE NAMES OF THE DISPLAYS AND SET THE VARIABLES TO THESE NAMES const ar_glasses_display = 'USB-C-0' const displays = [ 'eDP', 'HDMI-0' ] const wait = 5 def is-ar-glasses-connected [] { return (xrandr | str contains $"($ar_glasses_display) connected") } def disable-display [display: string] { xrandr --output $display --off } def enable-display [display: string] { xrandr --output $display --auto } loop { if (is-ar-glasses-connected) { for current_display in $displays { disable-display $current_display } } else { for current_display in $displays { enable-display $current_display } } sleep ($wait * 1sec) }
cross-posted from: https://lemmy.world/post/48010802
I created a simple Nushell script that will always disable the default/internal monitor(s) on your laptop or external display when using AR glasses. I find this useful for when using AR glasses such as the XReal One which allows you to change the mode from regular mode to ultra-wide mode and when doing this, it will act as your unplugging the XReal ones and plugging in XReal one again in a new mode, causing the other display to become enabled.
To keep the laptop display always off, weather the laptop lid is either closed or open, this simple Nushell script will always disable the screen every X seconds (You can change it by changing the
waitconstant)Simply copy this script and create a new Nushell script such as
disable-displays.nu, add it to your startup applications with the command ofnu /path/to/disable-displays.nuand it will run in the background. You will need to runxrandrcommand with all of your displays enabled to get the names of the displays and change the constants values in the script accordingly.NOTE: This script may not work with a full Wayland setup and may only work on X11.
Enjoy
# RUN xrandr TO GET THE NAMES OF THE DISPLAYS AND SET THE VARIABLES TO THESE NAMES const ar_glasses_display = 'USB-C-0' const displays = [ 'eDP', 'HDMI-0' ] const wait = 5 def is-ar-glasses-connected [] { return (xrandr | str contains $"($ar_glasses_display) connected") } def disable-display [display: string] { xrandr --output $display --off } def enable-display [display: string] { xrandr --output $display --auto } loop { if (is-ar-glasses-connected) { for current_display in $displays { disable-display $current_display } } else { for current_display in $displays { enable-display $current_display } } sleep ($wait * 1sec) }
I created a simple Nushell script that will always disable the default/internal monitor(s) on your laptop or external display when using AR glasses. I find this useful for when using AR glasses such as the XReal One which allows you to change the mode from regular mode to ultra-wide mode and when doing this, it will act as your unplugging the XReal ones and plugging in XReal one again in a new mode, causing the other display to become enabled.
To keep the laptop display always off, weather the laptop lid is either closed or open, this simple Nushell script will always disable the screen every X seconds (You can change it by changing the wait constant)
Simply copy this script and create a new Nushell script such as disable-displays.nu, add it to your startup applications with the command of nu /path/to/disable-displays.nu and it will run in the background. You will need to run xrandr command with all of your displays enabled to get the names of the displays and change the constants values in the script accordingly.
NOTE: This script may not work with a full Wayland setup and may only work on X11.
Enjoy
# RUN xrandr TO GET THE NAMES OF THE DISPLAYS AND SET THE VARIABLES TO THESE NAMES
const ar_glasses_display = 'USB-C-0'
const displays = [
'eDP',
'HDMI-0'
]
const wait = 5
def is-ar-glasses-connected [] {
return (xrandr | str contains $"($ar_glasses_display) connected")
}
def disable-display [display: string] {
xrandr --output $display --off
}
def enable-display [display: string] {
xrandr --output $display --auto
}
loop {
if (is-ar-glasses-connected) {
for current_display in $displays {
disable-display $current_display
}
} else {
for current_display in $displays {
enable-display $current_display
}
}
sleep ($wait * 1sec)
}
Do you just simply uninstall it from the Android settings? On desktop, when you uninstall and app, it most likely leaves files and directories behind even if they are hidden on your system.
When you uninstall and app on Android, is this also the case? Or does it also delete every single file and directory associated with the app?
Some Android apps (very, very few) Will create files in your Documents or Home directory and I understand these will not be removed when you uninstall an app.
Since EDS client for Android is discontinued, there has not been any Veracrypt clients available until I found these two apps...
https://github.com/jmccoy600/androidCrypt
Pros
- Small app size
- On F-Droid
Cons
- Basic features
https://github.com/AlsatianConsulting/CryptoContainer
Pros
- Many features
Cons
- Not on F-Droid
I hope CrypoContainer gets on F-Droid and both apps get the ability to mount to a directory on the "main internal drive" simular to EDS client. Please help these apps out and spread the word.
EDIT
I made a Nushell version of this script that is updated... https://lemmy.world/post/48010802
I created a simple Bash script that will always disable the default/internal monitor on your laptop when using AR glasses (or any other external monitor). I find this useful for when using AR glasses such as the XReal One which allows you to change the mode from regular mode to ultra-wide mode and when doing this, it will act as your unplugging the XReal ones and plugging in XReal one again in a new mode, causing the interal laptop display to become enabled.
To keep the laptop display always off, weather the laptop lid is either closed or open, this simple bash script will always disable the laptop screen every X seconds (You can change it by changing the wait variable)
Simply copy this script and create a new bash script such as disable-display.sh, make the script file executable and add it to your startup applications and it will run in the background. You will need to run xrandr command with all of your displays enabled to get the names of the displays and change the variable names in the script accordingly.
NOTE: This script may not work with a full Wayland setup and may only work on X11.
Enjoy
#!/bin/bash
#RUN xrandr TO GET THE NAMES OF THE DISPLAYS AND SET THE VARIABLES TO THESE NAMES
readonly default_display="eDP"
readonly external_display="USB-C-0"
readonly wait=5
while true; do
#Check if there is an external display connected
if xrandr | grep -q "$external_display connected"; then
#Disable the internal display
xrandr --output $default_display --off
fi
sleep $wait
done
When I submit the form twice, three times, etc. I get duplicated form field data. Here is the console output of the form data after every submissions.
Also all the field values are always an array, even if the input field for that value is a text input field? Not sure if this is another issue or not.
Here is my code. Only one JS file and one HTML file...
import fs from 'fs';
import http from 'http';
import { formidable as formidablePackage } from 'formidable';
const port = 8080;
//Will create horizontal line that will fit the width of the terminal window
const horizontalLine = '='.repeat(process.stdout.columns);
const formidable = formidablePackage({
allowEmptyFiles: true,
minFileSize: 0,
});
http
.createServer(async (request, response) => {
if (request.method === 'POST') {
let [formFieldData, formFileData] = await formidable.parse(request);
console.log(formFieldData);
}
response.setHeader('Content-Type', 'text/html');
fs.createReadStream('form.html').pipe(response);
})
.listen(port);
<form method="post" enctype="multipart/form-data">
<input name="myText" />
<br />
<input type="checkbox" name="myCheckboxGroupA" />
<input type="checkbox" name="myCheckboxGroupA" />
<input type="checkbox" name="myCheckboxGroupA" />
<br />
<input type="file" name="myFileA" />
<br />
<input type="file" name="myFileB" multiple />
<br />
<input type="file" name="myFileC" multiple directory webkitdirectory />
<br />
<input type="submit" />
</form>
These are the console logs
$ node form.js
{ myText: [ 'hello world' ], myCheckboxGroupA: [ 'on' ] }
{
myText: [ 'hello world', 'hello world' ],
myCheckboxGroupA: [ 'on', 'on' ]
}
{
myText: [ 'hello world', 'hello world', 'hello world' ],
myCheckboxGroupA: [ 'on', 'on', 'on' ]
}
{
myText: [ 'hello world', 'hello world', 'hello world', 'hello world' ],
myCheckboxGroupA: [ 'on', 'on', 'on', 'on' ]
}
These are the console logs I expected
$ node form.js
{ myText: 'hello world' , myCheckboxGroupA: [ 'on' ] }
{ myText: 'hello world' , myCheckboxGroupA: [ 'on' ] }
{ myText: 'hello world' , myCheckboxGroupA: [ 'on' ] }
{ myText: 'hello world' , myCheckboxGroupA: [ 'on' ] }
Just needs a cross platform syncing app
nostr seems like a twitter, instagram and youtube platform were the content flows like this...
user -> post -> comments
Where the user have an account and posts content which others can like, dislike and comment on.
However reddit and lemmy flows like this...
community -> post -> comments
Communities are moderated by one or more users. Moderators can remove posts and comments in their communities to keep the communities subject from going off topic.
With all of this being said here are my questions...
- Is it possible to create communities on nostr
- Can you have two communities with the same name? Does each community have a unique ID like nostr accounts have a unique public key?
- Can one or more users moderate a community? Can the moderators delete posts and comments in their community?
- Can a community not allow anyone but moderators to post in the community?