Repository navigation
feat(assets): upload images to an MDU Asset Server and check its links in lint - #238
Merged
Merged
Conversation
…s in lint Adds the assets section to mdu.yml (server, public, project; the token only from MDU_ASSETS_TOKEN), mdu assets upload, which uploads files or standard input and prints one snippet per image, and lint rule MDU032, which reports links and images on the server's public host whose image is unknown, deleted or in the trash. Network problems are warnings, and mdu lint --offline skips the check. HTTP uses HttpClient only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Milestone M10 of mdu-assets: MDU learns about the site's asset server.
assetsinmdu.yml(CLI-01)assets.server(web interface and API),assets.public(public image links; defaults to the server),assets.project(default project).MDU_ASSETS_TOKEN, never from the file.mdu render/servestop on an address that is not http(s); a project without a server is an error.mdu assets upload <file>…(CLI-02, CLI-04)-for standard input;--project,--tag(repeatable),--alt,--name,--format markdown|url|html,--root.duplicates=rejectand prints the existing image's snippet when the project already has the content.Lint rule
MDU032BrokenAssetLink (CLI-03;MDU029from the plan is taken)mdu.yml.mdu lint --offlineskips the check; withoutassets.servernothing is sent.HttpClientonly, JSON viaJsonDocument/Utf8JsonWriter(no reflection). Docs: newUsage/assets.md,assetsin the configuration reference, MDU032 in the rules,--offlinein lint.Tests: 20 new in
AssetsTestwith a fake HTTP handler (settings, upload, stdin, duplicate, refusal and continue, missing token/server/project, no token over plain http, MDU032 errors, warning when unreachable, offline). Full suite green exceptServeCommandIntegrationTest.ReloadsExternalGlossaryChangesAndConfigurationPathChanges, which timed out once under load and passes alone.Tried for real:
mdu lintagainst a running asset server reported a made-up link as MDU032 and let a real one pass;--offlineskipped it.mdu assets uploadagainst a local asset server uploaded a file with tag and alt text, printed the existing link for a duplicate, read standard input, and explained a missing token.Closes capjan/mdu-assets#52
Closes capjan/mdu-assets#53
Closes capjan/mdu-assets#54