update server

This commit is contained in:
Admin 2025-08-22 16:59:11 +07:00
parent eb4e711e58
commit 71290dcdcd
16 changed files with 96 additions and 63 deletions

View File

@ -2,3 +2,5 @@ Servers matching 'ai':
Server Name: AI training tool server Server Name: AI training tool server
Command: ssh root@172.16.7.48 Command: ssh root@172.16.7.48
Password: Work1234 Password: Work1234
server folder: /root/facebook-publist-server/auto-post-marketplace-facebook/server

View File

@ -1 +1 @@
import{R as c,j as s,Q as u,q as l,P as d}from"./popup-DvUDMaaW.js";import"./base64-BbJB1hmJ.js";import"./product-api.service-DR0CE0o9.js";import"./app-C7VSS-q9.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))i(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?r.credentials="include":e.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(e){if(e.ep)return;e.ep=!0;const r=n(e);fetch(e.href,r)}})();c.createRoot(document.getElementById("root")).render(s.jsx(u,{client:l,children:s.jsx(d,{})})); import{R as c,j as s,Q as u,q as l,P as d}from"./popup-Bz59jSUd.js";import"./base64-BbJB1hmJ.js";import"./product-api.service--mothqFI.js";import"./app-C7VSS-q9.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))i(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?r.credentials="include":e.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(e){if(e.ep)return;e.ep=!0;const r=n(e);fetch(e.href,r)}})();c.createRoot(document.getElementById("root")).render(s.jsx(u,{client:l,children:s.jsx(d,{})}));

File diff suppressed because one or more lines are too long

View File

@ -7,9 +7,9 @@
<title>Vite + React + TS</title> <title>Vite + React + TS</title>
<script type="module" crossorigin src="/assets/popup.js"></script> <script type="module" crossorigin src="/assets/popup.js"></script>
<link rel="modulepreload" crossorigin href="/assets/base64-BbJB1hmJ.js"> <link rel="modulepreload" crossorigin href="/assets/base64-BbJB1hmJ.js">
<link rel="modulepreload" crossorigin href="/assets/product-api.service-DR0CE0o9.js"> <link rel="modulepreload" crossorigin href="/assets/product-api.service--mothqFI.js">
<link rel="modulepreload" crossorigin href="/assets/app-C7VSS-q9.js"> <link rel="modulepreload" crossorigin href="/assets/app-C7VSS-q9.js">
<link rel="modulepreload" crossorigin href="/assets/popup-DvUDMaaW.js"> <link rel="modulepreload" crossorigin href="/assets/popup-Bz59jSUd.js">
<link rel="stylesheet" crossorigin href="/assets/style.css"> <link rel="stylesheet" crossorigin href="/assets/style.css">
</head> </head>
<body> <body>

View File

@ -9,10 +9,10 @@
"service_worker": "background/background.js", "service_worker": "background/background.js",
"type": "module" "type": "module"
}, },
"host_permissions": ["http://172.16.7.48/*"], "host_permissions": ["https://www.facebook.com/*"],
"content_scripts": [ "content_scripts": [
{ {
"matches": ["<all_urls>"], "matches": ["https://www.facebook.com/*"],
"js": ["content/content.js"], "js": ["content/content.js"],
"type": "module" "type": "module"
} }
@ -20,9 +20,8 @@
"web_accessible_resources": [ "web_accessible_resources": [
{ {
"resources": ["content/inject-ui.js", "assets/*"], "resources": ["content/inject-ui.js", "assets/*"],
"matches": ["<all_urls>"] "matches": ["https://www.facebook.com/*"]
} }
], ],
"permissions": ["storage", "tabs", "activeTab", "scripting"] "permissions": ["storage", "tabs", "activeTab", "scripting"]
} }

View File

@ -9,10 +9,10 @@
"service_worker": "background/background.js", "service_worker": "background/background.js",
"type": "module" "type": "module"
}, },
"host_permissions": ["http://172.16.7.48/*"], "host_permissions": ["https://www.facebook.com/*"],
"content_scripts": [ "content_scripts": [
{ {
"matches": ["<all_urls>"], "matches": ["https://www.facebook.com/*"],
"js": ["content/content.js"], "js": ["content/content.js"],
"type": "module" "type": "module"
} }
@ -20,9 +20,8 @@
"web_accessible_resources": [ "web_accessible_resources": [
{ {
"resources": ["content/inject-ui.js", "assets/*"], "resources": ["content/inject-ui.js", "assets/*"],
"matches": ["<all_urls>"] "matches": ["https://www.facebook.com/*"]
} }
], ],
"permissions": ["storage", "tabs", "activeTab", "scripting"] "permissions": ["storage", "tabs", "activeTab", "scripting"]
} }

View File

