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

@dead_fish/api

v1.0.15

Published

Public Api for Province、City、District, Short Link, 'jsapi-ticket', ip, send email, create poster, maintained for long-term free use

Downloads

62

Readme

npm install @dead_fish/api

| 接口名称 (方法名) | 说明 | 参数 | 参数说明 | | ---------------------------- | --------------------- | ---------------------------------------------------------------------- | -------------------------------------------------------------------------------- | | address/secure_address | 获取地址 (http/https) | 无 | 无 | | shortLink/secure_shortLink | 创建短链 (http/https) | {url: string, month?: number} | url: 需要转换的长链, month: 短链有效期(max: 24) | | ip/secure_ip | 获取 IP (http/https) | 无 | 无 | | sendEmail/secure_sendEmail | 发送邮件(http/https) | {email: string[], subject: string, title?: string, content?: string[]} | email: 收件人邮箱数组, subject: 邮件主题, title: 内容主题, content: 内容列表数组 | | poster/secure_poster | 生成海报 (http/https) | PosterBody | PosterBody: 包含海报信息的对象 |

海报报文信息

{
	data?: [
		url?: string // 图片地址
		x?: number // (图片|文字) x 坐标
		y?: number // (图片|文字) y 坐标
		width?: number // 图片 宽度
		height?: number // 图片 高度
		radius?: number // 图片 圆角
		rotate?: number // 图片 旋转角度
		referer?: string // 图片防盗链地址 如果此图片的防盗链和其他的不同,可以单独设置

		text?: string // 文字内容
		font?: string // 文字字体 (⚠️注意: 无法设置指定的字体,目前不支持设置字体,抱歉)
		color?: string // 文字颜色
		textAlign?: 'left' | 'center' | 'right' | 'start' | 'end' // 文字对齐方式
		textBaseline?: 'top' | 'middle' | 'bottom' | 'alphabetic' | 'hanging' // 文字基线
		lineGap?: number // 文字行间距
		maxWidth?: number // 文字最大宽度
		maxLine?: number // 文字最大行数 超出会出现 ... 省略号
	],
	canvas?: {
		width?: number // 画布宽度
		height?: number // 画布高度
		background?: string // 画布背景色
	},
	referer?: string // 防盗链地址(可选) 如果图片设置了防盗链并且所有图片 的防盗链相同,可以设置此属性
}

// 请求返回的数据是图片的 base64 编码

发送邮箱 案例:

import uApi from '@dead_fish/api'

const body = {
	email: ['[email protected]', '[email protected]'],
	subject: '重置验证',
	title: "<p style='text-align: center;'>重置密码验证码</p>",
	content: [
		"<p style='font-weight: 400;'>点击下方链接前往重置密码页面.</p>",
		"<a href='https://www.baidu.com'>重置密码</a>",
		"<span>验证码: <strong style='font-weight: 600;'>787321</strong></span>",
		'有效时长: 5分钟',
		"<p style='font-size: 14px; font-style: italic;'>如果你没有发起重置密码的操作,可以忽律这封邮件.</p>",
	],
}

uApi.sendEmail(body)
	.then((res) => {})
	.catch((error) => {})

生成海报 案例:

import uApi from '@dead_fish/api'

const body = {
	data: [
		{
			url: 'https://ik.imagekit.io/zhousuyang/prod/rox/bg13.jpg',
			x: 0,
			y: 0,
			width: 750,
			height: 750,
			rotate: 0,
		},
		{
			url: 'https://ik.imagekit.io/zhousuyang/prod/rox/my-miniprogram.jpg',
			x: 325,
			y: 325,
			width: 100,
			height: 100,
			radius: 50,
		},
		{
			url: 'https://ik.imagekit.io/zhousuyang/prod/rox/checkbox-active-icon.png',
			x: 100,
			y: 800,
			width: 60,
			height: 60,
			radius: 0,
		},
		{
			text: '春天一起去露营',
			x: 172,
			y: 794,
			font: '48px',
			color: 'green',
			rotate: 0,
		},
		{
			text: '我是个话题我是个话题我是个话题我是个话题 我是个话题我是个话题我是个话题我是个话题是个话题我是个话题我是个话题我是我是个话题我是个话题我是个话题我是个话题 我是个话题我是个话题我是个话题我是个话题是个话题我是个话题我是个话题我是我是个话题我是个话题我是个话题我是个话题 我是个话题我是个话题我是个话题我是个话题是个话题我是个话题我是个话题我是',
			x: 100,
			y: 960,
			font: '24px',
			maxWidth: 550,
			lineGap: 10,
			maxLine: 2,
		},
		{
			text: '我是个话题我是个话题我是个话题我是个话题 我是个话题我是个话题我是个话题我是个话题是个话题我是个话题我是个话题我是我是个话题我是个话题我是个话题我是个话题',
			x: 100,
			y: 1060,
			font: '24px',
			maxWidth: 550,
			lineGap: 10,
		},
		{
			url: 'https://ik.imagekit.io/zhousuyang/prod/rox/my-miniprogram.jpg',
			x: 325,
			y: 1260,
			width: 100,
			height: 100,
			radius: 50,
		},
		{
			text: '长按图片识别二维码阅读全部话题内容',
			x: 250,
			y: 1380,
			maxWidth: 250,
			font: '14px',
			color: '#ccc',
		},
	],
	canvas: {
		width: 750,
		height: 1460,
		background: '#ffffff',
	},
}

uApi.poster(body)
	.then((res) => {
		console.log(res.data)
	})
	.catch((error) => {})

ES

import uApi from '@dead_fish/api'

uApi.address().then((res) => {})

CommonJS

const uApi = require('@dead_fish/api')

uApi.address().then((res) => {})

Browser

<script src="./node_modules/@dead_fish/api/dist/bundle.umd.js"></script>
<script>
	const apis = window.pAips.uApi
	apis.address().then((res) => {})
</script>