feat: update web css and fix code lint
This commit is contained in:
@@ -117,7 +117,7 @@ const DingBotConfigPage = () => {
|
||||
value={config.access_token}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
className="block w-full px-3 py-2 placeholder-gray-400 border border-gray-300 rounded-md shadow-sm appearance-none focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
/>
|
||||
</div>
|
||||
<p className="mt-2 text-sm text-gray-500">
|
||||
@@ -137,7 +137,7 @@ const DingBotConfigPage = () => {
|
||||
value={config.secret_token}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
className="block w-full px-3 py-2 placeholder-gray-400 border border-gray-300 rounded-md shadow-sm appearance-none focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
/>
|
||||
</div>
|
||||
<p className="mt-2 text-sm text-gray-500">
|
||||
|
||||
@@ -65,24 +65,23 @@ const PluginListPage = () => {
|
||||
<p className="mt-1 text-sm text-gray-500">当前系统中没有配置任何插件。</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex flex-wrap -mx-4">
|
||||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{plugins.map((plugin) => (
|
||||
<div key={plugin.name} className="w-full px-4 mb-6 sm:w-1/2 lg:w-1/3">
|
||||
<div className="flex flex-col h-full overflow-hidden bg-white rounded-lg shadow">
|
||||
<div className="flex-1 px-4 py-5 sm:p-6">
|
||||
<div key={plugin.name} className="overflow-hidden bg-white rounded-lg shadow">
|
||||
<div className="p-4 sm:p-5">
|
||||
<div className="flex items-center">
|
||||
<div className="flex-shrink-0 p-3 bg-indigo-100 rounded-md">
|
||||
<svg className="w-6 h-6 text-indigo-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<div className="flex-shrink-0 p-2 bg-indigo-100 rounded-md">
|
||||
<svg className="w-5 h-5 text-indigo-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z" />
|
||||
</svg>
|
||||
</div>
|
||||
<div className="ml-4">
|
||||
<h3 className="text-lg font-medium text-gray-900">{plugin.display_name}</h3>
|
||||
<p className="text-sm text-gray-500">数据同步插件</p>
|
||||
<div className="ml-3">
|
||||
<h3 className="text-base font-medium text-gray-900">{plugin.display_name}</h3>
|
||||
<p className="text-xs text-gray-500">数据同步插件</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="px-4 py-4 sm:px-6">
|
||||
<div className="px-4 py-3 bg-gray-50 sm:px-5">
|
||||
<div className="flex justify-center">
|
||||
<a
|
||||
href={plugin.link}
|
||||
@@ -90,12 +89,11 @@ const PluginListPage = () => {
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center px-3 py-1 text-sm font-medium text-indigo-700 bg-indigo-100 border border-transparent rounded-md hover:bg-indigo-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
|
||||
>
|
||||
查看插件数据源
|
||||
查看数据源
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -67,8 +67,8 @@ const SyncDataTaskPage = () => {
|
||||
|
||||
return (
|
||||
<div className="max-w-3xl mx-auto">
|
||||
<div className="text-center mb-8">
|
||||
<h1 className="text-3xl font-extrabold text-gray-900 mb-2">
|
||||
<div className="mb-8 text-center">
|
||||
<h1 className="mb-2 text-3xl font-extrabold text-gray-900">
|
||||
数据同步任务配置
|
||||
</h1>
|
||||
<p className="text-gray-600">
|
||||
@@ -77,29 +77,29 @@ const SyncDataTaskPage = () => {
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<div className="bg-red-50 border border-red-200 rounded-md p-4 mb-6">
|
||||
<div className="text-red-800 text-sm">
|
||||
<div className="p-4 mb-6 border border-red-200 rounded-md bg-red-50">
|
||||
<div className="text-sm text-red-800">
|
||||
{error}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{success && (
|
||||
<div className="bg-green-50 border border-green-200 rounded-md p-4 mb-6">
|
||||
<div className="text-green-800 text-sm">
|
||||
<div className="p-4 mb-6 border border-green-200 rounded-md bg-green-50">
|
||||
<div className="text-sm text-green-800">
|
||||
{success}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{loading ? (
|
||||
<div className="flex justify-center items-center h-64">
|
||||
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600"></div>
|
||||
<div className="flex items-center justify-center h-64">
|
||||
<div className="w-12 h-12 border-b-2 border-indigo-600 rounded-full animate-spin"></div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="bg-white shadow overflow-hidden sm:rounded-lg">
|
||||
<div className="px-4 py-5 sm:px-6 border-b border-gray-200">
|
||||
<h2 className="text-lg leading-6 font-medium text-gray-900">
|
||||
<div className="overflow-hidden bg-white shadow sm:rounded-lg">
|
||||
<div className="px-4 py-5 border-b border-gray-200 sm:px-6">
|
||||
<h2 className="text-lg font-medium leading-6 text-gray-900">
|
||||
同步任务设置
|
||||
</h2>
|
||||
</div>
|
||||
@@ -117,7 +117,7 @@ const SyncDataTaskPage = () => {
|
||||
value={task.name}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md"
|
||||
className="block w-full px-3 py-2 placeholder-gray-400 border border-gray-300 rounded-md shadow-sm appearance-none focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -136,7 +136,7 @@ const SyncDataTaskPage = () => {
|
||||
value={task.interval_minutes}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md"
|
||||
className="block w-full px-3 py-2 placeholder-gray-400 border border-gray-300 rounded-md shadow-sm appearance-none focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
/>
|
||||
</div>
|
||||
<p className="mt-2 text-sm text-gray-500">
|
||||
@@ -153,7 +153,7 @@ const SyncDataTaskPage = () => {
|
||||
type="checkbox"
|
||||
checked={task.status}
|
||||
onChange={handleChange}
|
||||
className="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded"
|
||||
className="w-4 h-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
<div className="ml-3 text-sm">
|
||||
@@ -168,12 +168,12 @@ const SyncDataTaskPage = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-8 border-t border-gray-200 pt-5">
|
||||
<div className="pt-5 mt-8 border-t border-gray-200">
|
||||
<div className="flex justify-end">
|
||||
<button
|
||||
type="submit"
|
||||
disabled={saving}
|
||||
className="ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50"
|
||||
className="inline-flex justify-center px-4 py-2 ml-3 text-sm font-medium text-white bg-indigo-600 border border-transparent rounded-md shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50"
|
||||
>
|
||||
{saving ? '保存中...' : '保存配置'}
|
||||
</button>
|
||||
|
||||
@@ -126,7 +126,7 @@ const handleSourceFilterChange = (e) => {
|
||||
value={filters.cve}
|
||||
onChange={handleFilterChange}
|
||||
placeholder="搜索CVE编号..."
|
||||
className="block w-full py-2 pl-4 pr-12 leading-5 placeholder-gray-500 bg-white border border-gray-300 rounded-md focus:outline-none focus:placeholder-gray-400 focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
className="block w-full px-3 py-2 placeholder-gray-400 border border-gray-300 rounded-md shadow-sm appearance-none focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
@@ -140,7 +140,7 @@ const handleSourceFilterChange = (e) => {
|
||||
value={filters.title}
|
||||
onChange={handleFilterChange}
|
||||
placeholder="搜索漏洞标题..."
|
||||
className="block w-full py-2 pl-4 pr-12 leading-5 placeholder-gray-500 bg-white border border-gray-300 rounded-md focus:outline-none focus:placeholder-gray-400 focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
className="block w-full px-3 py-2 placeholder-gray-400 border border-gray-300 rounded-md shadow-sm appearance-none focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
@@ -152,7 +152,7 @@ const handleSourceFilterChange = (e) => {
|
||||
id="pushed"
|
||||
value={filters.pushed}
|
||||
onChange={handleFilterChange}
|
||||
className="block w-full py-2 pl-4 pr-12 leading-5 placeholder-gray-500 bg-white border border-gray-300 rounded-md focus:outline-none focus:placeholder-gray-400 focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
className="block w-full px-3 py-2 placeholder-gray-400 border border-gray-300 rounded-md shadow-sm appearance-none focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
>
|
||||
<option value="">全部</option>
|
||||
<option value="true">已推送</option>
|
||||
@@ -168,7 +168,7 @@ const handleSourceFilterChange = (e) => {
|
||||
id="source"
|
||||
value={filters.source}
|
||||
onChange={handleSourceFilterChange}
|
||||
className="block w-full py-2 pl-4 pr-12 leading-5 placeholder-gray-500 bg-white border border-gray-300 rounded-md focus:outline-none focus:placeholder-gray-400 focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
className="block w-full px-3 py-2 placeholder-gray-400 border border-gray-300 rounded-md shadow-sm appearance-none focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
>
|
||||
<option value="">全部</option>
|
||||
{plugins.map((plugin) => (
|
||||
|
||||
@@ -25,12 +25,12 @@ impl Dao for VulnInformationDao {
|
||||
}
|
||||
|
||||
impl VulnInformationDao {
|
||||
pub async fn update_status(
|
||||
pub async fn update_pushed(
|
||||
tx: &mut Transaction<'_, Postgres>,
|
||||
id: i64,
|
||||
status: bool,
|
||||
) -> Result<u64, Error> {
|
||||
let row = dao_update_field::<Self>(tx, id, "status", Value::Bool(Some(status))).await?;
|
||||
let row = dao_update_field::<Self>(tx, id, "pushed", Value::Bool(Some(status))).await?;
|
||||
Ok(row)
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ impl Worker {
|
||||
};
|
||||
ding.push_markdown(title, msg).await?;
|
||||
log::info!("ding bot push success! id: {}", id);
|
||||
VulnInformationDao::update_status(&mut tx, id, true).await?;
|
||||
VulnInformationDao::update_pushed(&mut tx, id, true).await?;
|
||||
}
|
||||
} else {
|
||||
log::info!("ding bot config not found or status is false");
|
||||
|
||||
@@ -29,9 +29,9 @@ pub async fn search_nuclei_pr(cve_id: &str) -> Result<Vec<String>, Error> {
|
||||
.page(1u32)
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| Error::Message(format!("Failed to search nuclei pr: {}", e.to_string())))?;
|
||||
.map_err(|e| Error::Message(format!("Failed to search nuclei pr: {}", e)))?;
|
||||
let re = Regex::new(&format!(r"(?i)(?:\b|/|_){}(?:\b|/|_)", cve_id))
|
||||
.map_err(|e| Error::Message(format!("Failed to compile regex: {}", e.to_string())))?;
|
||||
.map_err(|e| Error::Message(format!("Failed to compile regex: {}", e)))?;
|
||||
let links = page
|
||||
.into_iter()
|
||||
.filter(|pull| pull.title.is_some() || pull.body.is_some())
|
||||
@@ -59,9 +59,9 @@ pub async fn search_github_repo(cve_id: &str) -> Result<Vec<String>, Error> {
|
||||
.page(1u32)
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| Error::Message(format!("Failed to search github repo: {}", e.to_string())))?;
|
||||
.map_err(|e| Error::Message(format!("Failed to search github repo: {}", e)))?;
|
||||
let re = Regex::new(&format!(r"(?i)(?:\b|/|_){}(?:\b|/|_)", cve_id))
|
||||
.map_err(|e| Error::Message(format!("Failed to compile regex: {}", e.to_string())))?;
|
||||
.map_err(|e| Error::Message(format!("Failed to compile regex: {}", e)))?;
|
||||
let links = page
|
||||
.into_iter()
|
||||
.filter_map(|r| r.html_url)
|
||||
|
||||
Reference in New Issue
Block a user