树洞剪藏#剪藏#树洞剪藏

domainkeeper/index.js at main · ypq123456789/domainkeeper

2024 年 12 月 8 日1 分钟
分享Twitter / XTelegram微博
domainkeeper/index.js at main · ypq123456789/domainkeeper 封面

同步来源:树洞剪藏 源站剪藏 ID:256 原文地址:https://github.com/ypq123456789/domainkeeper/blob/main/index.js

打开原文 · 打开源站剪藏快照


domainkeeper/index.js at main · ypq123456789/domainkeeper / /blob/show" data-turbo-transient=true>

Skip to content

Navigation Menu

ypq123456789

/

domainkeeper

Type / to search

Create new...

Issues

Pull requests

You have unread notifications

Code

Issues 1

Pull requests 0

Actions

Projects 0

Security

Insights

Additional navigation options

{{ message }}

Open in github.dev ,>" target=_blank rel="noopener noreferrer">Open in a new github.dev tab Open in codespace

Files

main

t

README.md

domainkeeper.js

index.js

Breadcrumbs domainkeeper / index.js

Latest commit

ypq123456789

Create index.js

8f256a0 · 5 months ago Jul 8, 2024

History History

File metadata and controls

Code

Blame

162 lines (155 loc) · 4.36 KB Code 55% faster with GitHub Copilot " data-hotkey-scope=read-only-cursor-text-area class=sf-hidden> " class=sf-hidden>

Raw ,>"> ,>" class=sf-hidden>

// 自定义标题 const CUSTOM_TITLE = "我的域名管理";

// 域名信息 const DOMAINS = [ { domain: "example.com", registrationDate: "2022-01-01", expirationDate: "2027-01-01", system: "Cloudflare" }, { domain: "example.org", registrationDate: "2021-06-15", expirationDate: "2026-06-15", system: "GoDaddy" }, { domain: "example.net", registrationDate: "2021-06-15", expirationDate: "2024-06-15", system: "GoDaddy" }, // 在这里添加更多域名 ];

addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)) });

async function handleRequest(request) { return new Response(generateHTML(), { headers: { 'Content-Type': 'text/html' }, }); }

function generateHTML() { const rows = DOMAINS.map(info => { const registrationDate = new Date(info.registrationDate); const expirationDate = new Date(info.expirationDate); const today = new Date(); const totalDays = (expirationDate - registrationDate) / (1000 * 60 * 60 * 24); const daysElapsed = (today - registrationDate) / (1000 * 60 * 60 * 24); const progressPercentage = Math.min(100, Math.max(0, (daysElapsed / totalDays) * 100)); const daysRemaining = Math.ceil((expirationDate - today) / (1000 * 60 * 60 * 24));

// 判断域名是否过期 const isExpired = today > expirationDate; const statusColor = isExpired ? '#e74c3c' : '#2ecc71'; const statusText = isExpired ? '已过期' : '正常';

return `

return `

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

17 18 19 20 21 22

23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162

// 自定义标题

const CUSTOM_TITLE = "我的域名管理" ;

// 域名信息

const DOMAINS = [

{ domain : "example.com" , registrationDate : "2022-01-01" , expirationDate : "2027-01-01" , system : "Cloudflare" } ,

{ domain : "example.org" , registrationDate : "2021-06-15" , expirationDate : "2026-06-15" , system : "GoDaddy" } ,

{ domain : "example.net" , registrationDate : "2021-06-15" , expirationDate : "2024-06-15" , system : "GoDaddy" } ,

// 在这里添加更多域名

] ;

addEventListener ( 'fetch' , event => {

event . respondWith ( handleRequest ( event . request ) )

} ) ;

async function handleRequest ( request ) {

return new Response ( generateHTML ( ) , {

headers : { 'Content-Type' : 'text/html' } ,

} ) ;

}

function generateHTML ( ) {

const rows = DOMAINS . map ( info => {

const registrationDate = new Date ( info . registrationDate ) ;

const expirationDate = new Date ( info . expirationDate ) ;

const today = new Date ( ) ;

const totalDays = ( expirationDate - registrationDate ) / ( 1000 * 60 * 60 * 24 ) ;

const daysElapsed = ( today - registrationDate ) / ( 1000 * 60 * 60 * 24 ) ;

const progressPercentage = Math . min ( 100 , Math . max ( 0 , ( daysElapsed / totalDays ) * 100 ) ) ;

const daysRemaining = Math . ceil ( ( expirationDate - today ) / ( 1000 * 60 * 60 * 24 ) ) ;

// 判断域名是否过期

const isExpired = today > expirationDate ;

const statusColor = isExpired ? '#e74c3c' : '#2ecc71' ;

const statusText = isExpired ? '已过期' : '正常' ;

return `

` ;

} ) . join ( '' ) ;

return `

${ rows }

powered by domainkeeper v1.1.0 | 作者:bacon159

` ;

}

Symbols Find definitions and references for functions and other symbols in this file by clicking a symbol below or in the code. r

func handleRequest

func generateHTML

You can’t perform that action at this time.

set 限制解除

domainkeeper/index.js at main · ypq123456789/domainkeeper

IP检测信息 刷新IP信息 展开信息 查询IP

展开信息

相关文章