KK's Blog 2023-01-29T10:30:54.647Z https://kk.sb/ kookxiang Hexo Use Jellyfin to build a secondary meta media library https://kk.sb/2023/use-jellyfin-to-organize-anime-library.htm 2023-01-29T08:06:06.000Z 2023-01-29T10:30:54.647Z Ten years ago, my uncle began to buy copyright, and opened the chip station to catch up with the fans anytime and anywhere.

Ten years later, even if you "swim" to Hong Kong, Macao and Taiwan, you can only see a small amount of honey content.

As for the members of big grievances? Oh, they can only watch three body animation

Why Jellyfin

In fact, the first thing Amway did was Emby However, the company seems to have fallen into the money trap:

  • Play on different devices requires internal purchase
  • Downloading files to local offline playback requires internal purchase
  • Hardware decoding also needs to be purchased internally

It's ridiculous. Don't you want to buy on every platform? Then you need to subscribe to Premiere (I still can't understand why this feature can sell for $54 a year)

For the sake of just bad money, even Shut down their code

and Jellyfin It is an open source Fork of Embey 3.5.2, free and free.

Jellyfin seeks to continue development of the original Emby project with a Free Software ethos. It is committed to bringing all its users access to the best possible Media System, developed entirely by a community of volunteers who contribute code, documentation, translations, and support to the project.
About Jellyfin

The installation of Jellyfin is very simple. You can use Docker to download and run it directly. My choice is simpler—— AUR
After all, it is NET software, which has no dependence on the running environment, can be directly handed over to systemd for management

Build media library

Since the NAS data itself is on ZFS, a Jellyfin Data Set is directly opened, and compression and de duplication are turned off.

Official directory structure requirements: https://jellyfin.org/docs/general/server/media/shows

 one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
seventeen
eighteen
 Shows
├── Series (2010)
│ ├── Season 00
│ │ ├── Some Special.mkv
│ │ ├── Episode S00E01.mkv
│ │ └── Episode S00E02.mkv
│ ├── Season 01
│ │ ├── Episode S01E01-E02.mkv
│ │ ├── Episode S01E03.mkv
│ │ └── Episode S01E04.mkv
│ └── Season 02
│ ├── Episode S02E01.mkv
│ └── Episode S02E02.mkv
└── Series (2018)
├── Episode S01E01.mkv
├── Episode S01E02.mkv
├── Episode S02E01-E02.mkv
└── Episode S02E03.mkv

Recommended by such individuals Root > (Series) > (Season) > (Episode).xxx Structure, which can reduce the difficulty of pulling metadata.

There are three main sources of animation:

  1. For new subscriptions, the most commonly used ones are mikanani.me
  2. BT/offline download, mainly downloading some suppressed old fans, and even preparing a special service to run such strange downloaders apps.kookxiang.cloud (Intranet only)
  3. Some contents downloaded by PT station

Among them, 1 and 2 are relatively simple. You can directly configure the download directory to the media library or move it after downloading
3. It's a little troublesome. You need to keep an original structure for seed hanging. The ZFS I used before automatically removes the weight. Now it is more recommended to use soft connection

Pull the metadata of fan drama

Jellyfin's biggest problem is that several built-in data sources have poor support for animation. Basically, only people like Detective Conan can have metadata.
In fact, it's OK, but it's better to search by Japanese name. I'm Bangumi+TMDB now

Fortunately, I know a little about C #, so I made a whole bgm.tv Data source plug-in for:
https://github.com/kookxiang/jellyfin-plugin-bangumi

After installation, check the Bangumi data source in the media library settings to use it.

One of the core functions of this plug-in is to automatically identify the set number. Remember the official naming requirements? The file name must have [E01] [S01E01] Such content is OK.

In fact, the domestic subtitle groups have various names, including Opera name - 01 , Yes [Drama name] [01] ……
In addition, there will be strange contents in the file name, such as [1080P] [10bit] [h264] There are also some file names with CRC32 Hash.

The direct problem is that by default, Jellyfin will recognize the odd number of episodes such as the 1080 episode, which is too troublesome to rename one by one, and it is even more troublesome to manually modify the automatically downloaded file names such as RSS.
Therefore, several common rules are built in the plug-in, covering the above situations, and can automatically identify the correct set number and return it to Jellyfin.

In addition, the plug-in will also use the rating and tag data on bgm, so that the rating and recommendation videos displayed on the interface will be more scientific.
Don't forget to log in with authorization so that you can automatically push the progress (Automatic dot grid)

 My Media Library

Watch on various devices

After Jellyfin is built, it can be viewed directly in the web version. However, due to the browser, there is very little content that can be hard understood. It is recommended to use the client to view it.

In addition, in order to improve the transcoding efficiency on the server, I plugged in the half height GeForce GTX 1050 Ti purchased at a huge cost of ¥ 450 during the mining boom

After installing nvidia dkms, restart the server and enable NVENC transcoding in the background

If you still want to struggle, you can apply a crack patch to lift the number limit of NVENCs on consumer video cards
https://github.com/keylase/nvidia-patch/

MPV + Anime4K + SVP4

Amway must be here jellyfin-mpv-shim This official project.

Its principle is very simple. After you select the screen projection on Jellyfin to play, it will automatically call MPV to play.
Since it is a mobile projection, you can use your mobile phone to log in to Jellyfin for remote control. Users like me who use bedside hanging displays say they are happy.

The built-in MPV of jellyfin mpv shim has Anime4K support. Press Enter to enter the menu and select the corresponding Profile.

MPV can also use SVP's ability to insert frames. However, jellyfin mpv shim has built-in support. Just refer to the readme open switch and configure to use the MPV in the SVP installation directory.

PS: This solution is also successful on the MacOS, but the performance of the Macbook Pro... in addition, it needs an SVP license

Infuse

The reason why they are put together is that Infuse is the best media library software in Apple's ecosystem. My iPhone/iPad/Apple TV uses it.
If the content you see does not involve 4K HDR or above, you do not need to subscribe in theory, but it is the only one on my Apple TV that can play Dolby Family Bucket Demo smoothly.

It is very simple to use: click Add at the bottom in the new file source, and Jellyfin can be added directly in the menu.

experience

There are three main ways to access my media library:

  1. If you can receive the 10.8.1.0/24 route, you can access it directly through the intranet
  2. It can be accessed through Cloudflare trunk, and a ladder is required
  3. It can be transferred through Tencent ECS. At present, the bandwidth is only 5M, and it may be blocked

If you want to experience it, you can contact me to get the address

]]>
<p>Ten years ago, my uncle began to buy copyright, and opened the chip station to catch up with the fans anytime and anywhere</ p> <p>Ten years later, even if you "swim" to Hong Kong, Macao and Taiwan, you can only see a small amount of honey content</ p> <p>As for the members of big grievances? Oh, they can only watch three body animation</p> <h1 id="Why use Jellyfin"><a href="# Why use Jellyfin" class="headerlink" title="Why use Jellyfin"></a>Why use Jellyfin</h1><p>In fact, Amway started with<a href=“ https://emby.media/ ">Emby</a>, but the company seems to fall into the money trap:</p> <ul> <li>Play on different devices requires internal purchase</li> <li>Downloading files to local offline playback requires internal purchase</li> <li>Hardware decoding also needs to be purchased internally</li> </ul> <p>It's ridiculous. Don't you want to buy on every platform? Then you need to subscribe to Premiere (I still can't understand why this feature can sell for $54 a year)</p> <p>They even<strong>shut down their code in order to make just the right money</strong></p> <p>And<a href=“ https://jellyfin.org/ ">Jellyfin</a>is an open source Fork of Emby 3.5.2, free and free</p> <blockquote> <p>Jellyfin seeks to continue development of the original Emby project with a Free Software ethos. It is committed to bringing all its users access to the best possible Media System, developed entirely by a community of volunteers who contribute code, documentation, translations, and support to the project.< br>《<a href=" https://jellyfin.org/docs/general/about ">About Jellyfin</a>》</p> </blockquote> <p>Jellyfin is easy to install. You can use Docker to download and run it directly. My choice is simpler --<a href=“ https://aur.archlinux.org/packages/jellyfin-bin ">AUR</a><br>After all, it is software developed by. NET and has no dependence on the running environment. It can be directly handed over to systemd for management</p>
Started blogging again https://kk.sb/2022/writing-blogs-again.htm 2022-04-23T16:00:00.000Z 2023-01-29T10:30:54.659Z You may wonder why my blog has not been updated since August 14, 2018.

