PageSourceSearch

https://shepky.org/assets/WhitelistedIPs-MMlgnupk.js

js shepky.org collected 2026-10-05 19:55:08 UTC 2,388 bytes, 1 lines download raw bytes

1import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Bn as t,Ln as n,Zt as r,bn as i,cn as a,dr as o,en as s,hn as c,ln as l,nn as u,rn as d,tn as f,un as p}from"./antd-TBFhen-V.js";import{t as m}from"./react-vendor-CWnZMJzL.js";import{t as h}from"./adminService-CEhR7K84.js";var g=e(o(),1),_=m(),{Title:v}=r;function y(){let[e,r]=(0,g.useState)([]),[o,m]=(0,g.useState)(!1),[y,b]=(0,g.useState)(!1),[x]=i.useForm(),[S,C]=(0,g.useState)(!1),w=(0,g.useCallback)(async()=>{m(!0);try{let e=await h.getWhitelistedIPs();e.success&&r(e.data||[])}catch{}m(!1)},[]);(0,g.useEffect)(()=>{w()},[w]);let T=async()=>{try{let e=await x.validateFields();C(!0);let t=await h.whitelistIP(e);t.success?(p.success(`Đã thêm IP`),b(!1),x.resetFields(),w()):p.error(t.message||`Thất bại`)}catch{}C(!1)},E=async e=>{let t=await h.removeWhitelistedIP(e);t.success?(p.success(`Đã xóa`),w()):p.error(t.message||`Thất bại`)};return(0,_.jsxs)(`div`,{children:[(0,_.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16},children:[(0,_.jsx)(v,{level:4,style:{margin:0},children:`IP được phép`}),(0,_.jsx)(t,{type:`primary`,icon:(0,_.jsx)(n,{}),onClick:()=>{x.resetFields(),b(!0)},children:`Thêm IP`})]}),(0,_.jsx)(u,{columns:[{title:`IP`,dataIndex:`ip`,key:`ip`,width:180},{title:`Ghi chú`,dataIndex:`note`,key:`note`,width:250},{title:`Chỉ Admin`,dataIndex:`adminOnly`,key:`adminOnly`,width:100,render:e=>(0,_.jsx)(f,{color:e?`orange`:`blue`,children:e?`Admin`:`Tất cả`})},{title:`Ngày thêm`,dataIndex:`createdAt`,key:`createdAt`,width:160,render:e=>new Date(e).toLocaleString(`vi-VN`)},{title:`Thao tác`,key:`actions`,width:120,render:(e,n)=>(0,_.jsx)(a,{title:`Xóa IP này?`,onConfirm:()=>E(n._id),children:(0,_.jsx)(t,{type:`link`,danger:!0,icon:(0,_.jsx)(s,{}),children:`Xóa`})})}],dataSource:e,rowKey:`_id`,loading:o,scroll:{x:800},pagination:!1}),(0,_.jsx)(l,{title:`Thêm IP`,open:y,onOk:T,onCancel:()=>b(!1),confirmLoading:S,children:(0,_.jsxs)(i,{form:x,layout:`vertical`,children:[(0,_.jsx)(i.Item,{name:`ip`,label:`Địa chỉ IP`,rules:[{required:!0}],children:(0,_.jsx)(c,{placeholder:`VD: 192.168.1.1`})}),(0,_.jsx)(i.Item,{name:`note`,label:`Ghi chú`,children:(0,_.jsx)(c,{})}),(0,_.jsx)(i.Item,{name:`adminOnly`,label:`Chỉ Admin`,valuePropName:`checked`,children:(0,_.jsx)(d,{})})]})})]})}export{y as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.