npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mofh-client-js

v2.0.1

Published

A MyOwnFreeHost client that you can use with server-side javascript

Downloads

6

Readme

MOFH-Client

npm bundle size

A MyOwnFreeHost client that you can use with server-side javascript.

Install

With npm:

npm install mofh-client

configure mofh-client

In a .env file in main directory of project enter your mofh api user and mofh api key, which you can find here.

mofh_api_user='your-mofh-api-user'
mofh_api_key='your-mofh-api-key'

You will also need to set the IP your code is running on inside the panel (linked above) to be allowed to call the MOFH API.

Usage

create an account on MOFH:

const createAccount: (username: string, password: string, email: string, domain: string, plan: string) => any
  • asynchronous

  • @param username — A unique, 8 character identifier of the account.

  • @param password — their password to login to the control panel, FTP and databases.

  • @param email — their email.

  • @param domain — their domain. Can be a subdomain or a custom domain.

  • @param plan — the hosting plan to create the account on. Requires a hosting package to be configured through MyOwnFreeHost.

  • @returns — json: "success": whether or not you should be showing the response to the user. "message": { "status": 1 or 0 depending on success, "statusmsg": the response of the request, "vpusername": their vistapanel username if success, }. "error": the error, if there is one

Example:

//returns '{"success": true, "message": 1, "error": ''}'
const mofh = require('mofh-client');
console.log(mofh.createAccount('username', 'password', '[email protected]', 'valid.domain.com', 'freeplan01'));

Get a list of a user's domains:

const getUserDomains: (username: string) => any
  • asynchronous

  • @param username — The unique, 8 character identifier of the account.

  • @returns — json: "success": whether or not you should be showing the response to the user. "message": either be empty array (i.e. an error occured or no domains found) or contain array of websites in the form of [["status e.g. ACTIVE", "the url"], etc.]. "error": the error, if there is one

Example:

//returns '{"success": true, "message": [["status e.g. ACTIVE", "the url"], etc.], "error": ''}'
const mofh = require('mofh-client');
console.log(mofh.getUserDomains('validusername'));

Get availability of a domain:

const getAvailability: (domain: string) => any
  • asynchronous

  • @param domain — The domain name or subdomain to check.

  • @returns — json: "success": whether or not you should be showing the response to the user. "message": either be 0 (not available/failed to check) or 1 (available+succeeded). "error": the error, if there is one

Example:

//returns '{"success": true, "message": 1, "error": ''}'
const mofh = require('mofh-client');
console.log(mofh.getUserDomains('valid.domain.com'));

Reset a User's Password:

const resetPassword: (username: string, password: string) => any
  • asynchronous

  • @param username — The unique, 8 character identifier of the account.

  • @param password — their new password

  • @returns — json: "success": whether or not you should be showing the response to the user. "message": { "status": 1 or 0 depending on success, "statusmsg": 'Success' or error containing response and letter x for suspended, r for reactivating, and c for closing,}. "error": the error, if there is one

Example:

//returns '{"success": true, "message": 1, "error": ''}'
const mofh = require('mofh-client');
console.log(mofh.resetPassword('username', 'newpassword'));

Suspend an Account:

const suspendAccount: (username: string, reason: string) => any
  • asynchronous

  • @param username — The unique, 8 character identifier of the account.

  • @param reason — Information about why you are suspending the account. at least 5 chars long.

  • @returns — json: "success": whether or not you should be showing the response to the user. "message": { "status": 1 or 0 depending on success, "statusmsg": non existant if success, error response if fail}. "error": the error, if there is one

Example:

//returns '{"success": true, "message": 1, "error": ''}'
const mofh = require('mofh-client');
console.log(mofh.suspendAccount('username', 'innapropriate content'));

Unsuspend an Account:

const unsuspendAccount: (username: string) => any
  • asynchronous

  • @param username — The unique, 8 character identifier of the account.

  • @returns — json: "success": whether or not you should be showing the response to the user. "message": { "status": 1 or 0 depending on success, "statusmsg": non existant if success, error response if fail}. "error": the error, if there is one

Example:

//returns '{"success": true, "message": 1, "error": ''}'
const mofh = require('mofh-client');
console.log(mofh.suspendAccount('username', 'innapropriate content'));

License

Licensed under the MIT License