Well, how can I explain this matter... I didn't mean to worry

The main thing is... work is very busy

And I'm not good at writing. When I write, it seems like constipation

I don't think the original blog is too ugly, and then I want to design a new theme by myself or find someone to give up

Anyway, I finally got a new blog and used the domain name kk.sb that I bought a long time ago

The goal of using Hexo is also very simple. I hope the new blog can focus on the content and not tidy up the fancy things

I don't know if anyone has read it. I will complain about the blog system I considered before Sharply review all major blog systems

Typecho

Old blogs use Typecho

advantage

  • It's light?
  • The default markdown for articles
  • Some small plug-ins have been made before (although some have been hung up)

Of course, there are also disadvantages

  • The development team is better than me. (This year, it suddenly announced that it had faked a corpse. I don't know why.)
  • Too few people use it. Naturally, few people do theme plug-ins
  • One thing to say, now I feel that the PHP environment on the server is not as simple and convenient as other languages (there are many things to be equipped)

WordPress

The blog system belonging to PHP should have the largest number of users at present

advantage:

  • Perfect third-party themes/plug-ins, even mature payment and customization markets
  • Cloudflare like mine also has corresponding optimization plug-ins
  • Continuous maintenance

Disadvantages:

  • I didn't find a suitable theme. Most of the popular theme markets are transforming WordPress into a mall, or lists rely heavily on pictures. Articles like me that don't match pictures are particularly ugly
  • Old fashioned performance issues
  • Even if I don't use WordPress, there are a lot of wp login. php and wp admin requests in the nginx log, which need to be updated

Ghost

Blog System Based on Node. js

advantage:

  • The default theme appearance is OK
  • WYSIWYG editor
  • AMP support
  • Very good support for third-party module embedding

Disadvantages:

  • Although the default theme is good looking, it still needs pictures of the article
  • Few third-party plug-ins have been found, and the official name is integrations rather than plugins

Medium

Medium is the most ideal blog system I have seen. In fact, I intended to use it directly. There are even half articles in the draft box

advantage:

  • WYSIWYG editor
  • The design of the reading page is simple, and the display of text and code is good
  • Official continuous maintenance, no need to maintain
  • Reading articles can bring income
  • User defined domain name can be bound (membership is required)

Disadvantages:

  • The wall is broken
  • The theme can be customized very little
  • The paid system, free users can see only a limited number of articles, I don't know if anyone will read them
  • For English websites, if the default font in Chinese is ugly, it will be popular (direct persuasion)

Language sparrow

Hmm... What the company did
Actually, it's exactly from Alipay Inc

advantage:

  • The editor is simple and easy to use
  • The interface is clean and beautiful

Disadvantages:

  • User defined domain names cannot be hung on their own websites (although they can be reversed)
  • No ability to customize theme/plug-in
  • Because the company is always working overtime(

Hexo

It is famous for its static deployment,

advantage:

  • Static deployment, which can be directly dumped on OSS or CDN, has the fastest theoretical performance
  • Relatively rich third-party plug-ins
  • Direct parsing of markdown articles is convenient for import and export

Disadvantages:

  • Official website Third party theme Many crude themes (I don't want to spray these authors, but I think the official needs to select some good ones to put on their own pages)
  • Strange template engine, although I may not have seen it

Well, I finally chose Hexo to use it first. If there is a better choice later, it can also be easily migrated to the past

]]>
<p>You may wonder why my blog has not been updated since August 14, 2018</ p> <p>Well, how can I explain this matter... I didn't mean to worry</p> <p>The main thing is... work is very busy</p> <p>And I'm not good at writing. When I write, it seems like constipation</p> <p><del>I don't think the original blog is too ugly, then I want to design a new theme myself or find someone to give up</del></p> <p>Anyway, I finally got a new blog and used the domain name kk.sb that I bought a long time ago</p> <p>The goal of using Hexo is also very simple. I hope the new blog can focus on the content and not tidy up the fancy things</p> <p>I don't know if anyone has read it. The rest of the content is just about the blog system that I considered to use before<del>Sharply comment on the major blog systems</del></p>
Install macOS High Sierra on Ryzen platform https://kk.sb/2018/install-hackintosh-high-sierra-on-ryzen.htm 2018-03-28T16:30:00.000Z 2018-03-28T16:30:00.000Z First, simply drop the current computer configuration:

CPU: AMD Ryzen 5 1600X Processor

a main board: ASUS PRIME B350M-A

Memory: G.SKILL Ripjaws V Series 16GB (2 x 8GB) DDR4 Memory

Hard disk: Samsung MZVLW256HEHP (PM961) 256GB SSD

Hard disk: SanDisk 250GB Ultra 3D NAND SATA3 SSD

Graphics card: ASUS Strix GEFORCE GTX 970

This is the basic configuration. Of course, SanDisk SSD was bought for the installation of the black Apple system. Because it does not want to affect the original Windows partition structure.

The first step is to download the latest High Sierra image and write it to the USB flash drive (I use SanDisk CZ80, and the latest upgrade is CZ880 )。

In fact, installing Black Apple is not without Apple devices. On the contrary, I have a MacBook Pro at hand. The most attractive aspect of Black Apple is its performance. For example, if my Ryzen is used for daily development, its construction and compilation speed is much better than Intel's mobile CPU.

Besides, you need a Mac to install High Sierra.

Download the latest system image first: open the App Store and search for High Sierra; Wait until the download is complete, do not click Continue cmd + Q Exit Setup.

First, change the USB stick to GPT format and format it to HFS+:

 Screenshot

Then open the terminal and use the command to write the installation program to the USB flash drive:

 one
 sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --applicationpath /Applications/Install\ macOS\ High\ Sierra.app  --volume /Volumes/kookxiang/

Don't rush to release the USB flash drive after it is written. Download it Ryzen kernel patch decompression

Open the USB stick with Finder, press cmd + shift + . Show hidden files.

Copy Ryzen_Kernel_10.13/PreInstall/Prelinkedkernel/prelinkedkernel file Overwrite to the following two directories:

  • /Volumes/Install macOS High Sierra/. IABootFiles/
  • /Volumes/Install macOS High Sierra/System/Library/PrelinkedKernels/

By the way PreInstall and PostInstall Put the two folders into the USB flash drive for standby.

download Clover Configuration Tool Run, find the mount EFI on the left, mount the EFI partition of the USB stick, and use Ryzen_High_Sierra_10.13_EFI.zip Unzip overlay.

Make sure your BIOS does not have a strange configuration enabled, or reset it directly and turn off the CSM module, so that Clover and Windows 10 boot image resolution can become native. Turn on EHCI and XHCI Hands off to ensure that USB can work normally. The serial port and parallel port, a port 20 years ago, should be closed by the way. Even if you open it, you don't have a corresponding device... HPET suggests that you open it. Because the early official Ryzen overclocking software relied on this function, I opened it in advance.

It should be noted that the hard disk cannot be started until Clover installation is completed. It is recommended to select the preferred startup mode in the BIOS as USB flash disk, and use Clover in the USB flash disk to start the installation program or the installed system.

If you are in a panic like me, you can remove the M.2 SSD and unplug the SATA cable of other hard disks to avoid a quick slip.

Next, you can use the USB flash drive to start. Select the USB flash drive in the Clover screen, and wait a moment to enter the installation interface. If there are forbidden signs, don't panic. This is a metaphysical problem. Just wash your face and restart it several times.

After entering the installation interface, click the above utility disk tool. Partitioning and formatting should go without saying here, But you need to remember the name of the disk , such as the one I use here Hackintosh , no space in the middle. After completion, exit and return to the main interface, and then move on like the white apple.

After installation, it will restart automatically, but do not enter the system!

Remember our PreInstall and PostInstall? Select Start from the installation USB flash disk, open the terminal, and execute /Volumes/Image\ Volume/PreInstall/pre , fill in the disk name in the previous step. If the disk name has spaces or other special characters, change the script yourself

The main purpose of this step is to copy the patch file and replace the system kernel with Ryzen modified version.

If no error is reported, restart the computer, select Hackintosh to start, and the progress bar will start. In fact, this is the real system installation process.

Wait until the progress bar is finished, select Start from the installation disk again, open the terminal, and execute /Volumes/Image\ Volume/PostInstall/post Replace the kernel.

After replacement, restart, choose to start from the Hackintosh disk, configure the system and create an account.
It is not recommended to bind iCloud here. It is not too late to bind after entering the system.

The system is basically OK. Next, you need to install Clover. You can download the above Clover Configuration Tool At the same time, mount the EFI partition of the U disk and the system disk, copy the EFI folder of the U disk to the system disk, and select "Merge" when prompted to overwrite.

Next, you can delete some compatible components for the installation program, launch a USB flash drive, and open the /Volumes/EFI/EFI/Clover/kexts/Other Folders, deleting DummyUSBXHCIPCI.kext DummyUSBEHCIPCI.kext GenericUSBXHCI.kext Three patches.

To enable Ryzen to run at full speed under macOS, use the Clover configuration tool to open clover.plist, and add busratio=xx Where xx is frequency multiplication. For example, if my 1600X daily overclocking reaches 3.8G, it will be written here as busratio=38 Because Ryzen overclocking is basically a super frequency multiplication, and the default external frequency is 100MHz. If you change the external frequency, you can calculate it slowly.

GTX 970 driver is relatively simple. First, click Install Driver in Clover Configuration Tool, and then click Install EmuVariableUefi , download to NVIDIA Latest Web Driver Just install it.

Since Apple's own graphics card is ATI's, A-card users can basically run without drivers. If you have problems, please search again.

After confirming that it is basically OK, restart it. This time, it can finally be powered off from the USB flash disk. After confirming that all functions are normal, it will be over.

Final print:

 Screenshot

 Screenshot

]]>
<p>First, simply drop the current computer configuration:</p> <blockquote> <p>CPU:<a href=" https://www.amd.com/en/products/cpu/amd-ryzen-5-1600x ">AMD Ryzen 5 1600X Processor</a></p> <p>Motherboard:<a href=“ https://www.asus.com/Motherboards/PRIME-B350M-A/ ">ASUS PRIME B350M-A</a></p> <p>Memory:<a href=“ https://www.gskill.com/en/product/f4-3000c16d-16grrb ">G.SKILL Ripjaws V Series 16GB (2 x 8GB) DDR4 Memory</a></p> <p>Hard disk:<a href=“ http://www.samsung.com/semiconductor/ssd/client-ssd/MZVLW256HEHP/ ">Samsung MZVLW256HEHP (PM961) 256GB SSD</a></p> <p>Hard disk:<a href=“ https://www.sandisk.com/home/ssd/ultra-3d-ssd ">SanDisk 250GB Ultra 3D NAND SATA3 SSD</a></p> <p>Graphics card:<a href=“ https://www.asus.com/Graphics-Cards/STRIXGTX970DC2OC4GD5/ ">ASUS Strix GEFORCE GTX 970</a></p> </blockquote> <p>This is the basic configuration. Of course, SanDisk SSD was bought for the installation of the black Apple system. Because it does not want to affect the original Windows partition structure</ p> <p>The first step is to download the latest High Sierra image and write it to the USB flash drive (I use SanDisk CZ80, and now the latest upgrade is<a href=“ https://www.sandisk.com/home/usb-flash/extremepro-usb ">CZ880</a>)。</p> <p>In fact, installing Black Apple is not without Apple devices. On the contrary, I have a MacBook Pro at hand. The most attractive aspect of Black Apple is its performance. For example, if my Ryzen is used for daily development, its construction and compilation speed is much better than Intel's mobile CPU</ p> <p>Besides, you need a Mac to install High Sierra</ p>
A game PC is installed https://kk.sb/2017/new-game-pc.htm 2017-03-27T16:29:00.000Z 2017-03-27T16:29:00.000Z It has been more than 4 months since I came to Shenzhen. I usually have only one Macbook Pro issued by the company, A game that is not enjoyable at all

