🌒MoonLab

> 在MoonLab中搜索

  1. 1. Moon Counter
  2. 2. Rule34 Theme Preview:
  3. 3. Moebooru Preview
  4. 4. This Page Views
  5. 5. Project repo
  6. 6. Admin panel
  • Public Counter
    1. 1. Image Counter
    2. 2. Text Counter
  • Self Host
  • Configuration
  • Philosophy
  • Credits

    MoonCounter - 快速安全的网站流量计数器

    Category: Project

    🏷️  golang   中文

    Moon Counter

    A fast, simple & easy-to-use webpage visitor counter, but not only limited to websites.

    🔒 CORS 支持

    With a visual admin panel

    text & image output

    Rule34 Theme Preview:

    rule34

    Moebooru Preview

    moobooru

    This Page Views

    Project repo

    HelloLingC/moon-counter: A fast, simple & powerful website visitor counter written with Golang (github.com)

    Admin panel

    Preview at https://counter.moonlab.top/admin. The password is 123456.

    Public Counter

    You can use my MoonCounter instance as you want. But I don’t have responsibility for its stablility. In fact, no one does. But as long as this website continues, the counter service is always public.
    But i still recommand you self-host your owned service.

    Ofc, the use of my service is prohibited for illegal websites.

    Image Counter

    Replace the UniqueID parameter with the webpage’s url. At least it must be unique to identify your page.

    ![](https:///counter.moonlab.top/counter/img?id=UniqueID)
    
    <img src="//counter.moonlab.top/counter/img?id=UniqueID"></img>

    If you don’t wanna handle UniqueID by yourself, you can use this.

    <script src="//counter.moonlab.top/moon-counter/js/img"></script>
    <img id="moon-counter-img"></img>

    It will automatically handle the id param. You can just directly put it on your webpage to count.

    Text Counter

    And this will only output plain count text. You also don’t need to handle the uniqueid parameter by yourself.

    <script src="//counter.moonlab.top/moon-counter/js"></script>
    <span id="moon-counter"></span>

    Self Host

    Download the release file. Replace the following verison v0.0.1 with the latest version. You can get it from Github Release

    wget https://github.com/HelloLingC/moon-counter/releases/download/v0.0.1/moon-counter-v0.0.1-linux-amd64.tar.gz

    Decompress.

    tar -xf moon-counter-v0.0.1-linux-amd64.tar.gz

    Configure >> Configuration Details

    vi config.yaml

    Configure daemon process. This is a service template for systemd

    [Unit]
    Description=Moon Counter service
    Wants=network.target
    After=network.target network.service
    
    [Service]
    Type=simple
    WorkingDirectory=/opt/counter
    ExecStart=/opt/counter/moon-counter
    KillMode=process

    Configure reverse proxy. This is a template for nginx

    server {
    	listen 80;
    	server_name counter.moonlab.top
    	location {
    		proxy_pass http://127.0.0.1:3800
    		proxy_pass_request_headers on;
    	}
    }

    Configuration

    You can use -c to specify the path of config file, eg: moon-counter -c custom.yml
    By default, the configuration file is named as config.yaml, which is located in the root directory of the program’s binary file.

    host: counter.moonlab.top
    listen: 3800
    img_theme: rule34
    cors: true
    hostnames:
      - moonlab.top
    
    error_log: error.log
    
    db:
      type: sqlite
      dbname: moon.db
      host:
      username:
      password:
      
    admin:
      enable: false
      path: /admin
      password:

    host - The counter server’s domain. If you don’t have a domain for your server, replace this with your external IP and server listening port. eg: 201.25.21.3:3800
    listen - The server listening port. It’s always better to use with reverse proxy.
    img_theme - The theme name for image mode. You can add your own theme under the assets folder. And modify this variable with your theme folder name.
    cors - CORS mode for security. Once enabled, others cannot use your counter server to tally views for their websites without your permission. And thus, hostnames is required. For more details about CORS, see Cross-Origin Resource Sharing (CORS) - HTTP | MDN (mozilla.org).
    hostnames - Only when cors is enabled. A array of allowed hostnames.
    error_log - currently not available

    db
    type - currently only support sqlite
    dbname - For SQLite, dbname is the filename.

    admin
    enable - Enable admin panel or not. If admin panel is not enabled, the admin panel will disguise as 404 error page.
    path - The path to the admin panel. You must set a random string for it, instead of /admin.
    passphrase - You should use a generator to generate a random string, either passphrase or password. For passphrase generating, try Use a Passphrase.

    Philosophy

    Only Do One Thing For the Best

    Moon Couner is only for pageview counting.
    Your website will create a history and precious memories for you, and for this, A pageview counter is the best way to store it forever.

    If you’re looking for website analytics service, I recommand you GoatCounter – open source web analytics

    Credits

    The resources (images) used in MoonCounter are not owned by me. All the resources belong to their respective owners. I do NOT claim any ownership. USE AT YOUR OWN RISK.

    WARNING: NSFW Content. The following external links may contain NSFW content.

    Rule34 - Rule 34, if it exist there is porn of it.
    Moebooru = moebooru/app at master · moebooru/moebooru (github.com)

  • 2018-2024 MoonLab