@ -1 +1 @@
import{R as c,j as s,Q as u,q as l,P as d}from"./popup-DvUDMaaW.js";import"./base64-BbJB1hmJ.js";import"./product-api.service-DR0CE0o9.js";import"./app-C7VSS-q9.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))i(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?r.credentials="include":e.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(e){if(e.ep)return;e.ep=!0;const r=n(e);fetch(e.href,r)}})();c.createRoot(document.getElementById("root")).render(s.jsx(u,{client:l,children:s.jsx(d,{})})); import{R as c,j as s,Q as u,q as l,P as d}from"./popup-Bz59jSUd.js";import"./base64-BbJB1hmJ.js";import"./product-api.service--mothqFI.js";import"./app-C7VSS-q9.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))i(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?r.credentials="include":e.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(e){if(e.ep)return;e.ep=!0;const r=n(e);fetch(e.href,r)}})();c.createRoot(document.getElementById("root")).render(s.jsx(u,{client:l,children:s.jsx(d,{})}));

File diff suppressed because one or more lines are too long

View File

@ -7,9 +7,9 @@
<title>Vite + React + TS</title> <title>Vite + React + TS</title>
<script type="module" crossorigin src="/assets/popup.js"></script> <script type="module" crossorigin src="/assets/popup.js"></script>
<link rel="modulepreload" crossorigin href="/assets/base64-BbJB1hmJ.js"> <link rel="modulepreload" crossorigin href="/assets/base64-BbJB1hmJ.js">
<link rel="modulepreload" crossorigin href="/assets/product-api.service-DR0CE0o9.js"> <link rel="modulepreload" crossorigin href="/assets/product-api.service--mothqFI.js">
<link rel="modulepreload" crossorigin href="/assets/app-C7VSS-q9.js"> <link rel="modulepreload" crossorigin href="/assets/app-C7VSS-q9.js">
<link rel="modulepreload" crossorigin href="/assets/popup-DvUDMaaW.js"> <link rel="modulepreload" crossorigin href="/assets/popup-Bz59jSUd.js">
<link rel="stylesheet" crossorigin href="/assets/style.css"> <link rel="stylesheet" crossorigin href="/assets/style.css">
</head> </head>
<body> <body>

View File

@ -9,10 +9,10 @@
"service_worker": "background/background.js", "service_worker": "background/background.js",
"type": "module" "type": "module"
}, },
"host_permissions": ["http://172.16.7.48/*"], "host_permissions": ["https://www.facebook.com/*"],
"content_scripts": [ "content_scripts": [
{ {
"matches": ["<all_urls>"], "matches": ["https://www.facebook.com/*"],
"js": ["content/content.js"], "js": ["content/content.js"],
"type": "module" "type": "module"
} }
@ -20,9 +20,8 @@
"web_accessible_resources": [ "web_accessible_resources": [
{ {
"resources": ["content/inject-ui.js", "assets/*"], "resources": ["content/inject-ui.js", "assets/*"],
"matches": ["<all_urls>"] "matches": ["https://www.facebook.com/*"]
} }
], ],
"permissions": ["storage", "tabs", "activeTab", "scripting"] "permissions": ["storage", "tabs", "activeTab", "scripting"]
} }

View File

@ -1,20 +1,14 @@
[ [
{ {
"title": "Air-ct7510-k9 - AIR-CT7510-K9", "title": "Cisco AIR-PWRINJ6 Power Injector 8023at for Aironet Access Points - AIR-PWRINJ6",
"price": 95,
"el": {},
"date": "2025-08-22T09:58:21.949Z"
},
{
"title": "Cisco AIR-CT7510-K9 Wireless LAN Controller w / OS 8.5.182, 2x 300GB, 2x SFP+ - AIR-CT7510-K9",
"price": 8562, "price": 8562,
"el": {}, "el": {},
"date": "2025-08-21T08:56:43.192Z" "date": "2025-08-22T09:58:21.950Z"
},
{
"title": "2-Port Analog Telephone Adapter - ATA191-K9",
"price": 220,
"el": {},
"date": "2025-08-21T08:56:43.192Z"
},
{
"title": "Cisco 2911 Voice Bundle, Pvdm3-16, Uc License Pak, Fl- Cube10 - CISCO2911-V/K9",
"price": 125,
"el": {},
"date": "2025-08-21T08:56:43.192Z"
} }
] ]

View File