In addition, before using raspberry pie to make NAS, the 100M network interface and USB 2.0 speed simply cannot meet the demand

So at the beginning, I prepared to set up a NAS, but I originally planned to set up a J1900 or something. However, I occasionally wanted to set up a World of Warships, so I simply added i3 (i3 default second full)

In terms of configuration, use the hottest chicken Generation 7 Core i3 7100 , the default frequency is up to 3.9G, which is really exciting!
The B250 chipset was chosen for the motherboard, because I have a good opinion of Gigabyte B250M-D3H This one. On the one hand, because the Micro ATX chassis is ready for installation, only small boards can be selected; Plus the silly clothes I bought before U2417H In the end, it was found that this monitor only has two interfaces: HDMI and DP (including MiniDP), so the motherboard uses the one with DP/HDMI output first.
In terms of memory, I randomly selected an 8G * 2 package on the second-hand store (the screen was always blue, and finally I found that one of them had been smoked, so I contacted JD for a home exchange, and I had to say that the service of the second-hand store was so simple)
If the chassis is made of aluminum Josep C3 There is also the popular large side repeater (after all, the motherboard said that it was equipped with a lamp, so it felt that it was wasteful to measure the penetration). Although this chassis is ITX/Micro ATX, it can use standard ATX power supply, which is much more convenient.
Considering the need of the graphics card and multiple hard disks, the power supply adopts the Atiq Neo ECO 550 After all, it is also used before. The interface is sufficient, and the key is that it will not explode.
In addition, because the motherboard has an M.2 interface, a 256G exploder is directly installed PM961 , just plug it into the motherboard, and it does not need to occupy the chassis space. After all, SSD is still standard for installation.
Finally, connect the 3T hard disk attached to the raspberry pie.

