Skip to content

Commit a0fd962

Browse files
Changes from oct-2024 to nov-2024
1 parent 85249ef commit a0fd962

File tree

911 files changed

+28308
-11981
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

911 files changed

+28308
-11981
lines changed

.cargo/exported-functions

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ _copy
3131
_exists
3232
_make_dir
3333
_make_symlink
34+
_read_dir_stats
3435
_mv
3536
_read_dir
3637
_read_file
@@ -47,8 +48,12 @@ _git_read_dir
4748
_git_file_stat
4849
_git_file_exists
4950
_git_read_file
51+
_git_read_dir_stats
5052
_is_bare
5153
_is_init
5254
_find_refs_by_globs
5355
_set_head
56+
_list_merge_requests
57+
_create_or_update_merge_request
58+
_get_draft_merge_request
5459
_invalidate_repo_cache

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"@typescript-eslint/no-unsafe-assignment": "off",
8484
"@typescript-eslint/no-unsafe-member-access": "off",
8585
"@typescript-eslint/restrict-plus-operands": "off",
86+
"@typescript-eslint/no-unsafe-enum-comparison": "off",
8687
"@typescript-eslint/no-unused-vars": "warn",
8788
"@typescript-eslint/restrict-template-expressions": "off",
8889
"@typescript-eslint/no-unsafe-any": "off",

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ junit*.xml
6565

6666

6767
!apps/browser/wasm/dist
68-
68+
apps/next/gramaxVersion.txt

