看得透又看得远者prevail. ppt.cc/flUmLx ppt.cc/fqtgqx ppt.cc/fZsXUx ppt.cc/fhWnZx ppt.cc/fnrkVx ppt.cc/f2CBVx
ppt.cc/fKlBax ppt.cc/fwlgFx ppt.cc/fVjECx ppt.cc/fEnHsx ppt.cc/fRZTnx ppt.cc/fSZ3cx ppt.cc/fLOuCx ppt.cc/fE9Nux ppt.cc/fL5Kyx ppt.cc/f71Yqx tecmint.com linuxcool.com linux.die.net linux.it.net.cn ostechnix.com unix.com ubuntugeek.com runoob.com man.linuxde.net ppt.cc/fwpCex ppt.cc/fxcLIx ppt.cc/foX6Ux linuxprobe.com linuxtechi.com howtoforge.com linuxstory.org systutorials.com ghacks.net linuxopsys.com ppt.cc/ffAGfx ppt.cc/fJbezx ppt.cc/fNIQDx ppt.cc/fCSllx ppt.cc/fybDVx ppt.cc/fIMQxx
Total Pageviews
Monday, 24 August 2026
加拿大向中国开门
卡尼时代的加拿大,如果只听外交辞令,很容易听糊涂。一方面说美国仍是最重要盟友,一方面强调加拿大必须减少对美国依赖;一方面承认中国存在安全风险,另一方面又重新向中国扩大贸易。
其实不必听那么多。国家真正的选择,不在记者会,在行动。
过去一年,加拿大出现了两个同时发生的趋势:对美国,强调自主、增加距离;对中国,则降低部分壁垒、恢复贸易。两条线单独看,都有理由;放在一起看,方向已经相当清楚。
最新的美加贸易谈判尤其如此。双方在最后阶段破裂,美国对约200亿美元加拿大商品加征50%关税,加拿大宣布“dollar for dollar”反制。加拿大认为美国最后提出的条件侵犯其贸易自主,因此宁愿承受经济代价,也不接受。
这当然是加拿大的权利。
加拿大不是美国第五十一个州,卡尼也不是白宫任命的省长。一个主权国家认为过度依赖美国是一种危险,希望扩大欧洲、亚洲市场,完全讲得通。
而且事情已经不能简单归结为卡尼个人。加拿大目前相当一部分民意支持政府对美国采取强硬态度。既然加拿大选民愿意尝试这条道路,美国反而应该认真一点:不要再把它当作渥太华一时闹脾气,更不必一厢情愿等待加拿大“恢复正常”。
尊重加拿大,首先就是相信加拿大人知道自己在选择什么。
有趣的是另一边。
加拿大努力降低对美国依赖的同时,却在降低与中国的部分经济壁垒。卡尼访华后,加拿大同意每年给予最多4.9万辆中国电动车6.1%的关税待遇,大幅松动此前100%的附加关税;作为交换,中国降低加拿大油菜籽等农产品面对的贸易壁垒。
一边减少对美国的依赖,一边向中国重新开门。加拿大完全有权如此。
加拿大七成以上货物出口进入美国,两国汽车工业早已连成一片;边境对人员和车辆又高度开放。一个加拿大居民开自己的汽车去纽约、底特律度假,平常得像从广东开车去广西。
这种特殊关系能够存在,并不仅因为两国人民感情好,而是因为双方长期处于一个高度整合、风险标准相近的北美经济与安全空间。
中国电动车恰好说明,当这个前提发生变化,问题会怎样出现。
美国正在限制中国联网汽车进入本国市场,理由不只有产业保护,也包括数据和国家安全。现代汽车装有摄像头、定位系统、通信模块、软件更新系统和大量传感器。美国当然不能证明每一辆中国汽车都会搜集敏感信息,更不能证明北京明天会遥控哪一辆汽车;但国家安全本来就不是等事故发生以后才开始研究。
加拿大却可以作出不同判断。
加拿大说,这是我的市场,我愿意承担这个风险。
完全正确。
但如果一辆在安大略合法购买、合法注册的中国电动车,可以按照加拿大车辆原有的便利驶入美国,那么加拿大的政策选择就产生了跨境外部性。
美国也完全可以回答:风险留在加拿大,是你的主权;风险跟着汽车进入美国,就不再只是你的事情。
这不是惩罚加拿大。
更长远的问题甚至不是这4.9万辆汽车。今天是中国的整车出口到加拿大,明天加拿大可能出现维修体系、零部件供应链,后天可能中国汽车企业投资加拿大生产。到了那一步,美国面对的就不再是几辆挂安大略车牌的汽车,而是中国汽车产业能否通过加拿大逐渐接入北美产业体系。
加拿大当然可以认为,这是经济机会。
美国也可以认为,这是安全风险。
加拿大可以说:我有权决定与中国做什么生意,美国无权替我决定。
美国完全应该同意。
然后补上一句:美国也有权决定,加拿大商品、资本和车辆以什么条件进入美国。
这两句话并不矛盾。
现在加拿大社会本身相当支持减少对美国的依赖,美国更没有必要苦口婆心把加拿大往回拉。
卡尼的路线如果成功,加拿大找到了更多市场,减少对美国的依赖,又从中国和欧洲获得新的市场机会,那说明加拿大选对了。
美国不必替加拿大作决定,更不必替加拿大承担选择的成本。
所以美国尤其不必发脾气。
加拿大人可以买本国货,可以抵制美国商品,可以少去佛罗里达,可以投票支持任何他们喜欢的政府。美国若因为加拿大人不喜欢川普而报复,反而显得小气。
美国真正应该做的,只是把自己的门重新量一次尺寸。
过去门开得特别宽,是因为门外站着一个几乎共享同一套经济、安全和产业规则的加拿大。今天加拿大决定改变自己的道路,美国自然可以重新考虑,这扇门还应该开多宽。
加拿大要减少对美国的依赖,这是加拿大的权利;要向中国开门,也是加拿大的权利。
加拿大选自己的路,美国也选自己的。
剛升空就墜毀
-韩国的等级制度森严。下属即使发现了机长的错误,也不敢立即大声要求机长纠正错误,这样就耽搁了宝贵的自救时机。所以韩国的班机最好别坐。
Sunday, 23 August 2026
在windows上,如何升级nodejs
在 Windows 上升级 Node.js 最简单的方法是直接去 Node.js 官网下载最新的 .msi 安装包覆盖安装。
- 访问 Node.js 官网下载最新的 LTS(长期支持)版
.msi安装包: - https://nodejs.org/dist/v24.19.0/node-v24.19.0-x64.msi
- 双击运行安装程序,一路点击 "Next"。
- 关键点:安装路径要和您电脑上旧版本的安装路径保持一致(通常在
C:\Program Files\nodejs\)。安装程序会自动覆盖旧版本。 - 打开命令提示符(CMD)输入
node -v检查版本是否更新成功。
在windows下,搭建静态博客程序quarkdown
首先安装powershell:
https://github.com/PowerShell/PowerShell/releases/download/v7.6.5/PowerShell-7.6.5-win-x64.msi ,下载并安装。
然后启动powershell.exe , 运行命令:
irm https://raw.githubusercontent.com/quarkdown-labs/get-quarkdown/refs/heads/main/install.ps1 | iex
然后,启动git bash, 运行命令:
quarkdown create quarkdown-document
(会在当前目录下,生成 quarkdown-document目录)
12799@DESKTOP-B6LK9IO MINGW64 ~ (main)
$ cd quarkdown-document
12799@DESKTOP-B6LK9IO MINGW64 ~/quarkdown-document (main)
$ ls
image/ main.qd
12799@DESKTOP-B6LK9IO MINGW64 ~/quarkdown-document (main)
$ quarkdown c main.qd
[16:45] Success @ C:\Users\12799\quarkdown-document\quarkdown-output\Quickstart
(quarkdown c main.qd就是生成/更新静态网站的根目录的命令)
12799@DESKTOP-B6LK9IO MINGW64 ~/quarkdown-document (main)
$ ls
image/ main.qd quarkdown-output/
12799@DESKTOP-B6LK9IO MINGW64 ~/quarkdown-document (main)
$ cd quarkdown-output/
12799@DESKTOP-B6LK9IO MINGW64 ~/quarkdown-document/quarkdown-output (main)
$ ls
Quickstart/
12799@DESKTOP-B6LK9IO MINGW64 ~/quarkdown-document/quarkdown-output (main)
$ cd Quickstart/
12799@DESKTOP-B6LK9IO MINGW64 ~/quarkdown-document/quarkdown-output/Quickstart (main)
$ ls
index.html lib/ media/ script/ script.checksum theme/
12799@DESKTOP-B6LK9IO MINGW64 ~/quarkdown-document/quarkdown-output/Quickstart (main)
$ python3 -m http.server 2233
访问http://127.0.0.1:2233,即可看到静态网站效果。但是这个效果比较简陋。我们可以fork程序作者自己的博客网站程序:https://github.com/iamgio/iamgio.github.io,我fork后的项目地址是https://github.com/brightmann/igi-source-code
访问https://github.com/brightmann/igi-source-code/tree/main/src/blog ,在此,新建源帖2026-08-23-fh.qd ,内容为:
.docname {战马}
.include {template/setup.qd}
.blogpost date:{August 23, 2026}
此处写正文或html codes.
(详见https://github.com/brightmann/igi-source-code/blob/main/src/blog/2026-08-23-fh.qd)
然后,
git clone https://github.com/brightmann/igi-source-code igi-source-code-by-brightmann
cd igi-source-code-by-brightmann
12799@DESKTOP-B6LK9IO MINGW64 ~/igi-source-code-by-brightmann(main)
$ ls
src/
12799@DESKTOP-B6LK9IO MINGW64 ~/igi-source-code-by-brightmann(main)
$ cd src
12799@DESKTOP-B6LK9IO MINGW64 ~/igi-source-code-by-brightmann/src (main)
$ ls
about.qd blog.qd experience.qd js/ projects.qd setup.qd
blog/ contacts.qd images/ main.qd public/ stylesheets/
12799@DESKTOP-B6LK9IO MINGW64 ~/igi-source-code-by-brightmann/src (main)
$ quarkdown c main.qd
[17:20] Success @ C:\Users\12799\igi-source-code-by-brightmann\src\quarkdown-output\Giorgio-Garofalo-iamgio
12799@DESKTOP-B6LK9IO MINGW64 ~/igi-source-code-by-brightmann/src (main)
$ ls
about.qd contacts.qd js/ public/ stylesheets/
blog/ experience.qd main.qd quarkdown-output/
blog.qd images/ projects.qd setup.qd
(生成了quarkdown-output 目录)
12799@DESKTOP-B6LK9IO MINGW64 ~/igi-source-code-by-brightmann/src (main)
$ cd quarkdown-output/
12799@DESKTOP-B6LK9IO MINGW64 ~/igi-source-code-by-brightmann/src/quarkdown-output (main)
$ ls
Giorgio-Garofalo-iamgio/
12799@DESKTOP-B6LK9IO MINGW64 ~/igi-source-code-by-brightmann/src/quarkdown-output (main)
$ cd Giorgio-Garofalo-iamgio/
12799@DESKTOP-B6LK9IO MINGW64 ~/igi-source-code-by-brightmann/src/quarkdown-output/Giorgio-Garofalo-iamgio (main)
$ ls
2025-12-05-hello-world/ index.html script/ theme/
2025-12-10-accidentally-in-silicon-valley/ lib/ script.checksum
2026-03-28-overengineering/ media/ sitemap.xml
2026-08-23-fh/ robots.txt static/
(里面有index.html文件,可见~/igi-source-code-by-brightmann/src/quarkdown-output/Giorgio-Garofalo-iamgio就是静态网站的根目录)
12799@DESKTOP-B6LK9IO MINGW64 ~/igi-source-code-by-brightmann/src/quarkdown-output/Giorgio-Garofalo-iamgio (main)
$ python3 -m http.server 2345
访问http://127.0.0.1:2345/ ,即可看到静态网站的效果。
http://127.0.0.1:2345/2026-08-23-fh/ 不能显示视频
12799@DESKTOP-B6LK9IO MINGW64 ~/igi-source-code-by-brightmann/src/quarkdown-output/Giorgio-Garofalo-iamgio (main)
$ ctrl+c
12799@DESKTOP-B6LK9IO MINGW64 ~/igi-source-code-by-brightmann/src/quarkdown-output/Giorgio-Garofalo-iamgio (main)
然后把静态网站的根目录的内容push到在github.com/brightmann下所新建的空仓库igi:
git init .
git add .
git commit -m 'xx'
git remote set-url xyz git@github-first:brightmann/igi
(或者git remote add xyz git@github-first:brightmann/igi)
git branch -m main
git push -f origin main
(在本地机器上生成的静态网站的根目录的内容都可以通过以上的git命令push到在github.com/your-username下所新建的某个空仓库,这样再也不用东找西找静态服务器了)
访问 https://brightmann.github.io/igi/ 即可看到静态网站的效果。
https://brightmann.github.io/igi/2026-08-23-fh/ 不能显示视频。
项目地址:
https://github.com/iamgio/quarkdown
https://quarkdown.com/wiki/quickstart/
https://quarkdown.com/#install
https://github.com/quarkdown-labs/get-quarkdown/
程序作者自己的博客网站程序:
https://github.com/iamgio/iamgio.github.io
https://github.com/iamgio/iamgio.github.io/issues/1
我fork后的项目地址是https://github.com/brightmann/igi-source-code
https://github.com/brightmann/igi
3款httpd程序-asmhttpd, bashttpd, libmicrohttpd
A minimalist HTTP server for Linux, written in x86_64 assembly。
asmhttpd - The tiniest webserver ever written.
HOW TO BUILD:
Just run "make". You will need NASM on your system.
HOW TO RUN:
./asmhttpd /path/to/your/webroot
sudo ./asmhttpd /path/to/your/webroot
If run as root, it will listen on port 80. Otherwise, it will use port 8080.
HOW TINY IS IT?
The entire text and data fit on a single 4K page:
{0}[calvin ~] cat /proc/$(pgrep -n asmhttpd)/maps
00401000-00402000 r-xp 00001000 00:16 2483272 asmhttpd
Each client allocates an additional 4K page and a thread while connected.
The code is written in a monolithic "branching tree" style with no functions,
and uses registers for all local variables. RAM is only used for buffering the
HTTP request, and for building structures necessary for system calls.
Because there is no stack, and the targets of all branch instructions are
constants, traditional buffer overflow exploits are impossible.from https://github.com/jcalvinowens/asmhttpd
-------
A web server written in bash。
bashttpd is a simple, configurable web server written in bash
bash, any recent version should worksocatornetcatto handle the underlying sockets.- A healthy dose of insanity
socat TCP4-LISTEN:8080 EXEC:/usr/local/bin/bashttpd
Or
netcat -lp 8080 -e ./bashttpd
Note that in the socat example above, the web
server will immediately exit once the first connection closes. If you
wish to serve to more than one client - like most servers do, then use
the variant:
socat TCP4-LISTEN:8080,fork EXEC:/usr/local/bin/bashttpd
This way, a new process is spawned for each incoming connection.
- Running bashttpd for the first time will generate a default configuration file, bashttpd.conf
- Review bashttpd.conf and configure it as you want.
- Run bashttpd using netcat or socat, as listed above.
- Serves text and HTML files
- Shows directory listings
- Allows for configuration based on the client-specified URI
- Does not support authentication
- Doesn't strictly adhere to the HTTP spec.
- Only rudimentary input handling. We would not running this on a public machine.
403: Returned when a directory is not listable, or a file is not readable
400: Returned when the first word of the first line is not GET
200: Returned with valid content
Content-type: Bashttpd uses /usr/bin/file to determine the MIME type to sent to the browser
1.0: The server doesn't support Host: headers or other HTTP/1.1 features - it barely supports HTTP/1.0!
As always, your patches/pull requests are welcome!
from https://github.com/tootallnate/bashttpd
-----
GNU Libmicrohttpd
GNU libmicrohttpd is a small C library that makes it easy to run an HTTP server as part of another application. GNU Libmicrohttpd is free software and part of the GNU project. Key features that distinguish GNU Libmicrohttpd from other projects are:
- C library: fast and small
- API is simple, expressive and fully reentrant
- Implementation is HTTP 1.1 compliant
- HTTP server can listen on multiple ports
- Various threading modes: run in application thread, internal thread, thread pool, and thread-per-connection
- Three different sockets polling modes: select(), poll(), and epoll
- Minimised number of sys-calls to avoid extra user/kernel mode switches
- Supported platforms include GNU/Linux, FreeBSD, OpenBSD, NetBSD, Android, Darwin (macOS), W32, OpenIndiana/Solaris, and z/OS
- Support for IPv6
- Support for SHOUTcast
- Support for incremental processing of POST data (optional)
- Support for basic and digest authentication (optional)
- Support for TLS (requires libgnutls, optional)
- Binary is only about 32k (without TLS support and other optional features)
GNU libmicrohttpd was started because the author needed an easy way to add a concurrent HTTP server to other projects. Existing alternatives were either non-free, not reentrant, standalone, of terrible code quality, or a combination thereof. Do not use GNU libmicrohttpd if you are looking for a standalone HTTP server, there are many other projects out there that provide that kind of functionality already. However, if you want to be able to serve WWW pages from within your C or C++ application, check it out.
GNU libmicrohttpd is maintained by Evgeny Grin (Karlson2k) and another co-maintainer.
Downloading libmicrohttpd
There are currently two main versions of the library available. GNU libmicrohttpd 1.x is the stable version, and GNU libmicrohttpd 2.x is experimental and remains under heavy development. GNU libmicrohttpd 2.x can currently only be obtained by cloning our Git repository at git://git.gnunet.org/libmicrohttpd2.git.- Source Code
- Libmicrohttpd is available from the main GNU FTP server via HTTP(S) and FTP. It can also be found on the GNU mirrors; please use a mirror if possible.
- Debian .deb package
- The debian package can be downloaded from the official debian archive. The respective packages for libmicrohttpd are libmicrohttpd and for development libmicrohttpd-dev.
- Tar Package
-
The latest version can be found on GNU mirrors.
If the mirror does not work, you should be able to find them on the
main FTP server.
Latest release is libmicrohttpd-latest.tar.gz.
- Windows
- Latest Windows binary is libmicrohttpd-latest-w32-bin.zip.
Documentation
In addition to the brief documentation on this webpage, we have various other forms of documentation available:
- microhttpd.h
- This include file documents most of the API in detail.
- Manual
- A manual for Libmicrohttpd
is available online, as is documentation for most GNU software.
You may also find more information about
Libmicrohttpd
by running
info libmicrohttpd
or
man libmicrohttpd,
or by looking at
/usr/share/doc/libmicrohttpd/,/usr/local/doc/libmicrohttpd/, or similar directories on your system. - Tutorial
- The GNU Libmicrohttpd tutorial is available as one document in PDF and HTML formats.
- Security audit 2025
- Ada Logics with support from the Sovereign Tech Agency performed a security audit of the source code of the GNU libmicrohttpd 2.x codebase in August 2025. All discovered issues were addressed. The full report is available here.
Mailing lists
Libmicrohttpd uses the libmicrohttpd mailinglist to discuss all aspects of Libmicrohttpd, including support, development, and enhancement requests, as well as bug reports.
Announcements about Libmicrohttpd and most other GNU software are made on info-gnu (archive).
Security reports that should not be made immediately public can be sent directly to the maintainers. If there is no response to an urgent issue, you can escalate to the general security mailing list for advice.
Getting involved
Development of Libmicrohttpd, and GNU in general, is a volunteer effort, and you can contribute. For information, please read How to help GNU. If you'd like to get involved, it's a good idea to join the discussion mailing list (see above).
- Development
- Known bugs and open feature requests are tracked in our bugtracker. You need to sign up for a reporter account. Please make sure you report bugs under libmicrohttpd and not under any of the other projects.
- Git access
-
You can access the current development version of libmicrohttpd using
$ git clone https://git.gnunet.org/libmicrohttpd.git
Quick Introduction
- Dependencies
-
GNU Libmicrohttpd can be used without any dependencies; however,
for TLS (HTTPS) support it require
libgnutls.
Furthermore, the testcases use libcurl. Some extended
testcases also use zzuf and socat (to simulate
clients that violate the HTTP protocols). You can compile and use
GNU Libmicrohttpd without installing
libgnutls,libcurl,zzuforsocat. - Threading modes
MHD_USE_THREAD_PER_CONNECTION. In this mode, MHD starts one
thread to listen on the port for new connections and then spawns a new
thread to handle each connection. This mode is great if the HTTP
server has hardly any state that is shared between connections (no
synchronization issues!) and may need to perform blocking operations
(such as extensive IO or running of code) to handle an individual
connection.
The second threading mode, MHD_USE_SELECT_INTERNALLY, uses
only a single thread to handle listening on the port and processing of
requests. This mode is preferable if spawning a thread for each
connection would be costly. If the HTTP server is able to quickly
produce responses without much computational overhead for each
connection, this mode can be a great choice. Note that MHD will
still start a single thread for itself – this way, the main program
can continue with its operations after calling MHD_daemon_start.
Naturally, if the HTTP server needs to interact with
shared state in the main application, synchronization will be
required. If such synchronization in code providing a response
results in blocking, all HTTP server operations on all connections
will stall. This mode is a bad choice if response data (for responses
generated using the MHD_create_response_from_callback
function) cannot always be provided instantly. The reason is that the
code generating responses should not block (since that would block all
other connections) and on the other hand, if response data is not
available immediately, MHD will start to busy wait on it. Use the
first mode if you want to block on providing response data in the
callback, or the last mode if you want to use a more event-driven
mode with one big select loop.
The third mode combines a thread pool with
the MHD_USE_SELECT_INTERNALLY mode, which can benefit
implementations that require scalability. As said before, by default
this mode only uses a single thread. When combined with the thread pool option, it
is possible to handle multiple connections with multiple threads. The
number of threads is specified using the
MHD_OPTION_THREAD_POOL_SIZE; any value greater than one for
this option will activate the use of the thread pool. In contrast to
the MHD_USE_THREAD_PER_CONNECTION mode (where each thread
handles one and only one connection), threads in the pool can handle a
large number of concurrent connections. Using
MHD_USE_SELECT_INTERNALLY in combination with a thread pool
is typically the most scalable (but also hardest to debug) mode of
operation for MHD.
The fourth threading mode (used when no specific flag is given), uses
no threads. Instead, the main application must (periodically) request
file descriptor sets from MHD, perform a select call and then call
MHD_run. MHD_run will then process HTTP requests as
usual and return. MHD_run is guaranteed to not block;
however, access handlers and response processing callbacks that it
invokes may block. This mode is useful if a single-threaded
implementation is desired and in particular if the main application
already uses a select loop for its processing. If the application is
not ready to provide a response, it can just return zero for the
number of bytes read and use its file descriptors in the external
select loop to wake up and continue once the data is ready – MHD will
unlist the socket from the write set if the application failed to
provide response data (this only happens in this mode).
The testcases provided include examples for using each of the threading modes.
struct MHD_Response
objects. A response consists of a set of HTTP headers and a (possibly
empty) body. The three main ways to create a response are either by
specifying a given (fixed-size) body
(MHD_create_response_from_data), by providing a function of
type MHD_ContentReaderCallback which provides portions of the
response as needed or by providing an open file descriptor
(MHD_create_response_from_fd). The first response
construction is great for small and in particular static webpages that
fit into memory. The second response type should be used for response
objects where the size is initially not known or where the response
maybe too large to fit into memory. Finally, using a file descriptor
can be used on Linux systems to use the highly efficient
sendfile call for the file transfer.
A response is used by calling MHD_queue_response which sends
the response back to the client on the specified connection. Once
created, a response object can be used any number of times.
Internally, each response uses a reference counter. The response is
freed once the reference counter reaches zero. The HTTP server should
call MHD_destroy_response when a response object is no longer
needed, that is, the server will not call MHD_queue_response
again using this response object. Note that this does not mean that
the response will be immediately destroyed – destruction may be
delayed until sending of the response is complete on all connections
that have the response in the queue.
MHD_queue_response will fail (and return
MHD_NO).
The callback function for the respective URL will be called at least
twice. The first call happens after the server has received the
headers. The client should use the last void** argument to
store internal context for the session. The first call to the
callback function is mostly for this type of initialization and for
internal access checks. At least, the callback function should
"remember" that the first call with just the headers has
happened. Queueing a response during the first call (for a given
connection) should only be used for errors – if the client queues a
response during this first call, a "100 CONTINUE" response will
be suppressed, the request body will not be read and the connection
will be closed after sending the response. After the first call, the
callback function will be called with upload data. Until
*upload_data_size is zero, the callback may not queue a
response, any such attempt will fail. The callback function should
update *upload_data_size to indicate how many bytes were
processed. Depending on available buffer space, incremental
processing of the upload maybe required. Once all of the upload data
has been processed, MHD will call the callback a second time with
*upload_data_size being zero. At this point, the callback
should queue a "normal" response. If queueing a response is
not possible, the callback may either block or simply not queue a
response depending on the threading mode that is used. If the
callback does not queue a response at this point, MHD will either
(eventually) timeout the connection or keep calling it.
Cloudflare-Subdomain-Registrar
A PHP Program For Subdomain Registeration And Management Based On Cloudflare DNS.
- Edit NS Record Record
- Program setup script
- Account Status (ability to suspend/cancel accounts)
- Domain Name Status (ability to require registerations to be approved, suspend/cancel sub-domains)
- Better Admin panel: Edit NS Record for specific sub-domain, etc.
PLEASE READ AND FOLLOW THE STEPS CAREFULLY.
Create a MySQL database in your server, and import cloudflareNIC.sql. Make sure to take note of your database name, username and password.
Update the following constants with your database credentials:
define('DB_HOST', 'your-database-host'); // e.g. localhost
define('DB_USER', 'your-database-username');
define('DB_PASS', 'your-database-password');
define('DB_NAME', 'your-database-name');Replace the following with your domain details:
define('DOMAIN_NAME', 'example.com'); // Lowercase version
define('DOMAIN_NAME_UP', 'EXAMPLE.COM'); // Uppercase version
define('REGISTRAR_DOMAIN', 'registrar.example.com'); // Domain of the registrar systemCreate a scoped API token with permissions for DNS:Read and DNS:Edit for your domain.
define('CLOUDFLARE_API_KEY', 'your-cloudflare-api-token');
define('CLOUDFLARE_ZONE_ID', 'your-cloudflare-zone-id');Get API Token From Cloudflare dashboard. Find your zone ID on the Overview tab for your domain in the Cloudflare dashboard.
Set up HCaptcha for bot protection.
define('HCAPTCHA_SITE_KEY', 'your-hcaptcha-site-key');
define('HCAPTCHA_SECRET', 'your-hcaptcha-secret-key');Get these from your hCaptcha dashboard.
Enable OAuth on Google Cloud Console and get your credentials.
A more detailed guide is available at Setting Up Google Login
Follow the guide up until step 1 in the guide, you will have all of the informations you need for this step.
define('GOOGLE_CLIENT_ID', 'your-google-client-id');
define('GOOGLE_CLIENT_SECRET', 'your-google-client-secret');Use a redirect URI like:
https://your-registrar-domain.com/oauth_callback.php
You need to manually update the MySQL entry once you logged in with your Google account, change the role field of your user record from user to admin. After this step, log out and log back in you will be able to access the Admin panel.
from https://github.com/KevvTheGoat/Cloudflare-Subdomain-Registrar