After a few weeks of using it, I occasionally visited Warship World, and found that even low frame rate can not be seen.
Alas, we can't help it. Who called us Spicy Chicken Jixian? So we weighed Lao Huang's 1060 and the master of stealing electricity RX 480, and finally supported agricultural enterprises. After all, the games we want to play, such as Skinhead, have always been N card negative optimization.

At last, it took about 4500 for the whole machine to come down, and there was no pressure on the highest picture quality of all kinds of games.
At present, I only find that GTA 5 seems to drop frames... Who told me that we are a fake 4 core? We need to adjust the image quality to a higher level to play. The CPU still doesn't need to be upgraded... After all, most of the time we don't need him to be fully loaded.

]]>
<p>It has been more than 4 months since I came to Shenzhen, and I usually have only one Macbook Pro issued by the company, which is an unpleasant game</p> <p>In addition, before using raspberry pie to make NAS, the 100M network interface and USB 2.0 speed simply cannot meet the demand</p> <p>So at the beginning, we prepared to group one NAS
Warship World Auto Sign In https://kk.sb/2016/wows-auto-sign.htm 2016-09-11T03:32:00.000Z 2016-09-11T03:32:00.000Z In fact, this pit has been dug for a long time

The earliest excavation was mainly for This activity But now this so-called permanent activity is over

It was the first time to use Go to realize automatic identification of verification code. This time, Dalao rewrote it with python, and then modified the learning algorithm of verification code to make the samples obtained more accurate (now the recognition rate of verification code is almost 100%)

Because the script of python is easy to change, it can be realized by adding a configuration if there are new activities. At present, the main check-in Land and Sea The new activities will be added

We have studied the interface of the lower fool air network. Now when we sign in, we will automatically detect whether we have signed in

The PIL is used to read image pixels, and then requests are sent

]]>
<p>In fact, this pit has been dug for a long time</p> <p>The earliest excavation was mainly for<a href=“ http://wows.kongzhong.com/ztm/fleet/ ">This activity</a>automatically signs in, but now this so-called permanent activity is over</p> <p>It was the first to use Go to realize automatic identification of verification codes
Hands on production of a super compact mobile phone QQ (limited by Android) https://kk.sb/2016/fuck-qq-android.htm 2016-07-28T11:14:00.000Z 2016-07-28T11:14:00.000Z What should I do if mobile QQ becomes slower and slower?
What if the chat version and international version are not fully functional?

With this script, you can easily simplify Android QQ and only retain basic chat related functions.

usage method:

  • Transfer to mobile phone
  • Execute with root permission

PS: See the note for detailed steps
PSS: Script requires Root permission
PSSS: Partial reduction can be carried out without Root permission (data partition cannot be operated). If necessary, you can modify the script execution

Script address: (please provide your own ladder)
https://gist.github.com/kookxiang/1104e898f270c9a7a0784f70979ec532

]]>
<p>What should I do if mobile QQ becomes slower and slower< Br>What if the chat version and the international version are not fully functional</ p> <p>With this script, you can easily simplify Android QQ and only retain basic chat related functions</ p> <p>Usage:</p> <ul> <li>Transfer to mobile phone</li> <li>Execute with root permission</li> </ul> <p>PS: For detailed steps, please refer to the note<br>PSS: The script requires Root permission<br>PSSS: It can be partially simplified without Root permission (the data partition cannot be operated). If you need to modify the script, you can execute it yourself</p>
When the sign in assistant of the post bar meets the Go language https://kk.sb/2016/tiebasign-with-go-backend.htm 2016-06-26T14:06:00.000Z 2016-06-26T14:06:00.000Z This summer three years after the official launch of the sign in assistant in the post bar
Today, two years after the development stopped
Finally, there is a major update

