
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
floating-button-plugin
Advanced tools
一个简单易用的浮动按钮插件,支持拖拽、自定义样式、位置记忆等功能。
npm install floating-button-plugin
import FloatingButton from 'floating-button-plugin';
const button = new FloatingButton({
text: '联系我们',
link: 'https://example.com'
});
const button = new FloatingButton({
text: '联系我们',
link: 'https://example.com',
position: 'bottom|right', // 支持 'top|left', 'right|center' 等灵活组合
offset: 20,
visible: true,
debug: false,
icon: {
type: 'url', // 'url' | 'base64' | 'fontawesome'
value: 'https://example.com/icon.png',
width: '20px',
height: '20px'
},
style: {
backgroundColor: '#42b983',
color: '#ffffff',
fontSize: '14px',
padding: '12px 24px',
borderRadius: '4px',
boxShadow: '0 2px 12px rgba(0,0,0,0.1)'
}
});
支持的位置组合:
top|left
: 左上角top|center
: 顶部中间top|right
: 右上角center|left
: 左侧中间center|center
: 正中心center|right
: 右侧中间bottom|left
: 左下角bottom|center
: 底部中间bottom|right
: 右下角const button = new FloatingButton({
text: '联系我们',
link: 'https://example.com',
position: 'center|right', // 右侧中间
offset: 20 // 距离边缘的偏移量
});
支持三种类型的图标:
const button = new FloatingButton({
text: '联系我们',
icon: {
type: 'url',
value: 'https://example.com/icon.png',
width: '20px', // 可选
height: '20px' // 可选
}
});
const button = new FloatingButton({
text: '联系我们',
icon: {
type: 'base64',
value: 'iVBORw0KGgoAAAANSUhEUgAA...', // Base64 图片编码
width: '20px',
height: '20px'
}
});
const button = new FloatingButton({
text: '联系我们',
icon: {
type: 'fontawesome',
value: 'fas fa-phone', // Font Awesome 类名
width: '16px' // 控制图标大小
}
});
Font Awesome 说明:
- 使用
fontawesome
类型时,插件会自动从 CDN 加载 Font Awesome 6.0.0- 无需手动安装或引入 Font Awesome 包
- 支持所有免费版图标,包括 Solid (
fas
)、Regular (far
) 和 Brands (fab
)- 图标名称可以在 Font Awesome 官网 查找
- 示例:
- 实心电话图标:
fas fa-phone
- 空心信封图标:
far fa-envelope
- GitHub 图标:
fab fa-github
// 显示按钮
button.show();
// 隐藏按钮
button.hide();
// 切换显示状态
button.setVisible(true | false);
// 销毁按钮
button.destroy();
开启调试模式可以在控制台查看按钮的操作日志:
const button = new FloatingButton({
text: '联系我们',
link: 'https://example.com',
debug: true // 开启调试模式
});
MIT
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.