Cargo.toml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
[workspace]
22
resolver = "2"
3+
default-members = [
4+
"crates/git",
5+
"crates/fs",
6+
"crates/bugsnag",
7+
"crates/test-utils",
8+
]
39
members = [
410
"apps/tauri/plugins/plugin-gramax-fs",
511
"apps/tauri/plugins/plugin-gramax-git",
@@ -10,12 +16,6 @@ members = [
1016
"apps/next/crates/next-gramax-git",
1117

1218
"rbins/warp-spa",
13-
14-
"crates/git",
15-
"crates/fs",
16-
"crates/bugsnag",
17-
18-
"crates/test-utils",
1919
]
2020

2121
[workspace.package]
@@ -37,8 +37,9 @@ tauri-plugin-shell = "^2.0.0"
3737
tauri-plugin-window-state = "^2.0.0"
3838

3939
serde = { version = "^1.0", features = ["derive"] }
40+
serde_yml = "^0.0"
4041
serde_json = "^1.0"
41-
reqwest = { version = "^0.12", features = ["blocking"] }
42+
reqwest = { version = "^0.12", features = ["blocking", "json"] }
4243
log = "^0.4"
4344

4445
rstest = "^0.23"
@@ -47,4 +48,13 @@ rstest = "^0.23"
4748
codegen-units = 1
4849
lto = true
4950
incremental = false
50-
opt-level = "s"
51+
opt-level = 2
52+
53+
[profile.development]
54+
inherits = "release"
55+
incremental = false
56+
lto = false
57+
codegen-units = 256
58+
opt-level = 1
59+
debug = "full"
60+
debug-assertions = false

app/browser/app.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import DiskFileProvider from "@core/FileProvider/DiskFileProvider/DiskFileProvid
44
import MountFileProvider from "@core/FileProvider/MountFileProvider/MountFileProvider";
55
import Path from "@core/FileProvider/Path/Path";
66
import FileStructureEventHandlers from "@core/FileStructue/events/FileStuctureEventHandlers";
7-
import Hash from "@core/Hash/Hash";
7+
import HashItemProvider from "@core/Hash/HashItemProvider";
8+
import { XxHash } from "@core/Hash/Hasher";
89
import ResourceUpdaterFactory from "@core/Resource/ResourceUpdaterFactory";
910
import CustomArticlePresenter from "@core/SitePresenter/CustomArticlePresenter";
1011
import SitePresenterFactory from "@core/SitePresenter/SitePresenterFactory";
@@ -15,7 +16,9 @@ import Cache from "@ext/Cache";
1516
import { Encoder } from "@ext/Encoder/Encoder";
1617
import MailProvider from "@ext/MailProvider";
1718
import ThemeManager from "@ext/Theme/ThemeManager";
19+
import EnterpriseManager from "@ext/enterprise/EnterpriseManager";
1820
import RepositoryProvider from "@ext/git/core/Repository/RepositoryProvider";
21+
import RepositoryProviderEventHandlers from "@ext/git/core/Repository/events/RepositoryProviderEventHandlers";
1922
import HtmlParser from "@ext/html/HtmlParser";
2023
import BugsnagLogger from "@ext/loggers/BugsnagLogger";
2124
import ConsoleLogger from "@ext/loggers/ConsoleLogger";
@@ -30,6 +33,7 @@ import { IndexDataProvider } from "@ext/serach/IndexDataProvider";
3033
import Searcher from "@ext/serach/Searcher";
3134
import SourceDataProvider from "@ext/storage/logic/SourceDataProvider/logic/SourceDataProvider";
3235
import WorkspaceManager from "@ext/workspace/WorkspaceManager";
36+
import setWorkerProxy from "../../apps/browser/src/logic/setWorkerProxy";
3337
import { AppConfig, getConfig, type AppGlobalConfig } from "../config/AppConfig";
3438
import Application from "../types/Application";
3539

@@ -39,26 +43,36 @@ const _init = async (config: AppConfig): Promise<Application> => {
3943
const vur: VideoUrlRepository = null;
4044

4145
await resolveModule("initWasm")?.(config.services.gitProxy.url);
46+
await XxHash.init();
4247

4348
const fileConfig = await YamlFileConfig.readFromFile<AppGlobalConfig>(
4449
new DiskFileProvider(config.paths.data),
4550
new Path("config.yaml"),
4651
);
4752

4853
const rp = new RepositoryProvider();
54+
55+
const em = new EnterpriseManager(config.enterprise, fileConfig);
56+
4957
const wm = new WorkspaceManager(
5058
(path) => MountFileProvider.fromDefault(new Path(path)),
51-
(fs) => new FileStructureEventHandlers(fs).mount(fs),
59+
(fs) => {
60+
new FileStructureEventHandlers(fs).mount();
61+
new RepositoryProviderEventHandlers(fs, rp).mount();
62+
},
5263
rp,
5364
config,
5465
fileConfig,
5566
);
67+
5668
const sdp = new SourceDataProvider(wm);
5769
rp.addSourceDataProvider(sdp);
5870

5971
await wm.readWorkspaces();
72+
const services = wm.maybeCurrent()?.config()?.services ?? config.services;
73+
setWorkerProxy(services.gitProxy.url);
6074

61-
const hashes = new Hash();
75+
const hashes = new HashItemProvider();
6276
const tm = new ThemeManager();
6377
const encoder = new Encoder();
6478
const ticketManager = new TicketManager(wm, encoder, config.tokens.share);
@@ -84,9 +98,9 @@ const _init = async (config: AppConfig): Promise<Application> => {
8498
tm,
8599
mp,
86100
wm,
87-
vur,
101+
em,
88102
rp,
89-
cache,
103+
vur,
90104
logger,
91105
parser,
92106
hashes,
@@ -101,22 +115,20 @@ const _init = async (config: AppConfig): Promise<Application> => {
101115
resourceUpdaterFactory,
102116
customArticlePresenter,
103117
conf: {
118+
services,
119+
logo: config.logo,
120+
104121
basePath: config.paths.base,
105122
disableSeo: config.disableSeo,
106123

107124
isRelease: config.isRelease,
108125
isReadOnly: config.isReadOnly,
109126
isProduction: config.isProduction,
110127

128+
metrics: config.metrics,
111129
version: config.version,
112130
buildVersion: config.buildVersion,
113131
bugsnagApiKey: config.bugsnagApiKey,
114-
yandexMetricCounter: config.yandexMetricCounter,
115-
116-
services: config.services,
117-
enterprise: config.enterprise,
118-
119-
logo: config.logo,
120132
},
121133
};
122134
};

app/commands/article/create.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ const create: Command<{ ctx: Context; catalogName: string; parentPath?: Path },
1717
const { resourceUpdaterFactory, wm } = this._app;
1818
const workspace = wm.current();
1919

20-
const catalog = await workspace.getCatalog(catalogName);
20+
const catalog = await workspace.getCatalog(catalogName, ctx);
2121
const fp = workspace.getFileProvider();
2222
const parentRef = fp.getItemRef(parentPath);
2323

2424
const markdown = "\n\n";
25-
const article = await catalog.createArticle(
26-
resourceUpdaterFactory.withContext(ctx),
27-
markdown,
28-
parentPath ? parentRef : null,
29-
);
25+
const article = await catalog.createArticle(resourceUpdaterFactory, markdown, parentPath ? parentRef : null);
3026

3127
return await catalog.getPathname(article);
3228
},

app/commands/article/editOn/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const app: Command<{ catalogName: string; articlePath: Path }, string> = Command
1010

1111
async do({ catalogName, articlePath }) {
1212
const workspace = this._app.wm.current();
13-
const catalog = await workspace.getCatalog(catalogName);
13+
const catalog = await workspace.getContextlessCatalog(catalogName);
1414
if (!catalog) return;
1515
const item = catalog.findItemByItemPath(articlePath);
1616
return RouterPathProvider.getPathname(await catalog.getPathnameData(item)).value;

app/commands/article/editOn/source.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ const source: Command<{ catalogName: string; articlePath: Path }, string> = Comm
99

1010
async do({ catalogName, articlePath }) {
1111
const workspace = this._app.wm.current();
12-
const catalog = await workspace.getCatalog(catalogName);
12+
const catalog = await workspace.getContextlessCatalog(catalogName);
1313
if (!catalog) return;
14-
if (!articlePath.startsWith(catalog.getBasePath())) return;
14+
if (!articlePath.startsWith(catalog.basePath)) return;
1515
const fp = workspace.getFileProvider();
1616
const itemRef = fp.getItemRef(articlePath);
17-
const path = catalog.getRelativeRepPath(itemRef);
17+
const path = catalog.getRepositoryRelativePath(itemRef);
1818
const { gitVersionControl } = await catalog.repo.gvc.getGitVersionControlContainsItem(path);
1919

2020
return await catalog.repo.storage.getFileLink(path, await gitVersionControl.getCurrentBranch());

app/commands/article/features/checkLastModified.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const checkLastModified: Command<{ ctx: Context; articlePath: Path; catalogName:
1919
async do({ ctx, articlePath, catalogName }) {
2020
const { sitePresenterFactory, wm } = this._app;
2121
const workspace = wm.current();
22-
const catalog = await workspace.getCatalog(catalogName);
22+
const catalog = await workspace.getContextlessCatalog(catalogName);
2323
if (!catalog || !catalog.getRootCategory().items.length) return;
2424

2525
const fp = workspace.getFileProvider();
@@ -29,6 +29,7 @@ const checkLastModified: Command<{ ctx: Context; articlePath: Path; catalogName:
2929
let res = false;
3030

3131
try {
32+
if (article.props.shouldBeCreated) return null;
3233
const stat = await fp.getStat(article.ref.path);
3334
res = await article.checkLastModified(stat.mtimeMs);
3435
} catch (e) {

app/commands/article/features/getArticleHeadersByRelativePath.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const getArticleHeadersByRelativePath: Command<
2424
const workspace = wm.current();
2525

2626
const path = articlePath.parentDirectoryPath.join(articleRelativePath);
27-
const catalog = await workspace.getCatalog(catalogName);
27+
const catalog = await workspace.getCatalog(catalogName, ctx);
2828
const article: Article = catalog.findItemByItemPath(path);
2929
if (!article) return [];
3030

0 commit comments

Comments
 (0)