It took 2 days to rewrite the relevant code
Mainly for PHP 7.0 compatible processing, so that the code can run under PHP 7.0

Secondly, the sign in part is implemented in Go language. The measured peak CPU usage of multithreaded sign in is about 0.3%, and the memory usage is 4MB
It can greatly reduce the consumption of server resources for check-in, and can be deployed simultaneously with other services

Due to the change of Baidu login interface in three years, the original login interface has been abandoned and can not be used, so this time we rewrite the Chrome access extension of BDUSS
Can be accessed via https://api.ikk.me/reborn/proxy.htm The page requests extension to obtain cookies

In addition, since the sign in part (Go) has been separated from the main program, it can now be deployed separately from the web page.
I suggest that the database be placed at the sign in end to ensure system stability, and the webpage end can be remotely connected to the database for management operations.

At present, the new version is under closed test. Two digit users can sign in all users within 2 minutes
Now we are considering testing more users. If I know you, I believe you have received the invitation code. If not, you can contact me privately

New: Join Telegram Group , send invitations irregularly

]]>
<p>This summer, three years after the official launch of the sign in assistant in the post bar<br>, today, two years after the development stopped<br>, there was a major update</p> <p>It took 2 days to rewrite the relevant code<br>mainly for PHP 7.0 compatibility processing, so that the code can run under PHP 7.0</p> <p>Secondly, use the sign in part instead
Solve the problem of inaccurate currentTime attribute of audio element https://kk.sb/2015/fix-inaccurate-value-of-currentTime-property-in-a-audio-element.htm 2015-10-12T04:11:00.000Z 2015-10-12T04:11:00.000Z One problem with the previous KK Player is that dragging the progress bar in Internet Explorer/Microsoft Edge will make the playback time weird.
A few days ago, I found that there was also a problem under Firefox. Click to jump to 2 minutes. Although it shows that it is here, it actually only takes more than 1 minute and 50 seconds

This problem has been known for a long time, but I thought it was a bug of Microsoft at that time, and then I temporarily put it aside because there were not many IE users.

How does this question look like a browser question? So I prepared to ask the question at stackOverflow. I accidentally saw the system recommended A similar question

Generally speaking, MP3 is a lossy compression format, and the browser can't find the corresponding file stream location according to the time (however, I don't know how Chrome does it), so there will be such a ghost time.
The only solution is to use lossless audio in OGG format

However, the problem is even bigger. IE/Edge does not support this format at all... Yes Click here to check the browser compatibility of OGG

According to the browser compatibility report, it seems that only MP3 format has the best compatibility
Until the AAC format was found later, the compatibility report was here
And there is no problem with the current time in ACC format

So at present, we will store songs in ACC format first, and then consider using OGG when browser compatibility improves

]]>
<p>One problem with the previous KK Player is that in Internet Explorer ™; If you drag the progress bar under Microsoft Edge, the playback time will be weird< Br>I found a problem with Firefox a few days ago. Click it to jump to 2 minutes. Although it shows that it is here, it is actually only 1:5
CentOS 7 Recovery Network Record https://kk.sb/2015/restore-network-on-centos-7.htm 2015-09-15T11:51:00.000Z 2015-09-15T11:51:00.000Z Go out today Do something , on the way home Sendya, who didn't want to be named This fool has been harassing me:

[15:31] Just now
[15:31] When firewalld port scanning is enabled, it is enabled, but it does not work
[15:31] It took an hour or two to get it done
[15:31] Big fire - y remove iptables
[15:31] ……..
[15:31] The network is gone
[15:31] 233

[15:32] I was thinking.
[15:32] What about the database
[15:35] Terminal can enter
[15:36] But there is no network==
[15:36] Am I a fool
[15:36] NetworkManager
[15:36] No
[15:36] Only 127.0.0.1

To get down to business, how can I repair the network connection of CentOS?
Refer to AskUbuntu Solutions on
First, we need to boot through the CD, then mount the disk when the network is connected, chroot into the root directory, and then install through yum
So I asked for Conoha's background account password and connected to the terminal

Because it is VPS, loading the CD is not a problem
Restart after loading the CD, select Troubleshooting ->Rescue a CentOS system
This forced you to automatically mount the partition... OK
Ping 8.8.8.8 to find no connection
Ifconfig finds that the network card is normal, but there is no valid IP address
If not, we can add it manually ifconfig eth0 163.44.*.* netmask 255.255.254.0 (The last 16 IP addresses are hidden)
Then ping 8.8.8.8 and it was found that it did not work
Suddenly, it seems that there is still a default gateway not configured
So it seems that route add default gw 163.44.*.* eth0
Ping 8.8.8.8 is passed, and it's easy to do next

 one
two
three
four
five
 chroot /mnt/sysimage/
yum update -y
yum install -y NetworkManager
vi /etc/sysconfig/network-scripts/ifcfg-eth0
reboot

After restarting, log in to the server and ping 8.8.8.8 is normal. The problem is solved

]]>
<p>Go out today<a href=“ http://www.gdrsks.gov.cn/ksxx/kszc_show.asp?id=2858 ">Do something</a>, and go home<a href=" https://www.loacg.com/ ">Sendya</a>, who didn't want to reveal his name, has been harassing me:</p> <blockquote> <p>[15:31] I just started firewalld port scanning, but it didn't work. [br>[15:31] I did it for an hour or two, but it didn't work. [br>[15:31] It was a big fire - y remove iptables<br>[15:31]< Br>[15:31] The network is gone<br>[15:31] 233<br><img src="/2015/restore-network-on-centos-7/photo_2015-09-15_20-01-16. jpg" loading="lazy"><br>[15:32] I'm thinking< Br>[15:32] What about the database<br>[15:35] The terminal can access<br>[15:36], but there is no network&# x3D&# x3D;< Br>[15:36] Am I a fool?<br>[15:36] NetworkManager<br>[15:36] No more<br>[15:36] Only 127.0.0.1</p> </blockquote>
Time Machine for Windows - File History https://kk.sb/2015/file-history-windows.htm 2015-06-22T06:36:00.000Z 2015-06-22T06:36:00.000Z File History is a backup application that continuously protects personal files stored in libraries, desktops, favorites, and contact folders. It periodically scans (by default hourly) for changes in the file system and copies the changed files to another location. Whenever any of your personal files changes, a copy of them will be stored on a dedicated external storage device of your choice. Over time, File History will establish a complete history of changes made to any personal file.

