Skip to content

Commit

Permalink
Merge pull request #591 from thoth-pub/feature/upgrade_rust_1_77_1
Browse files Browse the repository at this point in the history
Feature/upgrade rust 1 77 1
  • Loading branch information
ja573 authored Apr 16, 2024
2 parents 17f009e + fb42f2f commit 5ddae2c
Show file tree
Hide file tree
Showing 43 changed files with 630 additions and 323 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- [581](https://github.com/thoth-pub/thoth/issues/581) - Add crossmark policy DOI to imprint record

### Changed
- [591](https://github.com/thoth-pub/thoth/pull/591) - Upgrade rust to `1.77.2` in production and development `Dockerfile`
- [591](https://github.com/thoth-pub/thoth/pull/591) - Added favicons to export API and GraphQL API docs
- [591](https://github.com/thoth-pub/thoth/pull/591) - Replaced static logo files with CDN paths
- [591](https://github.com/thoth-pub/thoth/pull/591) - Moved thoth CSS to root directory in thoth-app
- [591](https://github.com/thoth-pub/thoth/pull/591) - Replace unnecessary pageloader CSS with an actual loader
- [591](https://github.com/thoth-pub/thoth/pull/591) - Apply Thoth theming to rapidocs
- [591](https://github.com/thoth-pub/thoth/pull/591) - Upgrade `graphiql` to v3.2
- [591](https://github.com/thoth-pub/thoth/pull/591) - Upgrade `trunk` to v0.19.2
- [591](https://github.com/thoth-pub/thoth/pull/591) - Upgrade `wasm-bindgen` to v0.2.92

### Fixed
- [591](https://github.com/thoth-pub/thoth/pull/591) - Replaced broken logo URL in export API docs

## [[0.12.1]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.1) - 2024-04-8
### Fixed
- [589](https://github.com/thoth-pub/thoth/issues/589) - Truncation of `short_abstract` in Thoth ONIX results in Invalid UTF-8 sequences
Expand Down
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG MUSL_IMAGE=clux/muslrust:1.76.0
ARG MUSL_IMAGE=clux/muslrust:1.77.2-stable

FROM ${MUSL_IMAGE} as build

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUST_VERSION=1.76.0
ARG RUST_VERSION=1.77.2

FROM rust:${RUST_VERSION}

Expand Down
222 changes: 145 additions & 77 deletions thoth-api-server/src/graphiql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,28 @@
/// Generate the HTML source to show a GraphiQL interface
pub fn graphiql_source(graphql_endpoint_url: &str) -> String {
let default_query = r#"# Welcome to Thoth's GraphQL API explorer (GraphiQL).
let version = env!("CARGO_PKG_VERSION");
let default_query = r##"# Welcome to Thoth's GraphQL API explorer (GraphiQL).
#
# GraphiQL is an in-browser tool for writing, validating, and
# testing GraphQL queries.
#
# Type queries into this side of the screen, and you will see intelligent
# typeaheads aware of the current GraphQL type schema and live syntax and
# validation errors highlighted within the text.
# Type queries into this side of the screen, and you will see
# intelligent typeaheads aware of the current GraphQL type
# schema and live syntax and validation errors highlighted
# within the text.
#
# Click on the QueryRoot in the Documentation Explorer ( < Docs ) on the
# right hand side of the screen to navigate the API schema.
# Click on the QueryRoot in the Documentation Explorer
# (first icon) on the top left of the screen to navigate
# the API schema.
#
# GraphQL queries typically start with a "{" character. Lines that starts
# with a # are ignored.
# GraphQL queries typically start with a "{" character.
# Lines that starts with a "#" are ignored.
#
# An example Thoth GraphQL query might look like:
#
# {
# books(workStatuses: [ACTIVE]) {
# fullTitle
# doi
# }
# }
#
# Keyboard shortcuts:
# Run the following example Thoth GraphQL query:
#
# Run Query: Ctrl-Enter (or press the play button above)
#
# Auto Complete: Ctrl-Space (or just start typing)
#
#
# Run the following query (Ctrl-Enter):
#
{
books(order: {field: PUBLICATION_DATE, direction: ASC}) {
fullTitle
Expand All @@ -50,62 +38,142 @@ pub fn graphiql_source(graphql_endpoint_url: &str) -> String {
}
}
}
"#;
"##;

format!(
r#"
r##"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Thoth GraphQL API Documentation</title>
<link rel="shortcut icon" href="https://thoth.pub/favicon.ico" />
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/[email protected]/graphiql.min.css">
<style>
html, body, #app {{
height: 100vh;
margin: 0;
overflow: hidden;
}}
</style>
</head>
<body>
<div id="app"></div>
<script src="//cdnjs.cloudflare.com/ajax/libs/fetch/2.0.3/fetch.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/react/16.10.2/umd/react.production.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/react-dom/16.10.2/umd/react-dom.production.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/[email protected]/graphiql.min.js"></script>
<script>var GRAPHQL_URL = '{graphql_endpoint_url}';</script>
<script>
function graphQLFetcher(params) {{
return fetch(GRAPHQL_URL, {{
method: 'post',
headers: {{
'Accept': 'application/json',
'Content-Type': 'application/json',
}},
credentials: 'include',
body: JSON.stringify(params)
}}).then(function (response) {{
return response.text();
}}).then(function (body) {{
try {{
return JSON.parse(body);
}} catch (error) {{
return body;
}}
}});
}}
ReactDOM.render(
React.createElement(GraphiQL, {{
fetcher: graphQLFetcher,
query: String.raw`{default_query}`,
}}),
document.querySelector('#app'));
</script>
</body>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Thoth GraphQL API Documentation</title>
<link rel="shortcut icon" href="https://cdn.thoth.pub/favicon.ico" />
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.thoth.pub/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.thoth.pub/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.thoth.pub/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.thoth.pub/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.thoth.pub/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.thoth.pub/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.thoth.pub/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.thoth.pub/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.thoth.pub/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="https://cdn.thoth.pub/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="https://cdn.thoth.pub/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="https://cdn.thoth.pub/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="https://cdn.thoth.pub/favicon-16x16.png">
<link rel="manifest" href="https://cdn.thoth.pub/manifest.json">
<meta name="msapplication-TileColor" content="#FFDD57">
<meta name="msapplication-TileImage" content="https://cdn.thoth.pub/ms-icon-144x144.png">
<meta name="theme-color" content="#FFDD57">
<script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/[email protected]/graphiql.min.js" type="application/javascript"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/graphiql.min.css" />
<script crossorigin src="https://unpkg.com/@graphiql/plugin-explorer@2/dist/index.umd.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@graphiql/plugin-explorer@2/dist/style.css"/>
<style>
.graphiql-container,
.CodeMirror-info,
.CodeMirror-lint-tooltip,
.graphiql-dialog,
.graphiql-dialog-overlay,
.graphiql-tooltip,
[data-radix-popper-content-wrapper] {{
--color-primary: 298, 38%, 40%;
--color-secondary: 154, 100%, 24%;
--color-tertiary: 320, 95%, 43%;
--color-info: 188, 100%, 36%;
--color-warning: 24, 80%, 50%;
--color-base: 46, 100%, 97%;
}}
@media (prefers-color-scheme: dark) {{
body:not(.graphiql-light) .graphiql-container,
body:not(.graphiql-light) .CodeMirror-info,
body:not(.graphiql-light) .CodeMirror-lint-tooltip,
body:not(.graphiql-light) .graphiql-dialog,
body:not(.graphiql-light) .graphiql-dialog-overlay,
body:not(.graphiql-light) .graphiql-tooltip,
body:not(.graphiql-light) [data-radix-popper-content-wrapper] {{
--color-primary: 298, 38%, 40%;
--color-secondary: 154, 58%, 47%;
--color-tertiary: 338, 100%, 67%;
--color-info: 188, 100%, 36%;
--color-warning: 24, 100%, 63%;
--color-base: 221, 39%, 11%;
}}
}}
body.graphiql-dark .graphiql-container,
body.graphiql-dark .CodeMirror-info,
body.graphiql-dark .CodeMirror-lint-tooltip,
body.graphiql-dark .graphiql-dialog,
body.graphiql-dark .graphiql-dialog-overlay,
body.graphiql-dark .graphiql-tooltip,
body.graphiql-dark [data-radix-popper-content-wrapper] {{
--color-primary: 298, 38%, 40%;
--color-secondary: 154, 58%, 47%;
--color-tertiary: 338, 100%, 67%;
--color-info: 188, 100%, 36%;
--color-warning: 24, 100%, 63%;
--color-base: 221, 39%, 11%;
}}
body {{
height: 100%;
margin: 0;
width: 100%;
overflow: hidden;
}}
#graphiql {{
height: 100vh;
}}
</style>
</head>
<body>
<div id="graphiql">Loading...</div>
<script>
const root = ReactDOM.createRoot(document.getElementById('graphiql'));
const fetcher = GraphiQL.createFetcher({{
url: '{graphql_endpoint_url}',
method: 'post',
headers: {{
'Accept': 'application/json',
'Content-Type': 'application/json',
}},
}});
const explorerPlugin = GraphiQLPluginExplorer.explorerPlugin();
root.render(
React.createElement(GraphiQL, {{
fetcher,
query: String.raw`{default_query}`,
defaultEditorToolsVisibility: false,
plugins: [explorerPlugin],
}},
React.createElement(GraphiQL.Logo, null,
React.createElement('div', {{ style: {{ display: 'flex', alignItems: 'center' }}}},
React.createElement('span', null, 'Thoth GraphQL API'),
React.createElement('img', {{
src: 'https://cdn.thoth.pub/thoth_logo.png',
height: 38,
alt: 'Thoth Logo',
style: {{ marginLeft: '10px', marginTop: '-5px' }}
}}),
)
),
React.createElement(GraphiQL.Footer, null,
React.createElement('div', {{ style: {{ display: 'flex', justifyContent: 'space-between' }}}},
React.createElement('a', {{ href: 'https://github.com/thoth-pub/thoth/blob/master/CHANGELOG.md', style: {{ textDecoration: 'none' }} }}, 'v{version}'),
React.createElement('span', {{ style: {{ color: 'hsla(var(--color-neutral), var(--alpha-secondary))' }} }}, 'Thoth Open Metadata'),
React.createElement('a', {{ href: 'https://thoth.pub/policies/privacy', style: {{ textDecoration: 'none' }} }}, 'Privacy policy'),
)
),
),
);
</script>
</body>
</html>
"#,
"##,
)
}
2 changes: 1 addition & 1 deletion thoth-app-server/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use dotenv::dotenv;
use std::env;
use std::process::{exit, Command};

const TRUNK_VERSION: &str = "0.18.8";
const TRUNK_VERSION: &str = "0.19.2";

fn is_wasm_target_installed() -> bool {
let output = Command::new("rustup")
Expand Down
Loading

0 comments on commit 5ddae2c

Please sign in to comment.