JS>> apod>> 返回
项目作者: ralscha

项目描述 :
Self hosted Astronomy Picture of the Day viewer
高级语言: Java
项目地址: git://github.com/ralscha/apod.git
创建时间: 2017-12-27T09:29:59Z
项目社区:https://github.com/ralscha/apod

开源协议:MIT License

下载


Self hosted NASA Astronomy Picture of the Day (APOD) viewer written with Ionic 7 / Angular 17 (client) and Java (server).

https://apod.hplar.ch/

This is not a PWA. This web app requires a browser with service worker and Cache API implementation.
Currently the app only runs on Chrome and Firefox.

Technology

Server

Written in Java 17 with Spring / Spring Boot.
Periodically polls the APOD API, stores the information in a Xodus database, downloads the normal and high def image and recompresses them with jpeg-recompress to save bandwidth.
Provides a Protocol Buffer endpoint (/apods) for the clients.

Libraries:


Client

Written in TypeScript, CSS, HTML and the Ionic framework.
The app consists of 3 pages:

  • Home: Displays a list of images for each APOD entry. Shows detail page when user taps on image.
  • Detail: Displays the image and underneath the explanation. Shows full page when user taps on image.
  • Full: Displays the high definition image in a scrollable view.

Apod data is stored in IndexedDB. The application accesses the IndexedDB through Dexie.js. Visited images are stored by the service worker in the cache. The application assets are also cached, the app therefore runs when offline. In offline mode the applications shows only entries and images that the user visited before and are therefore cached.

Libraries

Icon

Source: https://www.shareicon.net/science-stars-education-astronomy-universe-telescope-795293
Various sized icons generated with: http://cthedot.de/icongen/

Build tools

Run locally

  • Visit the NASA Open API page and apply for an API key (it’s free)
    https://api.nasa.gov/index.html#apply-for-an-api-key

  • Open server/src/main/resources/application.properties and enter the API key
    app.nasa-api-key=<enter key here>

  • Download some test data. The following command will download the last 10 days.

    1. cd apod/server
    2. ./mvnw spring-boot:run -Dspring.profiles.active=development -Dspring-boot.run.arguments=import10
  • Start the server

    1. ./mvnw spring-boot:run -Dspring.profiles.active=development
  • Start the client

    1. cd apod/client
    2. ionic serve