typora + PicGo + lsky build automatic upload of pictures
Introduction:
What is the most reassuring thing in the world? Everyone may have their own answer.
But as a developer
, in an era of massive data leaks, I feel that the most important thing is to have the data in my own hands, which gives me the most peace of mind!
I recently wrote markdown
and when uploading images to blog
, the local images could not be quickly pasted to major platforms such as blogs.
Probably the pictures on each blog are protected and cannot be copied and pasted.
Just think about building a picture bed
yourself.
This tutorial is divided into two parts. If you don’t want to deploy and build the image bed yourself, you can go directly to the third step.
-
1. Deploy the pagoda on the server or NAS
-
2. Build the drawing bed (you don’t need to build it, I have already built it yourself)
-
3. Typora + PicGo configuration
1. Build the operating environment
The image bed environment built this time is NAS + docker + Pagoda + Lsky
Because I need relatively stable conditions, my Hei Qunhui environment is not very stable.
My soft router ikuai openwrt is stable for 122 days, while Black Synology only runs stably for 99 days.
In order to ensure that the image bed can be accessed within 7*24
hours, the image bed is placed on NAS
this time.
1.1 NAS-docker installation and deployment pagoda
Before continuing to read, it is recommended to first understand how to deploy Pagoda
(https://www.bt.cn/new/index.html) in NAS.
I use the image made by kangkang223 in Jispace (which solves the permission problem).
https://hub.docker.com/r/kangkang223/baota
Official website Pagoda official website (Why use Pagoda, because it is too convenient to install various environments)
https://hub.docker.com/r/btpanel/baota
Okay, let’s get started:
-
Pull image
docker pull baotaoserver/bt-nginx:latest
-
Create a container based on an image – basic settings
3. Folder path
The left side is the folder that needs to be created by Jispace NAS, and the right side is the directory after the container is run.
After mapping, you can find the file in the extreme space directory later, which is convenient for modification without having to use sh to modify it every time.
The directory that needs to be set:
-
Backup path:
/www/backup
-
Website data directory inside the container:
/www/wwwroot
-
MySQL data directory:
/www/server/data
-
vhost file path:
/www/server/panel/vhost
4. Network configuration, select host
here, use the same IP as the host (extreme space), go to the router later to release the 8888
port, and you can access it through the external network.
5. Click Apply
and wait for the container to start.
Note: After the deployment is completed, please log in to the Pagoda panel immediately -> modify the user name and password in the panel settings and modify the security entrance
1.2 Pagoda login and password modification
Generally, you need to go through a dedicated entrance when logging in after the installation is complete:
I added a btpanel here, so pass 192.168.1.60:8888/btpanel
In fact, it doesn’t matter if you don’t know. Anyway, enter bt into the server and you can modify the entrance and password login information.
If you don’t know the default password, just enter sh directly to change the password.
# Enter the command to start the menu ~bt # According to the menu selection 5 to modify the password ~5 # Fill in the new password ~Enter new password... Live together
Log in via portal
1.3 Pagoda installation and deployment environment
Without saying a word after coming in, I first installed the LNMP environment, because it will be needed to deploy the lsky
project later. I will focus on this time .
While waiting, you can check whether the file mapping between this directory file and the NAS is established.
Upload a file to see if it is available in the NAS.
After waiting for a while, everything is finally installed. Check whether the NGINX
related services are started normally.
If Nginx fails to start, you can check the log.
Prompt Port 80
is occupied
Try to modify port 80 here (…default.conf & phpfpm.status.conf) to something else that is not occupied.
2. Deploy the blue sky map bed
Used Lsky Picture Bed
https://www.lsky.pro/
You can also take a look at the tutorials on the official website, they are very clear and concise, so I will just be verbose.
2.1 [Install extensions] as required
Check the installation requirements written on the official website one by one.
Just click and click in the pagoda environment
Click **【Disable function】**, put exec
, shell_exec
, readlink
, symlink
, Putenv
, chown
These six disabled functions are deleted, that is, unbanned
2.2 Create website
Now you can access this empty project through 192.168.8.60:16080, and there should be a welcome interface (index.html).
If external network access is required, port mapping needs to be set on the firewall.
[The external link image transfer failed. The source site may have an anti-leeching mechanism. It is recommended to save the image and upload it directly (img-j7i3Ra9N-1692342956135) (NAS build image bed service.assets/image-20230817155718521.png)]
2.3 Deployment of Lankong Image Bed Project
This is the source code address:
https://github.com/lsky-org/lsky-pro/releases
Open the download lsky-pro-2.1.zip
If you are not a developer, please do not download the compressed package named Source Code
. This is the core source code and you need to install extensions yourself.
Download and put it into the project
Unzip it
-
Upload the installation package to the site directory and unzip it, and point the site’s running directory to the program’s
public
foldernginx needs to set pseudo-static, the content is as follows
location / {<!-- --> try_files $uri $uri/ /index.php?$query_string; }
-
Change the permissions, user group and owner of all folders, subfolders, and files in the directory where the program is located to
www
, and change the permissions to0755
Typically, the owner and group of the Web site directory is
www:www
The project is ready to run.
After configuring the domain name, visit the site Homepage and the program will automatically jump to the installation page. After the environment detection passes, you can install it through guidance.
Before starting, I built my own picture bed at https://img.deepe.ren, registered my own account, and then used my own token, so that the pictures are private.
3. Typora + PicGo + lsky to build automatic image upload
Effect demonstration:
PicGo drag file upload
Typora drag-and-drop automatic conversion
3.1. Install PicGo plug-in
Open the Typroa
interface, find File
in the menu bar->Preferences
in
Click PicGo(app) to install
Then click download below and wait for a while…
Special reminder: remember to save the installation path when installing, and use it later
3.2 Install lankong plug-in on PicGo
3.3 Configure Lankong
// Version selection V2 Lsky pro version:V2 // Server fills in Server: https://img.deepe.ren // Verification token (obtained according to your own account) Auth token: Bearer 1|hCKcAdIFxxxxxxxxxxxxxxxxxxxxIvSqJZ7q
Configuration completed:
3.3.1 How to obtain token
Open the LskyPro management interface (built earlier) https://img.deepe.ren
in the browser, and find the tokens interface
, upload upload interface
:
https://img.deepe.ren/api/v1
[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-j6jPSmBC-1692342956138) (C:/Users/xiaozepeng/AppData/Roaming/Typora/typora-user-images/ image-20230818110323536.png)]
Obtain the token through the tokens interface
, and fill in your account password in the following email
password
[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-U1Z6uBrq-1692342956139)(C:/Users/xiaozepeng/AppData/Roaming/Typora/typora-user-images/ image-20230818135529177.png)]
Obtained token: 2|hCKcAdIF38tEBlxxxxxxxxxxxxxxxxxxxxxxxxxx6W1IvSqJZ7q
Then add the prefix Bearer
in front according to the document
[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-PjcVIxC9-1692342956139)(C:/Users/xiaozepeng/AppData/Roaming/Typora/typora-user-images/ image-20230818135641245.png)]
Go back to lankong configuration and fill in the results.
3.4 PicGo test upload
Drag a picture to test it
3.5 Typora configuration
Select PicGo(app)
in the configuration place to copy the PicGo.exe
path under the picGo installation path
My installation path C:\Users\xiaozepeng\AppData\Local\Programs\PicGo
typora drag picture test
The pictures uploaded in this way are in the cloud. If they are later published in Nuggets
csdn
Community
, they no longer need to be uploaded manually.