@ -137,15 +137,28 @@ app.post("/", async (req, res) => {
const skip = originalFilter.skip || 0; const skip = originalFilter.skip || 0;
const limit = originalFilter.limit || data.data.length; const limit = originalFilter.limit || data.data.length;
const listedCodes = new Set( // const listedCodes = new Set(
publistedData.map((i) => (i.title + i.price || "").trim().toLowerCase()) // publistedData.map((i) => (i.title + i.price || "").trim().toLowerCase())
); // );
// let filteredData = data.data.filter((item) => {
// const key = `${item.title} - ${item.code}${item.price}`.toLowerCase();
// return status === "listed"
// ? listedCodes.has(key)
// : !listedCodes.has(key);
// });
let filteredData = data.data.filter((item) => { let filteredData = data.data.filter((item) => {
const key = `${item.title} - ${item.code}${item.price}`.toLowerCase(); const key = `${item.title} - ${item.code}`.toLowerCase();
return status === "listed"
? listedCodes.has(key) if (status === "listed") {
: !listedCodes.has(key); return publistedData.some((i) =>
`${i.title}`.toLowerCase().includes(key)
);
} else {
return !publistedData.some((i) =>
`${i.title}`.toLowerCase().includes(key)
);
}
}); });
data.total = filteredData.length; data.total = filteredData.length;

View File

@ -74,7 +74,8 @@ class ProductApiService {
| "get" | "get"
| "createBlobUrl" | "createBlobUrl"
| "publist" | "publist"
| "unlist", | "unlist"
| "sync",
body: Record<string, any> body: Record<string, any>
) { ) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View File

@ -167,8 +167,6 @@ window.addEventListener("message", async (event) => {
"background-to-content-actions" "background-to-content-actions"
); );
console.log({ publisted: data });
break; break;
} }
@ -184,7 +182,18 @@ window.addEventListener("message", async (event) => {
"background-to-content-actions" "background-to-content-actions"
); );
console.log({ data }); console.log({ unlisted: data });
break;
}
case "sync": {
const products = await facebookService.getProducts();
console.log({ products });
await productApi.sync(products);
data = products;
break; break;
} }
@ -212,9 +221,6 @@ window.addEventListener("message", async (event) => {
}); });
(async () => { (async () => {
// Call to inject modal
injectApp();
await delayRD(800, 1000); await delayRD(800, 1000);
// Sử dụng // Sử dụng
@ -234,6 +240,9 @@ window.addEventListener("message", async (event) => {
console.log({ products }); console.log({ products });
productApi.sync(products); productApi.sync(products);
// Call to inject modal
injectApp();
}) })
.catch((err) => { .catch((err) => {
console.error(err); console.error(err);

View File

@ -75,9 +75,9 @@ export function mapToIPost(raw: any): IPost {
condition: (raw?.conditionEbay as string)?.toLowerCase()?.includes("new") condition: (raw?.conditionEbay as string)?.toLowerCase()?.includes("new")
? "new" ? "new"
: "used like new", : "used like new",
brand: typeof raw.manufactor === "string" ? raw.manufactor : raw?.name, brand: typeof raw.manufactor === "string" ? raw.manufactor : "",
description: descriptionLines, description: descriptionLines,
tags: raw.tags || [], tags: [],
sku: raw.code, sku: raw.code,
location: raw.location || "Sydney, Australia", location: raw.location || "Sydney, Australia",
status: false, status: false,

View File

@ -35,6 +35,7 @@ import {
Eye, Eye,
EyeOff, EyeOff,
MoreHorizontal, MoreHorizontal,
RefreshCcwIcon,
Search, Search,
} from "lucide-react"; } from "lucide-react";
import { useMemo, useState } from "react"; import { useMemo, useState } from "react";
@ -53,7 +54,11 @@ export default function Popup() {
); );
// --- React Query fetch --- // --- React Query fetch ---
const { data: rawProducts, isLoading } = useQuery({ const {
data: rawProducts,
isFetching,
...dataQuery
} = useQuery({
queryKey, queryKey,
queryFn: async () => { queryFn: async () => {
const data = await productApi.apiRequest( const data = await productApi.apiRequest(
@ -71,7 +76,7 @@ export default function Popup() {
}, },
}); });
const { data: publistedProducts } = useQuery({ const { data: publistedProducts, ...publistQuery } = useQuery({
queryKey: ["publised-products"], queryKey: ["publised-products"],
queryFn: async () => { queryFn: async () => {
const data = await productApi.apiRequest("getPublistedProducts", {}); const data = await productApi.apiRequest("getPublistedProducts", {});
@ -166,6 +171,18 @@ export default function Popup() {
/> />
</div> </div>
{/* <Button
onClick={async () => {
await productApi.apiRequest("sync", {});
publistQuery.refetch();
dataQuery.refetch();
}}
size={"icon"}
>
<RefreshCcwIcon />
</Button> */}
<ImprovedToggleFilter <ImprovedToggleFilter
filter={filter as any} filter={filter as any}
setFilter={setFilter} setFilter={setFilter}
@ -298,7 +315,7 @@ export default function Popup() {
</TableHeader> </TableHeader>
<TableBody className="relative"> <TableBody className="relative">
{isLoading && ( {isFetching && (
<TableRow> <TableRow>
<TableCell <TableCell
colSpan={10} colSpan={10}
@ -311,7 +328,7 @@ export default function Popup() {
</TableRow> </TableRow>
)} )}
{data.length === 0 && !isLoading ? ( {data.length === 0 && !isFetching ? (
<TableRow> <TableRow>
<TableCell <TableCell
colSpan={10} colSpan={10}
@ -389,7 +406,7 @@ export default function Popup() {
)} )}
{post.status ? "Unlist" : "List"} {post.status ? "Unlist" : "List"}
{actionMutation.isPending && <Loader />} {/* {actionMutation.isPending && <Loader />} */}
</DropdownMenuItem> </DropdownMenuItem>
{/* <DropdownMenuItem onClick={() => handleUnListing(post)}> {/* <DropdownMenuItem onClick={() => handleUnListing(post)}>
unList unList