This is a new feature introduced in Windows 8+, which can provide consumers with a new way to protect files. It will replace the existing Windows backup and restore functionality in Windows 7.

The most important point is that it is an incremental backup. Don't worry about thousands of backups taking up a lot of disk space

The configuration mode is very simple. Click "File History" in the control panel and set the backup disk to enable

To add a custom directory, you can create a new library, such as a code library, and then add the folder to be included (such as E: Workspace) to the library. Then the files inside will be automatically backed up

Video introduction from Microsoft:

You can right click any file in the library and select Restore Previous Version to restore it:
 Untitled. png

]]>
<p>File History is a backup application that continuously protects personal files stored in libraries, desktops, favorites, and contact folders. It periodically scans (by default hourly) for changes in the file system and copies the changed files to another location. Whenever any of your personal files changes, a copy of them will be stored on a dedicated external storage device of your choice. Over time, File History will establish a complete history of changes made to any personal file</ p> <p>This is a new feature introduced in Windows 8+, which can provide consumers with a new way to protect files. It will replace the existing Windows backup and restore functionality in Windows 7</ p> <p>The most important point is that it is an incremental backup. Don't worry about thousands of backups taking up a lot of disk space</p> <p>The configuration mode is very simple. Click "File History" in the control panel and set the backup disk to enable</p> <p>To add a custom directory, you can create a new library, such as a code library, and then add the folder to be included (such as E: Workspace) to the library. Then the files inside will be automatically backed up</p>
April is a remembrance of your lies https://kk.sb/2015/shigatsu-wa-kimi-no-uso.htm 2015-02-07T16:24:00.000Z 2015-02-07T16:24:00.000Z October New April is your lie( April is your last word )The comic book version is over

After watching the latest episode, I can't help but go to make up comics

It seems that it's the second time that I can't wait for cartoons to be translated directly (the first time is FA

This plot is really cruel. Please paste the ending

The following content involves spoilers. Let's do it ourselves

 one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
seventeen
eighteen
nineteen
twenty
twenty-one
twenty-two
twenty-three
twenty-four
twenty-five
twenty-six
twenty-seven
twenty-eight
twenty-nine
thirty
thirty-one
thirty-two
thirty-three
thirty-four
thirty-five
thirty-six
thirty-seven
thirty-eight
thirty-nine
forty
 I brought you by expediency, which is different from what I imagined.
More than I thought, more dark, more self abased, stubborn, is an obsessive camera maniac;
Lower your voice than you think, and more boyish than you think.
But he is a gentle person just like what he imagined.

The river jumped from Duxiong Bridge, the ice is cool and comfortable;
I ran a race with the tram and felt that I really won;
Watching the full moon in the music classroom, it is as delicious as steamed stuffed buns;
The little star that two people sing on the bicycle has a much different pitch, and the singing voice is a little desperate.

There is absolutely something in the school at night.
Snow is very similar to the petals of cherry blossoms.

It's strange that things outside the stage are full of heart when you are a performer.
It's really strange that the unforgettable scenery is such a subtle thing.

What will you do?
In whose heart can I stop?
Can I live in your heart.
I have struggled so hard until now without taking off my shoes.
Even if it's just a little bit, will you think of me——
If you forget——
It's going to be a ghost——

Reset or something.
Don't forget.
That's a good idea.
Sure enough, your words are very kind.

Did you get it. It would be nice to convey it. Mr. Ma begets the king.
I like you, like you, like you.

Canary (a kind of French cake) can't eat all of them, sorry.
Sorry for hitting you many times.
I'm sorry for being so headstrong.
Many, many, sorry.

Thank you——
P. S. My treasure is also put in the envelope. Please tear it up and throw it away after I'm gone.
Gong Yuanxun
]]>
<p>October New April is your lie (<del>April is your last words</del>) The comic book version is over</p> <p>After watching the latest episode, I can't help but go to make up comics</p> <p>It seems that it is a cartoon that can not wait for the second time to turn over the cartoon directly (the first time is<a href=“ http://bgm.tv/subject/1428 ">FA</a>)</p> <p>This plot is really cruel. Please paste the ending</p> <p><em><strong>The following content involves spoilers. You can do it yourself</strong></em></p>
Synchronize local/server code Git https://kk.sb/2015/sync-local-and-server-code-by-git.htm 2015-02-04T02:03:00.000Z 2015-02-04T02:03:00.000Z I'm used to developing with Git. I have to say that Git is really a good development tool

Sometimes it is often necessary to deploy code to the server while maintaining a Git library
For example, if the team wants to develop together and deploy to the team's test server automatically after committing, the following method can be used

First, create a Git library on the server

 one
 git init --bare

Then open the. git folder, find the hooks folder, and create a post receive file

 one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
 #!/ bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".

#exec git update-server-info

cd /var/www/buildbot.ikk.me/snapshot/KanColleTranslation/

env -i git pull

Then give the file execution permission

Since I used git clone on the website in advance, I can just pull it directly
Since this is an open library, there is no restriction on the. git folder. If you need to restrict it, you can add an rm command or nginx mask
Of course, if you want to be simple, I recommend replacing git pull with cp, which is simple and rude

]]>
<p>I'm used to developing with Git. I have to say that Git is really a good development tool</p> <p>Sometimes it is often necessary to maintain a Git library and deploy code to the server at the same time<br>For example, if the team wants to develop together and automatically deploy it to the team's test server after committing, the following method can be used</p> <p
Add two factor authentication support to Typecho https://kk.sb/2015/add-two-factor-authentication-for-typecho.htm 2015-01-04T03:17:00.000Z 2015-01-04T03:17:00.000Z I have to say that dual factor authentication is indeed an effective way to protect account security. Google, GitHub and many websites support dual factor authentication to protect accounts. This time, I transplanted dual factor authentication to typecho

First of all, I have to say that typecho does not reserve plug-in interfaces for login, only processing interfaces for login success and login failure, and there is no place to insert the login interface, so this time I will start with the source code of Typecho directly

First download the modified Typecho branch:
https://github.com/kookxiang/typecho

Then execute SQL:

 one
 ALTER  TABLE `typecho_users` ADD  COLUMN `twoFactorAuthKey` varchar ( eighteen ) NOT  NULL ;

(It could have been put into the Typecho updater for automatic execution, but it was not put into consideration for future upgrade)

Log in to the background and click Console Personal settings At the bottom, you can see the "two factor authentication". There is a randomly generated set of keys that can be manually added to Google Authenticator or Authy for use. Of course, it can also be added by QR code. However, considering the availability of Google API in China, it is recommended to open a ladder for access.

