2.9.0: RESTful and fixes
After more than half a year since the latest release, LWT 2.9.0 fixes numerous bugs and brings something big: a new REST API! It is now possible to interface LWT with other apps, and the development will feel better than ever!
Added
langFromDict
andtargetLangFromDict
are now officially going to the
kernel utility functions.- Text and title boxes change language according to the text's language for
short text creation/edition, long text creation and text check
(#111). - Refactored texts with OOP:
- New class:
Text
(ininc/classes/Text.php
). - New function:
edit_texts_form
(inedit_texts.php
) that takes a Text object as input.
- New class:
- Tests (checking if you know words) now use AJAX (#112), it has several advantages:
- Musics play fully
- Page do not need to reload.
- The timer continues instead of resetting.
- REST API, the new
api.php
is intended to continue developing itself
as a REST API. It features the following interaction:- On GET, the endpoints are:
/media-files
: the list of audio and video files in the media folder./sentences-with-term
: sentences containing a new term./sentences-with-term/{term-id}
: sentences containing a registered term./similar-terms
: terms similar to a given one./theme-path
: the path for a media using theme./terms
/imported
: imported terms./{term-id}/translations
: translations for a term.
/review
/next-word
: next word to review./tomorrow-count
: number of reviews for the next day.
/phonetic-reading
: phonetic reading for a term or sentence./texts/statistics
: word statistics on texts./version
: REST API version.
- On POST, the endpoints are:
/settings
: save a setting./terms
followed by:/{term-id}
for any term update, in particular:/status
, to change the status, followed by either:/down
: decrement status of a term by one unit./up
: increment status of a term by one unit./set/{new-status}
: set the status of a term.
/translations
: add a translation for an existing word.
/new
: add a translation for a new word.
/texts/{text-id}
followed by:/annotation
: change the text annotation/audio-position
: changeaudio
position./reading-position
: change the reading position.
- On GET, the endpoints are:
- Similar terms mark the word edit form as edited only if something was
actually changed. - You can now specify a socket for your database through
$socket
in
connect.inc.php
. This feature was brought to you by
@hangug-eo in his PR
#132. - You can now change the voice of the TTT feature through
text_to_speech_settings.php
. server_data.php
was reorganized and is more informative with details
about the REST API.
Changed
- User Interface Improvements:
- Prettier UI to navigate between text creation/edition/archive pages.
flex-spaced
now sets the property oftext-align: center;
. This property was inherited before.- The long text import page looks a bit nicer.
- User Experience:
- When reading text, you can click on "Show All" and "Translations" to click the checkbox.
- When changing a word status, the displayed messaged is now more informative: before database change, success message, now: waiting screen, tentative database change, result message (error or success). Under the hood, we are transitioning from pure PHP to AJAX.
- It is faster to exit a text page: audio and reading position saves are now asynchronous.
- Annotations "order" are now identical to
Ti2Order
(intextitems2
). It makes management easier, but users may need to reload the annotations once. - Updated composer dependencies (up-to-date 2023-11-23).
Fixed
- When editing an existing text, surrounding spaces are no longer inserted (#92).
- Language code is better detected from translator URL when editing an existing language.
- The field "Short Text Import" on long text import and was not redirecting to
the intended page. Same goes for "New Text" on "Archived Texts" page. - It was impossible to archive more than one text (#118).
- Testing a word was not changing it's color.
- A warning was sent 'Undefined array key "query"' when creating a new word (#121).
- A warning when savings settings in
settings.php
was sometimes displayed (#121). - Test header was different when testing languages or terms since 2.1.0-fork.
- Wrong link to documentation (
info.php
instead ofdocs/info.html
). Signaled by Mooncake on Discord. - Text reading:
- The reading button is usable at last! Clicking the button a second time stops the reading process (#108).
- Text language code was often not recognized in TTT settings (
text_to_speech_settings.php
). - Clicking the "Read" button in TTT Settings was refreshing the page.
- It was impossible to copy a similar term that had apostrophes (#127).
- A deprecation warning for
trim
was sent in simterms when no similar term was found. - During a text creation, the
media_uri
property ofText
was used instead ofsource
. Thanks to @hangug-eo for his PR #133! - When looking for an audio file on file edit/creation, the displayed path may have been wrong for characters between 0x80 and 0x9F.
- Multi-words were not properly highlighted for languages separating each
character as a word (e. g.: Chinese). Big thanks to @hangug-eo for signaling the issue and solving it in his PR #140! - The database wizard was not correctly saving the password. This is fixed by
@hangug-eo in #132. - The list of translations of a term was sometimes not found on
text annotation edition.
Deprecated
- Legacy AJAX API. The following AJAX interactions are now deprecated in favor to the new REST API (at
api.php
):inc/ajax_show_similar_terms.php
, use/similar-terms
on GET,simterms_lgid
becomeslg_id
andsimterms_word
term
.inc/ajax_add_term_transl.php
- For a new term, use
/terms/new
.lang
becomeslg_id
,text
isterm_text
. - To update an existing term, use
/terms/{term-id}/translations
. Same arguments.
- For a new term, use
inc/ajax_check_regexp.php
should no longer be used and will be removed.inc/ajax_chg_term_status.php
should be accessed through/terms/{term-id}/status
. Argumentdata
is now part of the URL, on post only.inc/ajax_get_phonetic.php
should be accessed through/phonetic-reading
, same arguments.inc/ajax_get_theme.php
should be accessed through/settings/theme-path
. Argumentfilepath
is nowpath
.inc/ajax_save_setting.php
should be accessed through/settings
,k
becomeskey
andv
value
.inc/ajax_save_text_position.php
should be accessed through/texts/{text-id}/reading-position
,tposition
is nowposition
.inc/ajax_word_counts.php
should be accessed through/texts/statistics
, on GET. Argumentid
is nowtexts_id
.inc/ajax_update_media_select.php
should be accessed through/media-files
.inc/ajax_show_sentences.php
should be accessed through/sentences-with-term
, on GET. Argumentlang
is nowlg_id
,word
isword_lc
andwoid
isword_id
,ctl
is no longer required.inc/ajax_show_imported_terms.php
should be accessed through/terms/imported
, same arguments.inc/ajax_save_impr_text.php
should be accessed through/texts/{text-id}/annotation
,id
is now optional.inc/ajax_edit_impr_text.php
:- On display, using
word=""
is now deprecated as the page loads in pure PHP. - On term edition, should be accessed through
/terms/{term-id}/translations
,id
is nowtext_id
andword
becomestext_lc
.
- On display, using
- During a word review (test), a "free" test where the user design there own test SQL is now deprecated and will be removed.
Security
- During tests (word review), test data is no longer be send as raw SQL string, except for "free" test.