docs-combiner 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +6 -0
- package/README.md +26 -0
- package/cli.js +13 -0
- package/dist/index.html +11 -0
- package/dist/main.js +158 -0
- package/dist/preload.js +13 -0
- package/dist/renderer.js +88538 -0
- package/dist/renderer.js.map +1 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Copyright (c) 2025
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
4
|
+
|
|
5
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
6
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Docs Combiner
|
|
2
|
+
|
|
3
|
+
Combine titles, texts, and images into a product feed table.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install docs-combiner
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
This is an Electron application.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Clone the repository
|
|
17
|
+
git clone <repository-url>
|
|
18
|
+
cd docs-combiner
|
|
19
|
+
npm install
|
|
20
|
+
npm start
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
|
|
25
|
+
ISC
|
|
26
|
+
|
package/cli.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const electron = require('electron');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const appPath = path.join(__dirname);
|
|
8
|
+
const child = spawn(electron, [appPath], { stdio: 'inherit' });
|
|
9
|
+
|
|
10
|
+
child.on('close', (code) => {
|
|
11
|
+
process.exit(code);
|
|
12
|
+
});
|
|
13
|
+
|
package/dist/index.html
ADDED
package/dist/main.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
const electron_1 = require("electron");
|
|
46
|
+
const path = __importStar(require("path"));
|
|
47
|
+
const fs = __importStar(require("fs"));
|
|
48
|
+
const http = __importStar(require("http"));
|
|
49
|
+
const url = __importStar(require("url"));
|
|
50
|
+
function createWindow() {
|
|
51
|
+
const mainWindow = new electron_1.BrowserWindow({
|
|
52
|
+
width: 1000,
|
|
53
|
+
height: 800,
|
|
54
|
+
webPreferences: {
|
|
55
|
+
preload: path.join(__dirname, 'preload.js'),
|
|
56
|
+
nodeIntegration: false,
|
|
57
|
+
contextIsolation: true,
|
|
58
|
+
sandbox: false
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
// We need to point to the webpack output html
|
|
62
|
+
mainWindow.loadFile(path.join(__dirname, 'index.html'));
|
|
63
|
+
// DevTools disabled by default as requested
|
|
64
|
+
// mainWindow.webContents.openDevTools();
|
|
65
|
+
}
|
|
66
|
+
electron_1.app.whenReady().then(() => {
|
|
67
|
+
const userDataPath = electron_1.app.getPath('userData');
|
|
68
|
+
if (!fs.existsSync(userDataPath)) {
|
|
69
|
+
fs.mkdirSync(userDataPath, { recursive: true });
|
|
70
|
+
}
|
|
71
|
+
const configPath = path.join(userDataPath, 'config.json');
|
|
72
|
+
electron_1.ipcMain.handle('save-config', (event, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
try {
|
|
74
|
+
fs.writeFileSync(configPath, JSON.stringify(config));
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
81
|
+
electron_1.ipcMain.handle('load-config', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
82
|
+
try {
|
|
83
|
+
if (fs.existsSync(configPath)) {
|
|
84
|
+
const content = fs.readFileSync(configPath, 'utf-8');
|
|
85
|
+
return JSON.parse(content);
|
|
86
|
+
}
|
|
87
|
+
return {};
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
return {};
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
electron_1.ipcMain.handle('save-file', (event, content, filename) => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
+
const { canceled, filePath } = yield electron_1.dialog.showSaveDialog({
|
|
95
|
+
defaultPath: filename,
|
|
96
|
+
});
|
|
97
|
+
if (canceled || !filePath)
|
|
98
|
+
return false;
|
|
99
|
+
fs.writeFileSync(filePath, content);
|
|
100
|
+
return true;
|
|
101
|
+
}));
|
|
102
|
+
electron_1.ipcMain.handle('start-auth', (event, clientId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
103
|
+
return new Promise((resolve, reject) => {
|
|
104
|
+
const server = http.createServer((req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
105
|
+
try {
|
|
106
|
+
if (!req.url)
|
|
107
|
+
return;
|
|
108
|
+
const parsedUrl = url.parse(req.url, true);
|
|
109
|
+
// Allow any path for flexibility
|
|
110
|
+
const query = parsedUrl.query;
|
|
111
|
+
if (query.code) {
|
|
112
|
+
const address = server.address();
|
|
113
|
+
const port = address && typeof address !== 'string' ? address.port : 0;
|
|
114
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
115
|
+
res.end('<h1>Authentication successful!</h1><p>You can close this window and return to the app.</p><script>window.close();</script>');
|
|
116
|
+
server.close();
|
|
117
|
+
resolve({ code: query.code, redirectUri: `http://127.0.0.1:${port}` });
|
|
118
|
+
}
|
|
119
|
+
else if (query.error) {
|
|
120
|
+
res.writeHead(400, { 'Content-Type': 'text/html' });
|
|
121
|
+
res.end('Authentication failed.');
|
|
122
|
+
server.close();
|
|
123
|
+
reject(new Error(query.error));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (e) {
|
|
127
|
+
server.close();
|
|
128
|
+
reject(e);
|
|
129
|
+
}
|
|
130
|
+
}));
|
|
131
|
+
server.listen(0, '127.0.0.1', () => {
|
|
132
|
+
const address = server.address();
|
|
133
|
+
if (!address || typeof address === 'string') {
|
|
134
|
+
server.close();
|
|
135
|
+
reject(new Error('Failed to get server port'));
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const port = address.port;
|
|
139
|
+
const redirectUri = `http://127.0.0.1:${port}`;
|
|
140
|
+
// Google Drive Scope: https://www.googleapis.com/auth/drive (Full Access)
|
|
141
|
+
// Added prompt=consent to force new refresh token with correct scopes
|
|
142
|
+
const authUrl = `https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&response_type=code&client_id=${clientId}&redirect_uri=${redirectUri}&prompt=consent`;
|
|
143
|
+
electron_1.shell.openExternal(authUrl);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
}));
|
|
147
|
+
electron_1.ipcMain.handle('open-external', (event, url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
148
|
+
yield electron_1.shell.openExternal(url);
|
|
149
|
+
}));
|
|
150
|
+
createWindow();
|
|
151
|
+
electron_1.app.on('activate', function () {
|
|
152
|
+
if (electron_1.BrowserWindow.getAllWindows().length === 0)
|
|
153
|
+
createWindow();
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
electron_1.app.on('window-all-closed', function () {
|
|
157
|
+
electron_1.app.quit();
|
|
158
|
+
});
|
package/dist/preload.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const electron_1 = require("electron");
|
|
4
|
+
electron_1.contextBridge.exposeInMainWorld('electronAPI', {
|
|
5
|
+
// Add any specific API requirements here if needed
|
|
6
|
+
// For now, standard browser fetch works for many things, but if we need
|
|
7
|
+
// file system access to save the result, we should expose it.
|
|
8
|
+
saveFile: (content, filename) => electron_1.ipcRenderer.invoke('save-file', content, filename),
|
|
9
|
+
saveConfig: (config) => electron_1.ipcRenderer.invoke('save-config', config),
|
|
10
|
+
loadConfig: () => electron_1.ipcRenderer.invoke('load-config'),
|
|
11
|
+
startAuth: (clientId) => electron_1.ipcRenderer.invoke('start-auth', clientId),
|
|
12
|
+
openExternal: (url) => electron_1.ipcRenderer.invoke('open-external', url),
|
|
13
|
+
});
|