After adding it to the mobile phone, fill in the current verification code in the confirmation box and click Enable to enable it. After that, every time you log in to the background, no matter whether the password is correct, you will be asked to enter a dynamic password (increasing the difficulty of brute force cracking)

To cancel, you can log in to the background and enter a dynamic password to cancel.
If you cannot log in to the background, you can clear the corresponding user's twoFactorAuthKey field

That's it~

]]>
<p>I have to say that dual factor authentication is indeed an effective way to protect account security. Google, GitHub and many websites support dual factor authentication to protect accounts. This time, I transplanted dual factor authentication to typecho</p> <p>First, I have to say that typecho does not reserve plug-in interfaces for login, only processing interfaces for login success and login failure
XLServicePlatform to Kill Dog Day https://kk.sb/2014/fuck-thunder-service-xlserviceplatform.htm 2014-12-30T13:46:00.000Z 2014-12-30T13:46:00.000Z Domestic rogue software is really unbearable (After all, dogs can't change their behavior)

Xunlei has learned to automatically repair the XLServicePlatform service. If you turn off this service, it will be set to automatic startup mode without any prompt

This time, we will directly use Windows permission control to cure this bitch

  1. First of all, I will withdraw your Thunderbolt
  2. Open the registry editor and navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\XLServicePlatform
  3. Right modification Start Is 4 (disabled)
  4. modify ImagePath For example, I use Xunlei.com/AssHole To prevent it from starting automatically
  5. Find on the left Parameters Children, deleting ServiceDll
  6. Good mood can be changed Description , I'm too lazy to write dirty words
  7. Right click XLServicePlatform choice jurisdiction
  8. Click in sequence senior add to Select Host Advanced Find Now choice Everyone , click determine *2
  9. Show Advanced Permissions , Check delete set value create subkey , and then change the upper type to refuse , OK
  10. click Replace the permission entries of all child objects with permission entries that can be inherited from this object determine *N

PS: Windows will pop up a prompt about permissions, just ignore it
PSS: If Xunlei learns to modify permissions in the future, he will simply ban all permissions of the entire item. Since it is so cheap, everyone should not write

]]>
<p>Domestic rogue software is really unbearable<del>(after all, dogs can't change shit)</del></p> <p>Xunlei has learned to automatically repair the XLServicePlatform service. If you turn off this service, it will be set to automatic startup mode without any prompt</p> <p>Right to use Windows directly this time
Let Discuz support MariaDB https://kk.sb/2014/use-discuz-with-mariadb.htm 2014-04-09T05:45:00.000Z 2014-04-09T05:45:00.000Z I moved my blog and forum back to China last night; The blog was very easy to move, but after Discuz moved, he was not acclimatized

 Illegal mix of collations (gbk chinese ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='

After searching, it means that the database code is incorrect.
I am depressed. The database is GBK, the field is GBK, and the program is also GBK. How can there be any coding problem?
Bypass the planned task and enter the forum. I found that all the Chinese characters in the forum are garbled.
Is there a problem when I import data? So I used GB2312 again to export a copy and upload it to the server, but it still failed.
After an hour of tossing and turning, I accidentally found that the database under Discuz was set to the lantin code, which is different from what phpmyadmin saw!
Then I studied the database class of Discuz for a long time, and it was clearly set as GBK. Didn't it succeed?
Add DB:: query() to the program to set the code. It turns out that it is OK. What's the reason?? Express dissatisfaction
Is mysql_query() not enough? But DB:: query() calls mysql_query() again
When accidentally adjusting the code sequence, I found that moving to the outside of if ($this ->version()>'4.1') succeeded
Nima, you are the culprit
But is there a problem with this sentence? Output Down

 10.0.9-MariaDB

Nima instantly understood that this is a string, and "4.1" is also a string. The string comparison is to compare each character one by one, first judge 1<4, and then get 10.0.9-MariaDB<4.1
I, QNMLGB, made me writhe for two hours

terms of settlement:
Modify the version method, return '9.9.9';

]]>
<p>I moved my blog and forum back to China last night; The blog was very easy to move, but after Discuz moved, he was not acclimatized</p> <pre><code>Illegal mix of collations (gbk chinese ci,IMPLICIT) and (latin1_swedish
Let Discuz! Post list supports reverse sorting https://kk.sb/2014/add-parameter-to-sort-threads-in-discuz.htm 2014-04-08T05:42:00.000Z 2014-04-08T05:42:00.000Z Discuz! Although you can modify the sorting method of posts in the background, you cannot select reverse or sequential sorting.

To solve this problem, the following modifications can be adopted:
Modify the file source/module/forum/forum _forum_forumdisplay.php, and find 457 lines:

 one
 $_GET [ 'ascdesc' ] = isset ( $_G [ 'cache' ][ 'forums' ][ $_G [ 'fid' ]][ 'ascdesc' ]) ? $_G [ 'cache' ][ 'forums' ][ $_G [ 'fid' ]][ 'ascdesc' ] : 'DESC' ;

Add below:

 one
two
three
four
 // Modified by kookxiang @ 2014-4-8 13:05:07
if ( $_GET [ 'forceasc' ]) $_GET [ 'ascdesc' ] = 'ASC' ;
if ( $_GET [ 'forcedesc' ]) $_GET [ 'ascdesc' ] = 'DESC' ;
// Ending of modification

In this way, you can control the sorting through the URL parameters forceasc and forcedesc

]]>
<p>Discuz! Although you can modify the sorting method of posts in the background, you cannot select reverse or sequential sorting</ p> <p>To solve this problem, the following modification methods can be used:<br>Modify the file source&# x2F; module&#x2F; forum&#x2F; Forum_forumdisplay.php, find
Leave WiFi range and disable WiFi automatically https://kk.sb/2014/android-auto-wifi.htm 2014-04-03T12:53:00.000Z 2014-04-03T12:53:00.000Z The student party said that WiFi has been on for a long time in the dormitory, and it is always hard to remember to turn off when going out to class.

In the spirit of saving a little, I hope that when I leave the WiFi range, it will be automatically turned off, so I wrote one myself.

The program itself does not occupy any resources, and there is no background process. Automatically register a network status listener. When WiFi is disconnected for a period of time, turn off WiFi.

It is worth noting that due to the limitation of Android 4.0 and above, the program must be started at least once to register the listener, so Click the icon manually after installation
After startup, the program automatically hides the program icon (because it is useless to click it → _ →)

