DocHub Course Tutorials

website·Indexed 32 days ago

https://io.xiao-feishu.top/dochub/

A collection of technical guides and tutorials covering topics such as GitHub Pages website hosting, Minecraft multiplayer setup, FRP comparisons, Bilibili fan tracking via Kingsoft Docs, and the Genshin Good Words API.

Tokens
2.2K
Snippets
6
Records
12
Agent score
50%

What's inside DocHub

  1. Use Tailscale for Minecraft multiplayer connectivity

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

    Setup process:

    1. Register and log in at the Tailscale official website.
    2. Download and install the client for your operating system.
    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 > Multiplayer > Server and enter the shared device's Tailscale IP address.

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

  2. Host a personal website using GitHub Pages

    To create a free personal website hosted by GitHub, 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 site is served at the domain https://<username>.github.io.
  3. Create the entry point for a GitHub Pages site

    To make your website accessible, you must create a file named index.html in the root directory of your repository. The filename index.html is mandatory; otherwise, the site will not load automatically.
    <!DOCTYPE html>
    <html>
    <body>
    <h1 >Hello World</h1>
    <p>这是一个使用 GitHub Pages的网站</p>
    </body>
    </html>
  4. Automatically track Bilibili followers using Kdocs AirScript

    You can automate the tracking of Bilibili follower counts by using a Kdocs spreadsheet and an AirScript script. The script fetches follower data from the Bilibili API, logs the date and count into the spreadsheet, calculates the difference from the previous entry, and optionally sends an email notification via SMTP.

    Setup Steps:

    1. Create a new Office Spreadsheet in Kdocs.
    2. Navigate to Efficiency (效率) -> Advanced Development (高级开发) -> AirScript Script Editor (AirScript脚本编辑器).
    3. Create a Document Shared Script (文档共享脚本) and paste the provided script.
    4. Configure the required parameters in the spreadsheet cells (refer to the script's Application.Range calls).
    5. (Optional) To automate data collection, set up a schedule in Efficiency (效率) -> Advanced Development (高级开发) -> Scheduled Tasks (定时任务).
    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 Bilibili follower stats
    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 log data
      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: `<div>...Bilibili Follower Notification...</div>`,
      });
    }
  5. Use LoCyanFrp for Minecraft intranet penetration

    LoCyanFrp allows players to host a game accessible over the internet by mapping a local port to a remote port. Note that real-name authentication is required after registration to use the service.

    Steps to configure:

    1. Create a Tunnel: On the LoCyanFrp website, go to 'Tunnel Operations' > 'Add Tunnel'.
      • Node: Select the node closest to you to minimize latency.
      • 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.
    2. Start Client: In 'Tunnel List', use the 'One-click Start' button to install and launch the LoCyanFrp client.
    3. Join Game: In Minecraft, go to Multiplayer > Server and enter the Remote Port provided by LoCyanFrp.
    Protocol: TCP (Java Edition)
    Local Port: [Your Game Port]
    Remote Port: [Assigned by LoCyanFrp]
  6. Compare free FRP (Fast Reverse Proxy) service providers

    A comparison of various free FRP providers based on traffic limits, bandwidth, tunnel capacity, and identity verification requirements. Key providers include LoCyanFrp, OpenFrp, ME Frp, and PeanutHull (花生壳).
    ProviderTrafficBandwidthTunnel LimitReal-name Auth
    LoCyanFrpEarned via check-inBased on node allocationUnlimitedYes
    OpenFrp1024 - 4096 MiB via check-in12 Mbps (Up/Down)4Yes
    ME FrpEarned via check-in30 Mbps after authUnknownYes/No
    PeanutHull1 GB per month1 Mbps2Yes
  7. Integrate Genshin Good Words via CDN script

    For a quicker setup, you can include a pre-written script via CDN. Ensure you have an HTML element with id="ys" in your page for the script to target.
    <div id="ys"></div>
    
    <!-- Choose one of the following script sources -->
    
    <!-- unpkg -->
    <script src="https://unpkg.com/genshin-good-words/script_npm.js"></script>
    
    <!-- jsDelivr -->
    <script src="https://cdn.jsdelivr.net/gh/ymh0000123/Genshin-Good-words@main/script_jsdelivr.js"></script>
    
    <!-- GitHub Pages -->
    <script src="https://ymh0000123.github.io/Genshin-Good-words/script.js"></script>
    
    <!-- github.moeyy.xyz -->
    <script src="https://github.moeyy.xyz/https://raw.githubusercontent.com/ymh0000123/Genshin-Good-words/main/script.js"></script>
  8. Configure GitHub Pages deployment settings

    To activate the website deployment, navigate to the repository's Settings > Pages. Under the 'Build and deployment' section, change the source from None to the branch containing your files (e.g., main), select /(root) as the folder, and click Save. The site will typically be live within one minute.
  9. Configure Bilibili Tracker spreadsheet parameters

    The Bilibili follower tracking script relies on specific cells in the active Kdocs spreadsheet for its configuration. Ensure the following values are entered in the corresponding cells:

    CellParameterDescription
    G2smtp_hostSMTP server hostname
    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 when followers are unchanged
    G10config_message_sendSet to 是 to enable email notifications

    Data is logged into Column A (Date) and Column B (Follower Count).

  10. Fetch a random Genshin Impact quote using JavaScript

    You can retrieve a random quote by fetching the Good-words.txt file from various CDNs, splitting the content by newlines, and selecting a random line. This method gives you full control over how the quote is displayed in your HTML.
    <div id="ys"></div>
    // Example using unpkg (Recommended)
    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);
      });
    
    // Alternative endpoints:
    // 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