YMH DocHub

website·Indexed 29 days ago

https://ymh-dochub.pages.dev/

A collection of technical guides and API documentation covering topics such as the Genshin Impact Good Words API, Bilibili follower tracking via Kingsoft Docs, GitHub Pages website deployment, Minecraft multiplayer setup, and FRP service comparisons.

Tokens
2.4K
Snippets
5
Records
12
Agent score
74%

What's inside YMH DocHub

  1. Host a personal website using GitHub Pages

    To host a free personal website on GitHub Pages, you must create a public repository with a specific naming convention: <username>.github.io (where <username> is your GitHub username). This specific naming ensures the website is accessible at the domain https://<username>.github.io.

    Steps to set up the site:

    1. Create a public repository named <username>.github.io.
    2. Create a file named index.html in the root directory. This file is required as the entry point for the website.
    3. Configure the deployment in GitHub Settings: Navigate to Settings > Pages, under 'Build and deployment', change the source from None to the branch containing your files (e.g., main), and ensure the folder is set to /(root). Save the changes and wait approximately one minute for the site to deploy.
    <!DOCTYPE html>
    <html>
    <body>
    <h1 >Hello World</h1>
    <p>这是一个使用 GitHub Pages的网站</p>
    </body>
    </html>
  2. Compare free FRP (Fast Reverse Proxy) service providers

    A comparison of various free FRP service providers based on data traffic, bandwidth, tunnel limits, and real-name authentication requirements:

    • LoCyanFrp: Offers traffic via check-ins; bandwidth depends on the assigned node; unlimited tunnels; requires real-name authentication.
    • OpenFrp: Offers 1024 - 4096 MiB traffic via check-ins; 12 Mbps upload/download for free users; limit of 4 tunnels; requires real-name authentication.
    • ME Frp: Offers traffic via check-ins; 30 Mbps bandwidth after real-name authentication; real-name authentication is optional/conditional.
    • 花生壳 (Oray/PeanutShell): 1 GB monthly traffic limit; 1 Mbps bandwidth for free users; limit of 2 tunnels; requires real-name authentication.
  3. Integrate Genshin Good Words API via CDN script

    Quickly integrate the Genshin Good Words API into your project by including a pre-made script and a target div with the ID ys. Multiple CDN options are available depending on your preference for reliability and speed.
    <!-- Target element for the quote -->
    <div id="ys"></div>
    
    <!-- Choose ONE of the following script sources -->
    
    <!-- Option 1: unpkg (Recommended) -->
    <script src="https://unpkg.com/genshin-good-words/script_npm.js"></script>
    
    <!-- Option 2: jsDelivr -->
    <script src="https://cdn.jsdelivr.net/gh/ymh0000123/Genshin-Good-words@main/script_jsdelivr.js"></script>
    
    <!-- Option 3: GitHub Pages -->
    <script src="https://ymh0000123.github.io/Genshin-Good-words/script.js"></script>
    
    <!-- Option 4: github.moeyy.xyz -->
    <script src="https://github.moeyy.xyz/https://raw.githubusercontent.com/ymh0000123/Genshin-Good-words/main/script.js"></script>
  4. Use LoCyanFrp for Minecraft intranet penetration

    LoCyanFrp allows players to expose their local Minecraft server to the internet. Note that real-name authentication is required after registration to use the service.

    Steps to configure:

    1. Create a Tunnel: Visit the LoCyanFrp website, go to 'Tunnel Operations' > 'Add Tunnel'.
    2. Select Node: Choose a node closest to your physical location to minimize latency.
    3. Configure Tunnel:
      • Tunnel Name: Any name.
      • Protocol: Select TCP for the Java Edition.
      • Local Port: The port currently used by the Minecraft game.
      • Remote Port: Use a random port generated by the system.
    4. Start Client: In 'Tunnel List', use the 'One-click Start' button to install and run the LoCyanFrp client.
    5. Join Game: In Minecraft, go to 'Multiplayer' > 'Server' and enter the Remote Port provided by LoCyanFrp to join.
  5. Set up Bilibili follower tracking script in KDocs

    To implement the Bilibili follower tracking script, follow these steps:

    1. Log in to the KDocs official website.
    2. Create a new Office Document -> Spreadsheet -> Blank Spreadsheet.
    3. Navigate to Efficiency (效率) -> Advanced Development (高级开发) -> AirScript Script Editor (AirScript脚本编辑器).
    4. Click Create Script (创建脚本) -> Document Shared Script (文档共享脚本).
    5. Paste the provided JavaScript code into the editor.
    6. Configure the required parameters in the spreadsheet cells (G2 through G10) as per the template.
    7. (Optional) To automate the process, go to Efficiency (效率) -> Advanced Development (高级开发) -> Scheduled Tasks (定时任务) to set a trigger frequency.
  6. Automatically track Bilibili followers using KDocs AirScript

    You can automate the tracking of Bilibili follower counts by creating a script in Kingsoft Docs (KDocs). The process involves creating a spreadsheet, using the AirScript editor to implement a script that calls the Bilibili API, and optionally setting up a scheduled task for periodic updates.
    let fs;
    let smtp_host = Application.Range("G2").Text;
    let smtp_port = parseInt(Application.Range("G3").Text);
    let smtp_username = Application.Range("G4").Text;
    let smtp_password = Application.Range("G5").Text;
    let smtp_secure = Application.Range("G6").Text.toLowerCase() === "true";
    let smtp_to = Application.Range("G7").Text;
    let blibli_uid = parseInt(Application.Range("G8").Text);
    let config_message = Application.Range("G9").Text;
    let config_message_send = Application.Range("G10").Text;
    
    // Fetch follower count from Bilibili API
    let url = "https://api.bilibili.com/x/relation/stat?vmid=" + blibli_uid;
    let resp = HTTP.get(url);
    
    if (resp.status !== 200) {
      throw new Error("Error! Status is " + resp.status());
    }
    
    let data = resp.json();
    
    if (data.code === 0) {
      let follower = data.data.follower;
      let sheet = Application.ActiveSheet;
    
      // Find first empty cell in column B to record follower count
      let row = 1;
      while (sheet.Range('B' + row).Value !== "") {
        row++;
      }
      
      var currentDate = new Date();
      var options = { timeZone: 'Asia/Shanghai' };
      var chinaTime = currentDate.toLocaleDateString('en-US', options);
    
      sheet.Range('A' + row).Value = chinaTime;
      sheet.Range('B' + row).Value = follower;
      fs = follower;
      
      // Calculate difference from previous record
      let lastRow = row;
      if (lastRow >= 2) {
        let lastFollower = sheet.Range('B' + (lastRow - 1)).Value;
        let diff = fs - lastFollower;
        zj = diff;
        if (config_message_send == "是") {
          if (diff == 0) {
            if (config_message == "是") {
              smtp_message();
            }
          } else {
            smtp_message();
          }
        }
      }
    } else {
      console.error("API response error: " + data.message);
    }
    
    function smtp_message() {
      let mailer = SMTP.login({
        host: smtp_host,
        port: smtp_port,
        username: smtp_username,
        password: smtp_password,
        secure: smtp_secure,
      });
    
      mailer.send({
        from: smtp_username,
        to: smtp_to,
        subject: "粉丝数通知",
        html: `...` // HTML content for email notification
      });
    }
  7. Connect to Minecraft via Local Area Network (LAN)

    For players on the same local network, multiplayer connectivity is typically automatic. Navigate to 'Multiplayer' in the Minecraft main menu, and the available local games should appear automatically (excluding dedicated servers).
  8. Connect to Minecraft using IPv6

    Direct IPv6 connectivity is a viable option for multiplayer if both the host and the client have valid IPv6 addresses.

    Requirements:

    • Both parties must have a functional IPv6 address; otherwise, the connection will fail.
    • You can verify your IPv6 status using test-ipv6.com. A score of 10/10 is ideal.
  9. Use Tailscale for Minecraft multiplayer connectivity

    Tailscale creates a secure virtual network between devices, allowing them to connect as if they were on the same LAN.

    Steps to configure:

    1. Register and log in to Tailscale.
    2. Download and install the client from the official website.
    3. Log in via the system tray icon.
    4. Share Device: In the Tailscale admin panel, find your device, click the '...' menu, and select 'Share' to invite friends.
    5. Join Game: Once the friend has added the device, open Minecraft, go to 'Multiplayer' > 'Server', and enter the shared device's Tailscale IP address to join.

    Warning: Do not share the invitation link with strangers, as it may grant access to other ports on your device.

  10. Configure parameters for Bilibili follower script

    The AirScript for Bilibili follower tracking reads configuration from specific cells in the active sheet. Ensure the following values are entered in the corresponding cells:

    CellParameterDescription
    G2smtp_hostSMTP server host
    G3smtp_portSMTP server port
    G4smtp_usernameSMTP username/email
    G5smtp_passwordSMTP password/app password
    G6smtp_secureSet to true or false for secure connection
    G7smtp_toRecipient email address
    G8blibli_uidThe Bilibili User ID (UID) to track
    G9config_messageSet to 是 to send notification even if follower count hasn't changed
    G10config_message_sendSet to 是 to enable email notifications

    Data is recorded in Column A (Date) and Column B (Follower Count).

  11. Genshin Good Words API endpoint mirrors

    The Good-words.txt data file can be accessed through the following endpoints for manual fetching or custom implementations:
    unpkg: https://unpkg.com/genshin-good-words/Good-words.txt
    GitHub Pages: https://ymh0000123.github.io/Genshin-Good-words/Good-words.txt
    jsDelivr: https://cdn.jsdelivr.net/gh/ymh0000123/Genshin-Good-words@master/Good-words.txt
  12. Fetch random Genshin Impact quotes using JavaScript

    You can retrieve a random quote from the Genshin Good Words API by fetching the Good-words.txt file from one of the available mirrors, splitting the text by newlines, and selecting a random line. The API is available via unpkg, GitHub Pages, and jsDelivr.
    // HTML: <div id="ys"></div>
    
    // Example using unpkg mirror
    fetch('https://unpkg.com/genshin-good-words/Good-words.txt')
      .then(response => response.text())
      .then(data => {
        const lines = data.split('\n');
        const randomLine = lines[Math.floor(Math.random() * lines.length)];
        document.getElementById('ys').innerText = randomLine;
      })
      .catch(error => {
        console.error('Error fetching ys:', error);
      });