Later, it may be considered to automatically scan WiFi when adding a charger and put it on the wireless charging board (laugh

Download here: KK Auto Wifi.apk

]]>
<p>The student party said that WiFi has been on for a long time in the dormitory, and it is always hard to remember to turn off when going out to class</ p> <p>In the spirit of saving a little, I hope that when I leave the WiFi range, it will be automatically turned off, so I wrote one myself</ p> <p>The program itself does not occupy any resources, and there is no background process. Automatically register a network status listener. When WiFi is disconnected for a period of time, turn off W
Install macOS High Sierra on Ryzen platform https://kk.sb/2013/hp-envy4-bios-set-hdd-mode.htm 2013-09-20T15:15:00.000Z 2013-09-20T15:15:00.000Z Write in front:

Never buy an HP laptop
Are you really the boss? Also lock BIOS
Which options do you mean BIOS?

How to modify the operating mode of the hard disk:

  1. Make sure UEFI mode is turned on

  2. Prepare a USB flash disk in FAT32 format

  3. Download and unzip BOOTX64.zip , throw it to the root directory and /EFI/BOOT/ lower

  4. Restart the computer, press F9 to select the USB flash drive to start

  5. Type the command:

     one
     setup_var 0x39 0x01
  6. Press Ctrl Alt Del Press the key to restart, and the working mode switch is completed

The comparison table of each mode and value is attached:

command offset value
setup_var 0x39 0x00 IDE compatibility mode
setup_var 0x39 0x01 AHCI mode
setup_var 0x39 0x02 RAID mode
]]>
<p>Write in front:</p> <blockquote> <p>Never buy an HP laptop...<br>Do you really regard yourself as the boss? Also lock the BIOS...<br>Which options do you mean BIOS</ p> </blockquote> <p>How to modify the operating mode of the hard disk:</p> <ol> <li><p>Ensure
Can the QoS "Limit Reserved Bandwidth" set to 0% really speed up the network? https://kk.sb/2013/force-qos-restricting-reserved-bandwidth-to-0-can-really-increase-network-speed.htm 2013-01-14T09:35:00.000Z 2013-01-14T09:35:00.000Z

Many articles on system optimization have mentioned the setting item of QoS "limit the bandwidth that can be reserved".
The default value of the system is 20%. Many people change it to 0% and think it can improve the bandwidth. But is this modification really effective?

We can use Microsoft's This article A description of this feature can be found in:

As in Windows 2000, programs can utilize QoS through the QoS API in Windows XP. All programs can share 100% of the network bandwidth, unless a program specifically requires bandwidth priority. Other programs can also use this "reserved" bandwidth, except when the program requesting this bandwidth is sending data. By default, the program can reserve 20% of the aggregate bandwidth of the basic link speed on each interface of the terminal computer. If the amount of data sent by the bandwidth reserved program does not completely use up the bandwidth, the unused portion of the reserved bandwidth can be used for other data streams on the same host.

Obviously, modifying this setting is completely impossible to achieve network acceleration, but it will make some programs unable to obtain higher network priority.

Therefore, we suggest that you do not change this value to 0%. You can set it to 10% or 5% (depending on your network bandwidth), or directly use the default 20%. This option is really useless for improving network bandwidth

]]>
<p><img src="/2013/force-qos-restricting-reserved-bandwidth-to-0-can-really-increase-network-speed/QQ%E6%88%AA%E5%9B%BE20130114172716.png" l
SEO skills after Typecho modifies fixed links https://kk.sb/2011/seo-before-typecho-change-permalink.htm 2011-11-12T11:47:00.000Z 2011-11-12T11:47:00.000Z Two days ago, I changed the last ID in the fixed link of the blog to the abbreviated name of the article. This is a tragedy. Search engines have to re capture it. I'm too lazy to wait for him. Of course, I'm afraid of giving Google Baidu Shenma the right to demote, so I have this article:

First of all, my idea is to insert a piece of code through PHP, recognize that the last parameter in the link is a digital id, and then automatically query the database and 301 to the new address.

So I asked Google's big brother how PHP can obtain a pseudo static address. This question has no pressure on Google—— $_SERVER['ORIG_PATH_INFO'] ——It's him, and then it's regular. Because it's numbers, this part is also very simple: .+\/([0-9]+)\.html

After that, the next step is to use PHP to organize this pile of things:

 one
two
three
four
five
six
seven
eight
nine
ten
eleven
 /* KK's 301 */
preg_match ( '/.+\/ ([0-9]+)\.html/i' , $_SERVER [ 'ORIG_PATH_INFO' ], $matches );
if ( $matches [ one ]){
$post_id = $matches [ one ];
$query = $db -> sql ()-> select ( 'slug' )-> from ( 'table.contents' )-> where ( 'cid = ?' , $post_id );
$result = $db -> fetchRow ( $query );
$url = str_replace ( $post_id , urlencode ( $result [ 'slug' ]), $_SERVER [ 'ORIG_PATH_INFO' ]);
header ( 'HTTP/1.1 301 Moved Permanently' );
header ( "Location: {$url} " );
exit ();
}

Then -- the last step of course is to find a place to put this code. According to my knowledge of Typecho, it should be placed in index.php, which is the core of Typecho. All pages will be pseudo static into this PHP.

Because we use the database class of Typecho here, the code should be placed in include config.inc.php Next, notice the Typecho comment:

 one
two
 /**Start Routing Distribution*/
Typecho_Router :: dispatch ();

Obviously, our code should be placed in front of it, otherwise the system will output 404 pages before you.

OK, let's open another page ending with "article id. html" to see if the code is normal.
(PS: Because I forgot to update the CDN cache, I thought the code was wrong ⊙﹏ ⊙ b)

]]>
<p>Two days ago, I changed the last ID in the fixed link of the blog to the abbreviated name of the article. This is a tragedy. Search engines have to re capture it. I'm too lazy to wait for him. Of course, I'm afraid of giving Google Baidu Shenma the right to demote, so I have this article:</p> <p>First of all, my idea is to insert a piece of code through PHP, recognize that the last parameter in the link is a digital id, and then automatically query the database and 301 to the new address</ p> <p>So I asked Google's big brother how PHP can obtain a pseudo static address. This question has no pressure on Google --<code>$_SERVER [&# 39; ORIG_PATH_INFO&# 39;]</code>-- that's him. Then it's the regular one. Because it's numbers, this part is also very simple:<code>+\/ ([0-9]+)\.html</code></p> <p>After that, the next step is to use PHP to organize this pile of things:</p>